@ts-for-gir/cli 3.0.0-beta.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +429 -49
- package/lib/commands/doc.d.ts +1 -17
- package/lib/commands/doc.js +7 -13
- package/lib/commands/doc.js.map +1 -1
- package/lib/commands/generate.d.ts +1 -39
- package/lib/commands/generate.js +8 -25
- package/lib/commands/generate.js.map +1 -1
- package/lib/commands/list.d.ts +1 -11
- package/lib/commands/list.js +6 -10
- package/lib/commands/list.js.map +1 -1
- package/lib/config.d.ts +25 -11
- package/lib/config.js +194 -112
- package/lib/config.js.map +1 -1
- package/lib/generation-handler.d.ts +3 -4
- package/lib/generation-handler.js +8 -12
- package/lib/generation-handler.js.map +1 -1
- package/lib/index.d.ts +0 -12
- package/lib/index.js +0 -12
- package/lib/index.js.map +1 -1
- package/lib/module-loader.d.ts +41 -27
- package/lib/module-loader.js +54 -56
- package/lib/module-loader.js.map +1 -1
- package/lib/utils.d.ts +13 -86
- package/lib/utils.js +13 -194
- package/lib/utils.js.map +1 -1
- package/package.json +32 -37
- package/src/commands/doc.ts +9 -14
- package/src/commands/generate.ts +10 -25
- package/src/commands/list.ts +8 -10
- package/src/config.ts +211 -115
- package/src/generation-handler.ts +12 -13
- package/src/index.ts +0 -12
- package/src/module-loader.ts +88 -75
- package/src/utils.ts +12 -222
- package/lib/conflict-resolver.d.ts +0 -155
- package/lib/conflict-resolver.js +0 -1103
- package/lib/conflict-resolver.js.map +0 -1
- package/lib/constants.d.ts +0 -18
- package/lib/constants.js +0 -23
- package/lib/constants.js.map +0 -1
- package/lib/generator.d.ts +0 -5
- package/lib/generator.js +0 -2
- package/lib/generator.js.map +0 -1
- package/lib/gir-factory.d.ts +0 -51
- package/lib/gir-factory.js +0 -361
- package/lib/gir-factory.js.map +0 -1
- package/lib/gir-module.d.ts +0 -256
- package/lib/gir-module.js +0 -2075
- package/lib/gir-module.js.map +0 -1
- package/lib/html-doc-generator.d.ts +0 -13
- package/lib/html-doc-generator.js +0 -18
- package/lib/html-doc-generator.js.map +0 -1
- package/lib/injection/callbacks/gjs/Gio-2.0.d.ts +0 -2
- package/lib/injection/callbacks/gjs/Gio-2.0.js +0 -36
- package/lib/injection/callbacks/gjs/Gio-2.0.js.map +0 -1
- package/lib/injection/callbacks/gjs/index.d.ts +0 -2
- package/lib/injection/callbacks/gjs/index.js +0 -3
- package/lib/injection/callbacks/gjs/index.js.map +0 -1
- package/lib/injection/callbacks/index.d.ts +0 -4
- package/lib/injection/callbacks/index.js +0 -4
- package/lib/injection/callbacks/index.js.map +0 -1
- package/lib/injection/callbacks/node-gtk/index.d.ts +0 -2
- package/lib/injection/callbacks/node-gtk/index.js +0 -2
- package/lib/injection/callbacks/node-gtk/index.js.map +0 -1
- package/lib/injection/classes/GLib-2-0.d.ts +0 -2
- package/lib/injection/classes/GLib-2-0.js +0 -35
- package/lib/injection/classes/GLib-2-0.js.map +0 -1
- package/lib/injection/classes/gjs/GLib-2.0.d.ts +0 -2
- package/lib/injection/classes/gjs/GLib-2.0.js +0 -200
- package/lib/injection/classes/gjs/GLib-2.0.js.map +0 -1
- package/lib/injection/classes/gjs/GObject-2.0.d.ts +0 -2
- package/lib/injection/classes/gjs/GObject-2.0.js +0 -634
- package/lib/injection/classes/gjs/GObject-2.0.js.map +0 -1
- package/lib/injection/classes/gjs/Gio-2.0.d.ts +0 -5
- package/lib/injection/classes/gjs/Gio-2.0.js +0 -218
- package/lib/injection/classes/gjs/Gio-2.0.js.map +0 -1
- package/lib/injection/classes/gjs/index.d.ts +0 -2
- package/lib/injection/classes/gjs/index.js +0 -5
- package/lib/injection/classes/gjs/index.js.map +0 -1
- package/lib/injection/classes/index.d.ts +0 -4
- package/lib/injection/classes/index.js +0 -5
- package/lib/injection/classes/index.js.map +0 -1
- package/lib/injection/classes/node-gtk/GLib-2.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/GLib-2.0.js +0 -19
- package/lib/injection/classes/node-gtk/GLib-2.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/GObject-2.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/GObject-2.0.js +0 -66
- package/lib/injection/classes/node-gtk/GObject-2.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Gdk-4.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Gdk-4.0.js +0 -32
- package/lib/injection/classes/node-gtk/Gdk-4.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Gio-2.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Gio-2.0.js +0 -14
- package/lib/injection/classes/node-gtk/Gio-2.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Graphene-1.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Graphene-1.0.js +0 -133
- package/lib/injection/classes/node-gtk/Graphene-1.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Gtk-3.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Gtk-3.0.js +0 -31
- package/lib/injection/classes/node-gtk/Gtk-3.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Gtk-4.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Gtk-4.0.js +0 -52
- package/lib/injection/classes/node-gtk/Gtk-4.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/Pango-1.0.d.ts +0 -2
- package/lib/injection/classes/node-gtk/Pango-1.0.js +0 -31
- package/lib/injection/classes/node-gtk/Pango-1.0.js.map +0 -1
- package/lib/injection/classes/node-gtk/index.d.ts +0 -2
- package/lib/injection/classes/node-gtk/index.js +0 -19
- package/lib/injection/classes/node-gtk/index.js.map +0 -1
- package/lib/injection/index.d.ts +0 -3
- package/lib/injection/index.js +0 -4
- package/lib/injection/index.js.map +0 -1
- package/lib/injection/injector.d.ts +0 -17
- package/lib/injection/injector.js +0 -139
- package/lib/injection/injector.js.map +0 -1
- package/lib/logger.d.ts +0 -36
- package/lib/logger.js +0 -137
- package/lib/logger.js.map +0 -1
- package/lib/messages.d.ts +0 -30
- package/lib/messages.js +0 -45
- package/lib/messages.js.map +0 -1
- package/lib/symtable.d.ts +0 -24
- package/lib/symtable.js +0 -63
- package/lib/symtable.js.map +0 -1
- package/lib/template-processor.d.ts +0 -75
- package/lib/template-processor.js +0 -207
- package/lib/template-processor.js.map +0 -1
- package/lib/transformation.d.ts +0 -156
- package/lib/transformation.js +0 -523
- package/lib/transformation.js.map +0 -1
- package/lib/type-definition-generator.d.ts +0 -116
- package/lib/type-definition-generator.js +0 -989
- package/lib/type-definition-generator.js.map +0 -1
- package/lib/types/answer-version.d.ts +0 -4
- package/lib/types/answer-version.js +0 -2
- package/lib/types/answer-version.js.map +0 -1
- package/lib/types/build-type.d.ts +0 -1
- package/lib/types/build-type.js +0 -2
- package/lib/types/build-type.js.map +0 -1
- package/lib/types/class-parent.d.ts +0 -11
- package/lib/types/class-parent.js +0 -2
- package/lib/types/class-parent.js.map +0 -1
- package/lib/types/config-flags.d.ts +0 -4
- package/lib/types/config-flags.js +0 -2
- package/lib/types/config-flags.js.map +0 -1
- package/lib/types/conflict-child-element.d.ts +0 -10
- package/lib/types/conflict-child-element.js +0 -2
- package/lib/types/conflict-child-element.js.map +0 -1
- package/lib/types/conflict-grouped-element.d.ts +0 -6
- package/lib/types/conflict-grouped-element.js +0 -2
- package/lib/types/conflict-grouped-element.js.map +0 -1
- package/lib/types/conflict-grouped-elements.d.ts +0 -4
- package/lib/types/conflict-grouped-elements.js +0 -2
- package/lib/types/conflict-grouped-elements.js.map +0 -1
- package/lib/types/construct-name.d.ts +0 -1
- package/lib/types/construct-name.js +0 -2
- package/lib/types/construct-name.js.map +0 -1
- package/lib/types/dependency-map.d.ts +0 -4
- package/lib/types/dependency-map.js +0 -2
- package/lib/types/dependency-map.js.map +0 -1
- package/lib/types/dependency.d.ts +0 -14
- package/lib/types/dependency.js +0 -2
- package/lib/types/dependency.js.map +0 -1
- package/lib/types/environment.d.ts +0 -1
- package/lib/types/environment.js +0 -2
- package/lib/types/environment.js.map +0 -1
- package/lib/types/generate-config.d.ts +0 -34
- package/lib/types/generate-config.js +0 -2
- package/lib/types/generate-config.js.map +0 -1
- package/lib/types/generator-type.d.ts +0 -4
- package/lib/types/generator-type.js +0 -6
- package/lib/types/generator-type.js.map +0 -1
- package/lib/types/gir-alias-element.d.ts +0 -13
- package/lib/types/gir-alias-element.js +0 -2
- package/lib/types/gir-alias-element.js.map +0 -1
- package/lib/types/gir-annotation.d.ts +0 -9
- package/lib/types/gir-annotation.js +0 -2
- package/lib/types/gir-annotation.js.map +0 -1
- package/lib/types/gir-any-element.d.ts +0 -2
- package/lib/types/gir-any-element.js +0 -2
- package/lib/types/gir-any-element.js.map +0 -1
- package/lib/types/gir-any-type.d.ts +0 -5
- package/lib/types/gir-any-type.js +0 -2
- package/lib/types/gir-any-type.js.map +0 -1
- package/lib/types/gir-array-type.d.ts +0 -20
- package/lib/types/gir-array-type.js +0 -3
- package/lib/types/gir-array-type.js.map +0 -1
- package/lib/types/gir-bitfield-element.d.ts +0 -17
- package/lib/types/gir-bitfield-element.js +0 -2
- package/lib/types/gir-bitfield-element.js.map +0 -1
- package/lib/types/gir-boolean.d.ts +0 -1
- package/lib/types/gir-boolean.js +0 -2
- package/lib/types/gir-boolean.js.map +0 -1
- package/lib/types/gir-boxed-element.d.ts +0 -15
- package/lib/types/gir-boxed-element.js +0 -2
- package/lib/types/gir-boxed-element.js.map +0 -1
- package/lib/types/gir-c-include.d.ts +0 -7
- package/lib/types/gir-c-include.js +0 -2
- package/lib/types/gir-c-include.js.map +0 -1
- package/lib/types/gir-callable-attrs.d.ts +0 -15
- package/lib/types/gir-callable-attrs.js +0 -3
- package/lib/types/gir-callable-attrs.js.map +0 -1
- package/lib/types/gir-callable-param-element.d.ts +0 -30
- package/lib/types/gir-callable-param-element.js +0 -2
- package/lib/types/gir-callable-param-element.js.map +0 -1
- package/lib/types/gir-callable-param.d.ts +0 -7
- package/lib/types/gir-callable-param.js +0 -2
- package/lib/types/gir-callable-param.js.map +0 -1
- package/lib/types/gir-callable-return.d.ts +0 -22
- package/lib/types/gir-callable-return.js +0 -2
- package/lib/types/gir-callable-return.js.map +0 -1
- package/lib/types/gir-callback-element.d.ts +0 -15
- package/lib/types/gir-callback-element.js +0 -2
- package/lib/types/gir-callback-element.js.map +0 -1
- package/lib/types/gir-class-element.d.ts +0 -48
- package/lib/types/gir-class-element.js +0 -2
- package/lib/types/gir-class-element.js.map +0 -1
- package/lib/types/gir-constant-element.d.ts +0 -15
- package/lib/types/gir-constant-element.js +0 -2
- package/lib/types/gir-constant-element.js.map +0 -1
- package/lib/types/gir-constructor-element.d.ts +0 -8
- package/lib/types/gir-constructor-element.js +0 -2
- package/lib/types/gir-constructor-element.js.map +0 -1
- package/lib/types/gir-direction.d.ts +0 -5
- package/lib/types/gir-direction.js +0 -7
- package/lib/types/gir-direction.js.map +0 -1
- package/lib/types/gir-doc-element.d.ts +0 -68
- package/lib/types/gir-doc-element.js +0 -2
- package/lib/types/gir-doc-element.js.map +0 -1
- package/lib/types/gir-enum-element.d.ts +0 -19
- package/lib/types/gir-enum-element.js +0 -2
- package/lib/types/gir-enum-element.js.map +0 -1
- package/lib/types/gir-field-element.d.ts +0 -18
- package/lib/types/gir-field-element.js +0 -2
- package/lib/types/gir-field-element.js.map +0 -1
- package/lib/types/gir-function-element.d.ts +0 -8
- package/lib/types/gir-function-element.js +0 -2
- package/lib/types/gir-function-element.js.map +0 -1
- package/lib/types/gir-implements.d.ts +0 -8
- package/lib/types/gir-implements.js +0 -2
- package/lib/types/gir-implements.js.map +0 -1
- package/lib/types/gir-include.d.ts +0 -9
- package/lib/types/gir-include.js +0 -2
- package/lib/types/gir-include.js.map +0 -1
- package/lib/types/gir-info-attrs.d.ts +0 -13
- package/lib/types/gir-info-attrs.js +0 -2
- package/lib/types/gir-info-attrs.js.map +0 -1
- package/lib/types/gir-info-elements.d.ts +0 -5
- package/lib/types/gir-info-elements.js +0 -2
- package/lib/types/gir-info-elements.js.map +0 -1
- package/lib/types/gir-instance-parameter.d.ts +0 -21
- package/lib/types/gir-instance-parameter.js +0 -2
- package/lib/types/gir-instance-parameter.js.map +0 -1
- package/lib/types/gir-interface-element.d.ts +0 -31
- package/lib/types/gir-interface-element.js +0 -2
- package/lib/types/gir-interface-element.js.map +0 -1
- package/lib/types/gir-member-element.d.ts +0 -17
- package/lib/types/gir-member-element.js +0 -2
- package/lib/types/gir-member-element.js.map +0 -1
- package/lib/types/gir-method-element.d.ts +0 -13
- package/lib/types/gir-method-element.js +0 -2
- package/lib/types/gir-method-element.js.map +0 -1
- package/lib/types/gir-module-resolved-by.d.ts +0 -10
- package/lib/types/gir-module-resolved-by.js +0 -2
- package/lib/types/gir-module-resolved-by.js.map +0 -1
- package/lib/types/gir-modules-grouped-map.d.ts +0 -4
- package/lib/types/gir-modules-grouped-map.js +0 -2
- package/lib/types/gir-modules-grouped-map.js.map +0 -1
- package/lib/types/gir-modules-grouped.d.ts +0 -12
- package/lib/types/gir-modules-grouped.js +0 -2
- package/lib/types/gir-modules-grouped.js.map +0 -1
- package/lib/types/gir-namespace.d.ts +0 -30
- package/lib/types/gir-namespace.js +0 -2
- package/lib/types/gir-namespace.js.map +0 -1
- package/lib/types/gir-package.d.ts +0 -7
- package/lib/types/gir-package.js +0 -2
- package/lib/types/gir-package.js.map +0 -1
- package/lib/types/gir-prerequisite.d.ts +0 -5
- package/lib/types/gir-prerequisite.js +0 -2
- package/lib/types/gir-prerequisite.js.map +0 -1
- package/lib/types/gir-property-element.d.ts +0 -21
- package/lib/types/gir-property-element.js +0 -2
- package/lib/types/gir-property-element.js.map +0 -1
- package/lib/types/gir-record-element.d.ts +0 -30
- package/lib/types/gir-record-element.js +0 -2
- package/lib/types/gir-record-element.js.map +0 -1
- package/lib/types/gir-repository.d.ts +0 -16
- package/lib/types/gir-repository.js +0 -2
- package/lib/types/gir-repository.js.map +0 -1
- package/lib/types/gir-signal.d.ts +0 -25
- package/lib/types/gir-signal.js +0 -2
- package/lib/types/gir-signal.js.map +0 -1
- package/lib/types/gir-transfer-ownership-type.d.ts +0 -5
- package/lib/types/gir-transfer-ownership-type.js +0 -7
- package/lib/types/gir-transfer-ownership-type.js.map +0 -1
- package/lib/types/gir-transfer-ownership.d.ts +0 -5
- package/lib/types/gir-transfer-ownership.js +0 -2
- package/lib/types/gir-transfer-ownership.js.map +0 -1
- package/lib/types/gir-type.d.ts +0 -14
- package/lib/types/gir-type.js +0 -2
- package/lib/types/gir-type.js.map +0 -1
- package/lib/types/gir-union-element.d.ts +0 -22
- package/lib/types/gir-union-element.js +0 -2
- package/lib/types/gir-union-element.js.map +0 -1
- package/lib/types/gir-unparsed-number.d.ts +0 -2
- package/lib/types/gir-unparsed-number.js +0 -2
- package/lib/types/gir-unparsed-number.js.map +0 -1
- package/lib/types/gir-var-args.d.ts +0 -5
- package/lib/types/gir-var-args.js +0 -2
- package/lib/types/gir-var-args.js.map +0 -1
- package/lib/types/gir-virtual-method.d.ts +0 -10
- package/lib/types/gir-virtual-method.js +0 -2
- package/lib/types/gir-virtual-method.js.map +0 -1
- package/lib/types/index.d.ts +0 -118
- package/lib/types/index.js +0 -119
- package/lib/types/index.js.map +0 -1
- package/lib/types/inheritance-table.d.ts +0 -3
- package/lib/types/inheritance-table.js +0 -2
- package/lib/types/inheritance-table.js.map +0 -1
- package/lib/types/injection-callback.d.ts +0 -16
- package/lib/types/injection-callback.js +0 -2
- package/lib/types/injection-callback.js.map +0 -1
- package/lib/types/injection-class.d.ts +0 -25
- package/lib/types/injection-class.js +0 -2
- package/lib/types/injection-class.js.map +0 -1
- package/lib/types/injection-function.d.ts +0 -7
- package/lib/types/injection-function.js +0 -2
- package/lib/types/injection-function.js.map +0 -1
- package/lib/types/injection-generic-parameter.d.ts +0 -2
- package/lib/types/injection-generic-parameter.js +0 -2
- package/lib/types/injection-generic-parameter.js.map +0 -1
- package/lib/types/injection-instance-parameter.d.ts +0 -2
- package/lib/types/injection-instance-parameter.js +0 -2
- package/lib/types/injection-instance-parameter.js.map +0 -1
- package/lib/types/injection-parameter.d.ts +0 -8
- package/lib/types/injection-parameter.js +0 -2
- package/lib/types/injection-parameter.js.map +0 -1
- package/lib/types/injection-property.d.ts +0 -4
- package/lib/types/injection-property.js +0 -2
- package/lib/types/injection-property.js.map +0 -1
- package/lib/types/injection-type.d.ts +0 -2
- package/lib/types/injection-type.js +0 -2
- package/lib/types/injection-type.js.map +0 -1
- package/lib/types/injection.d.ts +0 -5
- package/lib/types/injection.js +0 -2
- package/lib/types/injection.js.map +0 -1
- package/lib/types/local-name-check.d.ts +0 -4
- package/lib/types/local-name-check.js +0 -2
- package/lib/types/local-name-check.js.map +0 -1
- package/lib/types/local-name-type.d.ts +0 -1
- package/lib/types/local-name-type.js +0 -2
- package/lib/types/local-name-type.js.map +0 -1
- package/lib/types/local-name.d.ts +0 -7
- package/lib/types/local-name.js +0 -2
- package/lib/types/local-name.js.map +0 -1
- package/lib/types/local-names.d.ts +0 -4
- package/lib/types/local-names.js +0 -2
- package/lib/types/local-names.js.map +0 -1
- package/lib/types/module-type.d.ts +0 -1
- package/lib/types/module-type.js +0 -2
- package/lib/types/module-type.js.map +0 -1
- package/lib/types/parsed-gir.d.ts +0 -4
- package/lib/types/parsed-gir.js +0 -2
- package/lib/types/parsed-gir.js.map +0 -1
- package/lib/types/part-of-class.d.ts +0 -7
- package/lib/types/part-of-class.js +0 -2
- package/lib/types/part-of-class.js.map +0 -1
- package/lib/types/part-of-module.d.ts +0 -6
- package/lib/types/part-of-module.js +0 -2
- package/lib/types/part-of-module.js.map +0 -1
- package/lib/types/resolve-type.d.ts +0 -4
- package/lib/types/resolve-type.js +0 -6
- package/lib/types/resolve-type.js.map +0 -1
- package/lib/types/sym-table-items.d.ts +0 -4
- package/lib/types/sym-table-items.js +0 -2
- package/lib/types/sym-table-items.js.map +0 -1
- package/lib/types/transformation-case.d.ts +0 -1
- package/lib/types/transformation-case.js +0 -2
- package/lib/types/transformation-case.js.map +0 -1
- package/lib/types/transformations.d.ts +0 -11
- package/lib/types/transformations.js +0 -2
- package/lib/types/transformations.js.map +0 -1
- package/lib/types/ts-alias.d.ts +0 -10
- package/lib/types/ts-alias.js +0 -2
- package/lib/types/ts-alias.js.map +0 -1
- package/lib/types/ts-callback-interface.d.ts +0 -10
- package/lib/types/ts-callback-interface.js +0 -2
- package/lib/types/ts-callback-interface.js.map +0 -1
- package/lib/types/ts-callback.d.ts +0 -17
- package/lib/types/ts-callback.js +0 -2
- package/lib/types/ts-callback.js.map +0 -1
- package/lib/types/ts-class.d.ts +0 -85
- package/lib/types/ts-class.js +0 -2
- package/lib/types/ts-class.js.map +0 -1
- package/lib/types/ts-doc-tag.d.ts +0 -21
- package/lib/types/ts-doc-tag.js +0 -2
- package/lib/types/ts-doc-tag.js.map +0 -1
- package/lib/types/ts-doc.d.ts +0 -20
- package/lib/types/ts-doc.js +0 -2
- package/lib/types/ts-doc.js.map +0 -1
- package/lib/types/ts-enum.d.ts +0 -12
- package/lib/types/ts-enum.js +0 -2
- package/lib/types/ts-enum.js.map +0 -1
- package/lib/types/ts-function.d.ts +0 -44
- package/lib/types/ts-function.js +0 -2
- package/lib/types/ts-function.js.map +0 -1
- package/lib/types/ts-generic-parameter.d.ts +0 -8
- package/lib/types/ts-generic-parameter.js +0 -2
- package/lib/types/ts-generic-parameter.js.map +0 -1
- package/lib/types/ts-instance-parameter.d.ts +0 -4
- package/lib/types/ts-instance-parameter.js +0 -2
- package/lib/types/ts-instance-parameter.js.map +0 -1
- package/lib/types/ts-member.d.ts +0 -10
- package/lib/types/ts-member.js +0 -2
- package/lib/types/ts-member.js.map +0 -1
- package/lib/types/ts-method.d.ts +0 -5
- package/lib/types/ts-method.js +0 -2
- package/lib/types/ts-method.js.map +0 -1
- package/lib/types/ts-parameter.d.ts +0 -15
- package/lib/types/ts-parameter.js +0 -2
- package/lib/types/ts-parameter.js.map +0 -1
- package/lib/types/ts-property.d.ts +0 -17
- package/lib/types/ts-property.js +0 -2
- package/lib/types/ts-property.js.map +0 -1
- package/lib/types/ts-signal.d.ts +0 -17
- package/lib/types/ts-signal.js +0 -2
- package/lib/types/ts-signal.js.map +0 -1
- package/lib/types/ts-type-name.d.ts +0 -1
- package/lib/types/ts-type-name.js +0 -2
- package/lib/types/ts-type-name.js.map +0 -1
- package/lib/types/ts-type-separator.d.ts +0 -1
- package/lib/types/ts-type-separator.js +0 -2
- package/lib/types/ts-type-separator.js.map +0 -1
- package/lib/types/ts-type.d.ts +0 -22
- package/lib/types/ts-type.js +0 -2
- package/lib/types/ts-type.js.map +0 -1
- package/lib/types/ts-var.d.ts +0 -17
- package/lib/types/ts-var.js +0 -2
- package/lib/types/ts-var.js.map +0 -1
- package/lib/types/type-gir-alias.d.ts +0 -2
- package/lib/types/type-gir-alias.js +0 -2
- package/lib/types/type-gir-alias.js.map +0 -1
- package/lib/types/type-gir-class.d.ts +0 -2
- package/lib/types/type-gir-class.js +0 -2
- package/lib/types/type-gir-class.js.map +0 -1
- package/lib/types/type-gir-element.d.ts +0 -3
- package/lib/types/type-gir-element.js +0 -2
- package/lib/types/type-gir-element.js.map +0 -1
- package/lib/types/type-gir-enumeration-member.d.ts +0 -2
- package/lib/types/type-gir-enumeration-member.js +0 -2
- package/lib/types/type-gir-enumeration-member.js.map +0 -1
- package/lib/types/type-gir-enumeration.d.ts +0 -2
- package/lib/types/type-gir-enumeration.js +0 -2
- package/lib/types/type-gir-enumeration.js.map +0 -1
- package/lib/types/type-gir-function.d.ts +0 -1
- package/lib/types/type-gir-function.js +0 -2
- package/lib/types/type-gir-function.js.map +0 -1
- package/lib/types/type-gir-interface.d.ts +0 -2
- package/lib/types/type-gir-interface.js +0 -2
- package/lib/types/type-gir-interface.js.map +0 -1
- package/lib/types/type-gir-method.d.ts +0 -2
- package/lib/types/type-gir-method.js +0 -2
- package/lib/types/type-gir-method.js.map +0 -1
- package/lib/types/type-gir-parameter.d.ts +0 -1
- package/lib/types/type-gir-parameter.js +0 -2
- package/lib/types/type-gir-parameter.js.map +0 -1
- package/lib/types/type-gir-property.d.ts +0 -2
- package/lib/types/type-gir-property.js +0 -2
- package/lib/types/type-gir-property.js.map +0 -1
- package/lib/types/type-gir-variable.d.ts +0 -1
- package/lib/types/type-gir-variable.js +0 -2
- package/lib/types/type-gir-variable.js.map +0 -1
- package/lib/types/type-ts-element.d.ts +0 -3
- package/lib/types/type-ts-element.js +0 -2
- package/lib/types/type-ts-element.js.map +0 -1
- package/lib/types/type-ts-enumeration-member.d.ts +0 -2
- package/lib/types/type-ts-enumeration-member.js +0 -2
- package/lib/types/type-ts-enumeration-member.js.map +0 -1
- package/lib/types/type-ts-function.d.ts +0 -1
- package/lib/types/type-ts-function.js +0 -2
- package/lib/types/type-ts-function.js.map +0 -1
- package/lib/types/type-ts-property.d.ts +0 -1
- package/lib/types/type-ts-property.js +0 -2
- package/lib/types/type-ts-property.js.map +0 -1
- package/lib/types/user-config-load-result.d.ts +0 -6
- package/lib/types/user-config-load-result.js +0 -2
- package/lib/types/user-config-load-result.js.map +0 -1
- package/lib/types/user-config.d.ts +0 -42
- package/lib/types/user-config.js +0 -2
- package/lib/types/user-config.js.map +0 -1
- package/src/conflict-resolver.ts +0 -1358
- package/src/constants.ts +0 -29
- package/src/generator.ts +0 -10
- package/src/gir-factory.ts +0 -499
- package/src/gir-module.ts +0 -2816
- package/src/html-doc-generator.ts +0 -23
- package/src/injection/callbacks/gjs/Gio-2.0.ts +0 -37
- package/src/injection/callbacks/gjs/index.ts +0 -5
- package/src/injection/callbacks/index.ts +0 -6
- package/src/injection/callbacks/node-gtk/index.ts +0 -3
- package/src/injection/classes/GLib-2-0.ts +0 -36
- package/src/injection/classes/gjs/GLib-2.0.ts +0 -201
- package/src/injection/classes/gjs/GObject-2.0.ts +0 -635
- package/src/injection/classes/gjs/Gio-2.0.ts +0 -219
- package/src/injection/classes/gjs/index.ts +0 -7
- package/src/injection/classes/index.ts +0 -7
- package/src/injection/classes/node-gtk/GLib-2.0.ts +0 -20
- package/src/injection/classes/node-gtk/GObject-2.0.ts +0 -67
- package/src/injection/classes/node-gtk/Gdk-4.0.ts +0 -33
- package/src/injection/classes/node-gtk/Gio-2.0.ts +0 -15
- package/src/injection/classes/node-gtk/Graphene-1.0.ts +0 -134
- package/src/injection/classes/node-gtk/Gtk-3.0.ts +0 -32
- package/src/injection/classes/node-gtk/Gtk-4.0.ts +0 -53
- package/src/injection/classes/node-gtk/Pango-1.0.ts +0 -32
- package/src/injection/classes/node-gtk/index.ts +0 -21
- package/src/injection/index.ts +0 -3
- package/src/injection/injector.ts +0 -184
- package/src/logger.ts +0 -134
- package/src/messages.ts +0 -68
- package/src/symtable.ts +0 -70
- package/src/template-processor.ts +0 -233
- package/src/transformation.ts +0 -583
- package/src/type-definition-generator.ts +0 -1458
- package/src/types/answer-version.ts +0 -4
- package/src/types/build-type.ts +0 -1
- package/src/types/class-parent.ts +0 -12
- package/src/types/config-flags.ts +0 -5
- package/src/types/conflict-child-element.ts +0 -11
- package/src/types/conflict-grouped-element.ts +0 -7
- package/src/types/conflict-grouped-elements.ts +0 -5
- package/src/types/construct-name.ts +0 -11
- package/src/types/dependency-map.ts +0 -4
- package/src/types/dependency.ts +0 -14
- package/src/types/environment.ts +0 -1
- package/src/types/generate-config.ts +0 -35
- package/src/types/generator-type.ts +0 -4
- package/src/types/gir-alias-element.ts +0 -15
- package/src/types/gir-annotation.ts +0 -10
- package/src/types/gir-any-element.ts +0 -35
- package/src/types/gir-any-type.ts +0 -7
- package/src/types/gir-array-type.ts +0 -23
- package/src/types/gir-bitfield-element.ts +0 -20
- package/src/types/gir-boolean.ts +0 -1
- package/src/types/gir-boxed-element.ts +0 -19
- package/src/types/gir-c-include.ts +0 -7
- package/src/types/gir-callable-attrs.ts +0 -19
- package/src/types/gir-callable-param-element.ts +0 -45
- package/src/types/gir-callable-param.ts +0 -9
- package/src/types/gir-callable-return.ts +0 -25
- package/src/types/gir-callback-element.ts +0 -28
- package/src/types/gir-class-element.ts +0 -71
- package/src/types/gir-constant-element.ts +0 -17
- package/src/types/gir-constructor-element.ts +0 -18
- package/src/types/gir-direction.ts +0 -5
- package/src/types/gir-doc-element.ts +0 -73
- package/src/types/gir-enum-element.ts +0 -28
- package/src/types/gir-field-element.ts +0 -31
- package/src/types/gir-function-element.ts +0 -19
- package/src/types/gir-implements.ts +0 -9
- package/src/types/gir-include.ts +0 -9
- package/src/types/gir-info-attrs.ts +0 -16
- package/src/types/gir-info-elements.ts +0 -8
- package/src/types/gir-instance-parameter.ts +0 -25
- package/src/types/gir-interface-element.ts +0 -53
- package/src/types/gir-member-element.ts +0 -19
- package/src/types/gir-method-element.ts +0 -25
- package/src/types/gir-module-resolved-by.ts +0 -11
- package/src/types/gir-modules-grouped-map.ts +0 -5
- package/src/types/gir-modules-grouped.ts +0 -13
- package/src/types/gir-namespace.ts +0 -47
- package/src/types/gir-package.ts +0 -7
- package/src/types/gir-prerequisite.ts +0 -5
- package/src/types/gir-property-element.ts +0 -31
- package/src/types/gir-record-element.ts +0 -47
- package/src/types/gir-repository.ts +0 -20
- package/src/types/gir-signal.ts +0 -43
- package/src/types/gir-transfer-ownership-type.ts +0 -5
- package/src/types/gir-transfer-ownership.ts +0 -6
- package/src/types/gir-type.ts +0 -16
- package/src/types/gir-union-element.ts +0 -35
- package/src/types/gir-unparsed-number.ts +0 -2
- package/src/types/gir-var-args.ts +0 -6
- package/src/types/gir-virtual-method.ts +0 -22
- package/src/types/index.ts +0 -118
- package/src/types/inheritance-table.ts +0 -3
- package/src/types/injection-callback.ts +0 -20
- package/src/types/injection-class.ts +0 -30
- package/src/types/injection-function.ts +0 -23
- package/src/types/injection-generic-parameter.ts +0 -3
- package/src/types/injection-instance-parameter.ts +0 -3
- package/src/types/injection-parameter.ts +0 -9
- package/src/types/injection-property.ts +0 -7
- package/src/types/injection-type.ts +0 -3
- package/src/types/injection.ts +0 -6
- package/src/types/local-name-check.ts +0 -5
- package/src/types/local-name-type.ts +0 -1
- package/src/types/local-name.ts +0 -8
- package/src/types/local-names.ts +0 -5
- package/src/types/module-type.ts +0 -1
- package/src/types/parsed-gir.ts +0 -5
- package/src/types/part-of-class.ts +0 -9
- package/src/types/part-of-module.ts +0 -8
- package/src/types/resolve-type.ts +0 -4
- package/src/types/sym-table-items.ts +0 -5
- package/src/types/transformation-case.ts +0 -7
- package/src/types/transformations.ts +0 -12
- package/src/types/ts-alias.ts +0 -11
- package/src/types/ts-callback-interface.ts +0 -11
- package/src/types/ts-callback.ts +0 -21
- package/src/types/ts-class.ts +0 -109
- package/src/types/ts-doc-tag.ts +0 -23
- package/src/types/ts-doc.ts +0 -23
- package/src/types/ts-enum.ts +0 -15
- package/src/types/ts-function.ts +0 -59
- package/src/types/ts-generic-parameter.ts +0 -8
- package/src/types/ts-instance-parameter.ts +0 -4
- package/src/types/ts-member.ts +0 -11
- package/src/types/ts-method.ts +0 -6
- package/src/types/ts-parameter.ts +0 -20
- package/src/types/ts-property.ts +0 -22
- package/src/types/ts-signal.ts +0 -21
- package/src/types/ts-type-name.ts +0 -1
- package/src/types/ts-type-separator.ts +0 -1
- package/src/types/ts-type.ts +0 -25
- package/src/types/ts-var.ts +0 -21
- package/src/types/type-gir-alias.ts +0 -2
- package/src/types/type-gir-class.ts +0 -2
- package/src/types/type-gir-element.ts +0 -25
- package/src/types/type-gir-enumeration-member.ts +0 -2
- package/src/types/type-gir-enumeration.ts +0 -2
- package/src/types/type-gir-function.ts +0 -8
- package/src/types/type-gir-interface.ts +0 -2
- package/src/types/type-gir-method.ts +0 -2
- package/src/types/type-gir-parameter.ts +0 -1
- package/src/types/type-gir-property.ts +0 -2
- package/src/types/type-gir-variable.ts +0 -1
- package/src/types/type-ts-element.ts +0 -13
- package/src/types/type-ts-enumeration-member.ts +0 -2
- package/src/types/type-ts-function.ts +0 -1
- package/src/types/type-ts-property.ts +0 -1
- package/src/types/user-config-load-result.ts +0 -6
- package/src/types/user-config.ts +0 -43
- package/templates/Cogl-2.0.d.ts +0 -0
- package/templates/Gjs/GObject-2.0.d.ts +0 -238
- package/templates/Gjs/Gio-2.0.d.ts +0 -64
- package/templates/Gjs/Gjs.d.ts +0 -137
- package/templates/Gjs/Gjs.js +0 -21
- package/templates/Gjs/GnomeShell.d.ts +0 -122
- package/templates/Gjs/GnomeShell.js +0 -10
- package/templates/Gjs/index.d.ts +0 -594
- package/templates/Gjs/index.js +0 -4
- package/templates/Gjs/misc/dbusUtils.d.ts +0 -15
- package/templates/Gjs/misc/dbusUtils.js +0 -6
- package/templates/Gjs/misc/extensionUtils.d.ts +0 -99
- package/templates/Gjs/misc/extensionUtils.js +0 -6
- package/templates/Gjs/misc/fileUtils.d.ts +0 -49
- package/templates/Gjs/misc/fileUtils.js +0 -6
- package/templates/Gjs/misc/gnomeSession.d.ts +0 -72
- package/templates/Gjs/misc/gnomeSession.js +0 -6
- package/templates/Gjs/module.d.ts +0 -10
- package/templates/Gjs/module.js +0 -16
- package/templates/Gjs/ui/userWidget.d.ts +0 -10
- package/templates/Gjs/ui/userWidget.js +0 -6
- package/templates/Granite-1.0.d.ts +0 -7
- package/templates/Granite-7.0.d.ts +0 -7
- package/templates/GstBase-0.10.d.ts +0 -5
- package/templates/RygelServer-2.6.d.ts +0 -3
- package/templates/node-gtk/GObject-2.0.d.ts +0 -57
- package/templates/node-gtk/index.d.ts +0 -40
- package/templates/node-gtk/index.js +0 -9
- package/templates/node-gtk/module.d.ts +0 -10
- package/templates/node-gtk/module.js +0 -17
package/lib/transformation.js
DELETED
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is where transformations take place for gjs and node-gtk.
|
|
3
|
-
* For example a function names should be transformed to lowerCamelCase for node-gtk but should keep their original name for gjs
|
|
4
|
-
*/
|
|
5
|
-
import { lowerCamelCase, upperCamelCase, isFirstCharNumeric } from './utils.js';
|
|
6
|
-
import { Logger } from './logger.js';
|
|
7
|
-
import { NEW_LINE_REG_EXP } from './constants.js';
|
|
8
|
-
import { WARN_RENAMED_PROPERTY, WARN_RENAMED_CLASS, WARN_RENAMED_CONSTANT, WARN_RENAMED_FIELD, WARN_RENAMED_FUNCTION, WARN_RENAMED_ENUM, WARN_RENAMED_PARAMETER, } from './messages.js';
|
|
9
|
-
export const POD_TYPE_MAP_ARRAY = {
|
|
10
|
-
guint8: 'Uint8Array',
|
|
11
|
-
// Int8Array would probably be more appropriate for gint8, but Uint8Array is better supported
|
|
12
|
-
gint8: 'Uint8Array',
|
|
13
|
-
gunichar: 'string',
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* @see https://developer.gnome.org/glib/stable/glib-Basic-Types.html
|
|
17
|
-
*/
|
|
18
|
-
export const POD_TYPE_MAP = {
|
|
19
|
-
utf8: 'string',
|
|
20
|
-
none: 'void',
|
|
21
|
-
double: 'number',
|
|
22
|
-
'double*': 'number',
|
|
23
|
-
guint: 'number',
|
|
24
|
-
'guint*': 'number',
|
|
25
|
-
guint8: 'number',
|
|
26
|
-
'guint8*': 'number',
|
|
27
|
-
'guint8**': 'number',
|
|
28
|
-
guint16: 'number',
|
|
29
|
-
'guint16*': 'number',
|
|
30
|
-
gint16: 'number',
|
|
31
|
-
'gint16*': 'number',
|
|
32
|
-
guint32: 'number',
|
|
33
|
-
'guint32*': 'number',
|
|
34
|
-
guint64: 'number',
|
|
35
|
-
'guint64*': 'number',
|
|
36
|
-
gunichar: 'string',
|
|
37
|
-
'gunichar*': 'string',
|
|
38
|
-
gint: 'number',
|
|
39
|
-
'gint*': 'number',
|
|
40
|
-
gint8: 'number',
|
|
41
|
-
'gint8*': 'number',
|
|
42
|
-
gint32: 'number',
|
|
43
|
-
'gint32*': 'number',
|
|
44
|
-
gint64: 'number',
|
|
45
|
-
'gint64*': 'number',
|
|
46
|
-
gushort: 'number',
|
|
47
|
-
'gushort*': 'number',
|
|
48
|
-
gfloat: 'number',
|
|
49
|
-
'gfloat*': 'number',
|
|
50
|
-
gboolean: 'boolean',
|
|
51
|
-
'gboolean*': 'boolean',
|
|
52
|
-
gpointer: 'object',
|
|
53
|
-
'gpointer*': 'object',
|
|
54
|
-
gconstpointer: 'object',
|
|
55
|
-
gchar: 'number',
|
|
56
|
-
guchar: 'number',
|
|
57
|
-
glong: 'number',
|
|
58
|
-
gulong: 'number',
|
|
59
|
-
gdouble: 'number',
|
|
60
|
-
gssize: 'number',
|
|
61
|
-
gsize: 'number',
|
|
62
|
-
long: 'number',
|
|
63
|
-
object: 'any',
|
|
64
|
-
gshort: 'number',
|
|
65
|
-
filename: 'string',
|
|
66
|
-
va_list: 'any',
|
|
67
|
-
guintptr: 'number',
|
|
68
|
-
};
|
|
69
|
-
export const C_TYPE_MAP = (value) => {
|
|
70
|
-
const cTypeMap = {
|
|
71
|
-
'char*': 'string',
|
|
72
|
-
'gchar*': 'string',
|
|
73
|
-
'gchar**': 'string',
|
|
74
|
-
'gchar***': 'string',
|
|
75
|
-
'const gchar*': 'string',
|
|
76
|
-
'const char*': 'string',
|
|
77
|
-
uint8: 'number',
|
|
78
|
-
int8: 'number',
|
|
79
|
-
int32: 'number',
|
|
80
|
-
uint16: 'number',
|
|
81
|
-
'int*': 'number',
|
|
82
|
-
int: 'number',
|
|
83
|
-
boolean: 'boolean',
|
|
84
|
-
};
|
|
85
|
-
const result = cTypeMap[value];
|
|
86
|
-
return result;
|
|
87
|
-
};
|
|
88
|
-
// Gjs is permissive for byte-array in parameters but strict for out/return
|
|
89
|
-
// See <https://discourse.gnome.org/t/gjs-bytearray-vs-glib-bytes/4900>
|
|
90
|
-
export const FULL_TYPE_MAP = (environment, value, out = true) => {
|
|
91
|
-
let ba;
|
|
92
|
-
let gb;
|
|
93
|
-
if (environment === 'gjs') {
|
|
94
|
-
ba = 'Uint8Array';
|
|
95
|
-
if (out === false) {
|
|
96
|
-
ba += ' | Gjs.byteArray.ByteArray';
|
|
97
|
-
gb = 'GLib.Bytes | Uint8Array | Gjs.byteArray.ByteArray';
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
gb = undefined; // No transformation
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
// TODO
|
|
105
|
-
ba = 'any';
|
|
106
|
-
gb = 'any';
|
|
107
|
-
}
|
|
108
|
-
const fullTypeMap = {
|
|
109
|
-
'GObject.Value': 'any',
|
|
110
|
-
'GObject.Closure': 'GObject.TClosure',
|
|
111
|
-
'GLib.ByteArray': ba,
|
|
112
|
-
'GLib.Bytes': gb,
|
|
113
|
-
GType: 'GObject.GType',
|
|
114
|
-
'GObject.Type': 'GObject.GType',
|
|
115
|
-
Type: 'GObject.GType',
|
|
116
|
-
'GObject.GType': 'GObject.GType',
|
|
117
|
-
};
|
|
118
|
-
const result = fullTypeMap[value];
|
|
119
|
-
return result;
|
|
120
|
-
};
|
|
121
|
-
/** The reserved variable names listed here cannot be resolved simply by quotation marks */
|
|
122
|
-
export const RESERVED_QUOTE_VARIABLE_NAMES = ['constructor'];
|
|
123
|
-
export const RESERVED_VARIABLE_NAMES = [
|
|
124
|
-
'in',
|
|
125
|
-
'function',
|
|
126
|
-
'true',
|
|
127
|
-
'false',
|
|
128
|
-
'break',
|
|
129
|
-
'arguments',
|
|
130
|
-
'eval',
|
|
131
|
-
'default',
|
|
132
|
-
'new',
|
|
133
|
-
'extends',
|
|
134
|
-
'with',
|
|
135
|
-
'var',
|
|
136
|
-
'class',
|
|
137
|
-
'delete',
|
|
138
|
-
'return',
|
|
139
|
-
'constructor',
|
|
140
|
-
'this', // TODO check if this is used as we would use this in javascript, if so, this is only allowed as the first parameter
|
|
141
|
-
];
|
|
142
|
-
export const RESERVED_CLASS_NAMES = [
|
|
143
|
-
'break',
|
|
144
|
-
'boolean',
|
|
145
|
-
'case',
|
|
146
|
-
'catch',
|
|
147
|
-
'class',
|
|
148
|
-
'const',
|
|
149
|
-
'continue',
|
|
150
|
-
'debugger',
|
|
151
|
-
'default',
|
|
152
|
-
'delete',
|
|
153
|
-
'do',
|
|
154
|
-
'else',
|
|
155
|
-
'enum',
|
|
156
|
-
'export',
|
|
157
|
-
'extends',
|
|
158
|
-
'false',
|
|
159
|
-
'finally',
|
|
160
|
-
'for',
|
|
161
|
-
'function',
|
|
162
|
-
'if',
|
|
163
|
-
'implements',
|
|
164
|
-
'import',
|
|
165
|
-
'in',
|
|
166
|
-
'instanceof',
|
|
167
|
-
'interface',
|
|
168
|
-
'let',
|
|
169
|
-
'new',
|
|
170
|
-
'number',
|
|
171
|
-
'package',
|
|
172
|
-
'private',
|
|
173
|
-
'protected',
|
|
174
|
-
'public',
|
|
175
|
-
'return',
|
|
176
|
-
'static',
|
|
177
|
-
'super',
|
|
178
|
-
'switch',
|
|
179
|
-
'string',
|
|
180
|
-
'this',
|
|
181
|
-
'throw',
|
|
182
|
-
'true',
|
|
183
|
-
'try',
|
|
184
|
-
'typeof',
|
|
185
|
-
'var',
|
|
186
|
-
'void',
|
|
187
|
-
'while',
|
|
188
|
-
'with',
|
|
189
|
-
'yield',
|
|
190
|
-
];
|
|
191
|
-
export const RESERVED_FUNCTION_NAMES = ['false', 'true', 'break'];
|
|
192
|
-
/**
|
|
193
|
-
* Some classes already have their own `.connect`, `.disconnect` or `.emit` methods,
|
|
194
|
-
* so these cannot be overwritten with the Gjs signal methods which have the same name.
|
|
195
|
-
*/
|
|
196
|
-
export const GOBJECT_SIGNAL_METHOD_NAMES = ['connect', 'connect_after', 'emit', 'disconnect'];
|
|
197
|
-
export const IGNORE_GIR_TYPE_TS_DOC_TYPES = [
|
|
198
|
-
'method',
|
|
199
|
-
'enum',
|
|
200
|
-
'enum-member',
|
|
201
|
-
'bitfield-member',
|
|
202
|
-
'property',
|
|
203
|
-
'function',
|
|
204
|
-
'static-function',
|
|
205
|
-
'constant',
|
|
206
|
-
];
|
|
207
|
-
export const RESERVED_NAMESPACE_NAMES = {};
|
|
208
|
-
export class Transformation {
|
|
209
|
-
config;
|
|
210
|
-
/**
|
|
211
|
-
* Rules for the name conventions
|
|
212
|
-
* For node-gtk naming conventions see https://github.com/romgrk/node-gtk#naming-conventions
|
|
213
|
-
* For gjs see https://gjs-docs.gnome.org/ and https://wiki.gnome.org/Attic/Gjs
|
|
214
|
-
*/
|
|
215
|
-
transformations = {
|
|
216
|
-
functionName: {
|
|
217
|
-
node: {
|
|
218
|
-
transformation: 'lowerCamelCase',
|
|
219
|
-
},
|
|
220
|
-
gjs: {
|
|
221
|
-
transformation: 'original',
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
enumName: {
|
|
225
|
-
node: {
|
|
226
|
-
transformation: 'original',
|
|
227
|
-
},
|
|
228
|
-
gjs: {
|
|
229
|
-
transformation: 'original',
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
enumMember: {
|
|
233
|
-
node: {
|
|
234
|
-
transformation: 'upperCase',
|
|
235
|
-
},
|
|
236
|
-
gjs: {
|
|
237
|
-
transformation: 'upperCase',
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
signalName: {
|
|
241
|
-
node: {
|
|
242
|
-
transformation: 'original',
|
|
243
|
-
},
|
|
244
|
-
gjs: {
|
|
245
|
-
transformation: 'original',
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
// GJS always re-writes - to _ (I think?)
|
|
249
|
-
propertyName: {
|
|
250
|
-
node: {
|
|
251
|
-
transformation: 'lowerCamelCase',
|
|
252
|
-
},
|
|
253
|
-
gjs: {
|
|
254
|
-
transformation: 'underscores',
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
parameterName: {
|
|
258
|
-
node: {
|
|
259
|
-
transformation: 'lowerCamelCase',
|
|
260
|
-
},
|
|
261
|
-
gjs: {
|
|
262
|
-
transformation: 'underscores',
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
fieldName: {
|
|
266
|
-
node: {
|
|
267
|
-
transformation: 'lowerCamelCase',
|
|
268
|
-
},
|
|
269
|
-
gjs: {
|
|
270
|
-
transformation: 'underscores',
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
constantName: {
|
|
274
|
-
node: {
|
|
275
|
-
transformation: 'original',
|
|
276
|
-
},
|
|
277
|
-
gjs: {
|
|
278
|
-
transformation: 'original',
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
importName: {
|
|
282
|
-
node: {
|
|
283
|
-
transformation: 'upperCamelCase',
|
|
284
|
-
},
|
|
285
|
-
gjs: {
|
|
286
|
-
transformation: 'upperCamelCase',
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
signalInterfaceName: {
|
|
290
|
-
node: {
|
|
291
|
-
transformation: 'upperCamelCase',
|
|
292
|
-
},
|
|
293
|
-
gjs: {
|
|
294
|
-
transformation: 'upperCamelCase',
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
};
|
|
298
|
-
log;
|
|
299
|
-
constructor(moduleName = 'Transformation', config) {
|
|
300
|
-
this.config = config;
|
|
301
|
-
this.log = new Logger(config.environment, config.verbose, moduleName);
|
|
302
|
-
}
|
|
303
|
-
transformSignalInterfaceName(name) {
|
|
304
|
-
name = this.transform('signalInterfaceName', name);
|
|
305
|
-
return name;
|
|
306
|
-
}
|
|
307
|
-
transformModuleNamespaceName(name) {
|
|
308
|
-
name = this.transformNumericName(name);
|
|
309
|
-
name = this.transform('importName', name);
|
|
310
|
-
if (RESERVED_NAMESPACE_NAMES[name]) {
|
|
311
|
-
name = `${name}_`;
|
|
312
|
-
}
|
|
313
|
-
return name;
|
|
314
|
-
}
|
|
315
|
-
transformClassName(name) {
|
|
316
|
-
const originalName = `${name}`;
|
|
317
|
-
name = this.transformNumericName(name);
|
|
318
|
-
if (RESERVED_CLASS_NAMES.includes(name)) {
|
|
319
|
-
name = `${name}_`;
|
|
320
|
-
}
|
|
321
|
-
if (originalName !== name) {
|
|
322
|
-
this.log.warn(WARN_RENAMED_CLASS(originalName, name));
|
|
323
|
-
}
|
|
324
|
-
return name;
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* // E.g. the NetworkManager-1.0 has enum names starting with 80211
|
|
328
|
-
* @param girEnum The enum
|
|
329
|
-
* @returns The transformed name
|
|
330
|
-
*/
|
|
331
|
-
transformEnumName(girEnum) {
|
|
332
|
-
let name = girEnum.$.name;
|
|
333
|
-
name = this.transform('enumName', name);
|
|
334
|
-
const originalName = `${name}`;
|
|
335
|
-
// For an example enum starting with a number see https://gjs-docs.gnome.org/nm10~1.20.8/nm.80211mode
|
|
336
|
-
name = this.transformNumericName(name);
|
|
337
|
-
if (RESERVED_CLASS_NAMES.includes(name)) {
|
|
338
|
-
name = `${name}_`;
|
|
339
|
-
}
|
|
340
|
-
if (originalName !== name) {
|
|
341
|
-
this.log.warn(WARN_RENAMED_ENUM(originalName, name));
|
|
342
|
-
}
|
|
343
|
-
return name;
|
|
344
|
-
}
|
|
345
|
-
transformEnumMember(memberName) {
|
|
346
|
-
memberName = this.transform('enumMember', memberName);
|
|
347
|
-
memberName = this.transformNumericName(memberName);
|
|
348
|
-
return memberName;
|
|
349
|
-
}
|
|
350
|
-
transformFunctionName(name, isVirtual) {
|
|
351
|
-
name = this.transform('functionName', name);
|
|
352
|
-
// node-gtk has no `vfunc_` prefix for virtual methods
|
|
353
|
-
if (isVirtual && this.config.environment === 'gjs') {
|
|
354
|
-
name = 'vfunc_' + name;
|
|
355
|
-
}
|
|
356
|
-
const originalName = `${name}`;
|
|
357
|
-
name = this.transformNumericName(name);
|
|
358
|
-
if (RESERVED_FUNCTION_NAMES.includes(name)) {
|
|
359
|
-
name = `${name}_TODO`;
|
|
360
|
-
}
|
|
361
|
-
if (originalName !== name) {
|
|
362
|
-
this.log.warn(WARN_RENAMED_FUNCTION(originalName, name));
|
|
363
|
-
}
|
|
364
|
-
return name;
|
|
365
|
-
}
|
|
366
|
-
transformReservedVariableNames(name, allowQuotes) {
|
|
367
|
-
if (RESERVED_VARIABLE_NAMES.includes(name)) {
|
|
368
|
-
if (allowQuotes && !RESERVED_QUOTE_VARIABLE_NAMES.includes(name)) {
|
|
369
|
-
name = `"${name}"`;
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
name = `${name}_`;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return name;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* E.g. GstVideo-1.0 has a class `VideoScaler` with a method called `2d`
|
|
379
|
-
* or NetworkManager-1.0 has methods starting with `80211`
|
|
380
|
-
*/
|
|
381
|
-
transformPropertyName(name, allowQuotes) {
|
|
382
|
-
name = this.transform('propertyName', name);
|
|
383
|
-
const originalName = `${name}`;
|
|
384
|
-
name = this.transformReservedVariableNames(name, allowQuotes);
|
|
385
|
-
name = this.transformNumericName(name, allowQuotes);
|
|
386
|
-
if (originalName !== name) {
|
|
387
|
-
this.log.warn(WARN_RENAMED_PROPERTY(originalName, name));
|
|
388
|
-
}
|
|
389
|
-
return name;
|
|
390
|
-
}
|
|
391
|
-
transformConstantName(name, allowQuotes) {
|
|
392
|
-
name = this.transform('constantName', name);
|
|
393
|
-
const originalName = `${name}`;
|
|
394
|
-
name = this.transformReservedVariableNames(name, allowQuotes);
|
|
395
|
-
name = this.transformNumericName(name, allowQuotes);
|
|
396
|
-
if (originalName !== name) {
|
|
397
|
-
this.log.warn(WARN_RENAMED_CONSTANT(originalName, name));
|
|
398
|
-
}
|
|
399
|
-
return name;
|
|
400
|
-
}
|
|
401
|
-
transformFieldName(name, allowQuotes) {
|
|
402
|
-
name = this.transform('fieldName', name);
|
|
403
|
-
const originalName = `${name}`;
|
|
404
|
-
name = this.transformReservedVariableNames(name, allowQuotes);
|
|
405
|
-
name = this.transformNumericName(name, allowQuotes);
|
|
406
|
-
if (originalName !== name) {
|
|
407
|
-
this.log.warn(WARN_RENAMED_FIELD(originalName, name));
|
|
408
|
-
}
|
|
409
|
-
return name;
|
|
410
|
-
}
|
|
411
|
-
transformParameterName(param, allowQuotes) {
|
|
412
|
-
let name = param.$.name || '-';
|
|
413
|
-
// Such a variable name exists in `GConf-2.0.d.ts` class `Engine` method `change_set_from_current`
|
|
414
|
-
if (name === '...') {
|
|
415
|
-
return '...args';
|
|
416
|
-
}
|
|
417
|
-
name = this.transform('parameterName', name);
|
|
418
|
-
const originalName = `${name}`;
|
|
419
|
-
name = this.transformReservedVariableNames(name, allowQuotes);
|
|
420
|
-
name = this.transformNumericName(name, allowQuotes);
|
|
421
|
-
if (originalName !== name) {
|
|
422
|
-
this.log.warn(WARN_RENAMED_PARAMETER(originalName, name));
|
|
423
|
-
}
|
|
424
|
-
return name;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Fixes type names, e.g. Return types or enum definitions can not start with numbers
|
|
428
|
-
* @param typeName
|
|
429
|
-
*/
|
|
430
|
-
transformTypeName(name) {
|
|
431
|
-
name = this.transformNumericName(name);
|
|
432
|
-
return name;
|
|
433
|
-
}
|
|
434
|
-
transform(construct, transformMe) {
|
|
435
|
-
const transformations = this.transformations[construct][this.config.environment].transformation;
|
|
436
|
-
if (transformations === 'original') {
|
|
437
|
-
return transformMe;
|
|
438
|
-
}
|
|
439
|
-
if (transformations === 'lowerCamelCase') {
|
|
440
|
-
return lowerCamelCase(transformMe);
|
|
441
|
-
}
|
|
442
|
-
if (transformations === 'upperCamelCase') {
|
|
443
|
-
return upperCamelCase(transformMe);
|
|
444
|
-
}
|
|
445
|
-
if (transformations === 'upperCase') {
|
|
446
|
-
return transformMe.toUpperCase();
|
|
447
|
-
}
|
|
448
|
-
if (transformations === 'lowerCase') {
|
|
449
|
-
return transformMe.toLowerCase();
|
|
450
|
-
}
|
|
451
|
-
if (transformations === 'underscores') {
|
|
452
|
-
return transformMe.replace(/-|_/g, '_');
|
|
453
|
-
}
|
|
454
|
-
return transformMe;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* In JavaScript there can be no variables, methods, class names or enum names that start with a number.
|
|
458
|
-
* This method converts such names.
|
|
459
|
-
* TODO: Prepends an `@` to numeric starting names, how does gjs and node-gtk do that?
|
|
460
|
-
* @param name
|
|
461
|
-
* @param allowQuotes
|
|
462
|
-
*/
|
|
463
|
-
transformNumericName(name, allowQuotes = false) {
|
|
464
|
-
if (isFirstCharNumeric(name)) {
|
|
465
|
-
if (allowQuotes)
|
|
466
|
-
name = `"${name}"`;
|
|
467
|
-
else
|
|
468
|
-
name = `TODO_${name}`;
|
|
469
|
-
}
|
|
470
|
-
return name;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Replaces "@any_property" with "`any_property`"
|
|
474
|
-
* @param description E.g. "Creates a binding between @source_property on @source and @target_property on @target."
|
|
475
|
-
* @returns E.g. "Creates a binding between `source_property` on `source` and `target_property` on `target`."
|
|
476
|
-
*/
|
|
477
|
-
transformGirDocHighlights(description) {
|
|
478
|
-
const highlights = description.match(/@[A-Za-z_-]*[^\s.]/gm);
|
|
479
|
-
if (highlights) {
|
|
480
|
-
for (const highlight of highlights) {
|
|
481
|
-
description = description.replace(highlight, `\`${highlight.slice(1)}\``);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return description;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Replaces:
|
|
488
|
-
* |[<!-- language="C" -->
|
|
489
|
-
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
|
|
490
|
-
* ]|
|
|
491
|
-
*
|
|
492
|
-
* with
|
|
493
|
-
* ```c
|
|
494
|
-
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
|
|
495
|
-
* ```
|
|
496
|
-
*
|
|
497
|
-
* @param description
|
|
498
|
-
*/
|
|
499
|
-
transformGirDocCodeBlocks(description) {
|
|
500
|
-
description = description.replaceAll(/\|\[<!-- language="C" -->/gm, '\n```c').replaceAll(/\]\|/gm, '```\n');
|
|
501
|
-
return description;
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Transforms the documentation text to markdown
|
|
505
|
-
* TODO: Transform references to link tags: https://tsdoc.org/pages/tags/link/
|
|
506
|
-
* @param text
|
|
507
|
-
* @returns
|
|
508
|
-
*/
|
|
509
|
-
transformGirDoc(text) {
|
|
510
|
-
text = this.transformGirDocHighlights(text);
|
|
511
|
-
text = this.transformGirDocCodeBlocks(text);
|
|
512
|
-
return text;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Transforms the tsDoc tag <text> like `@param name <text>`
|
|
516
|
-
* @param text
|
|
517
|
-
* @returns
|
|
518
|
-
*/
|
|
519
|
-
transformGirDocTagText(text) {
|
|
520
|
-
return text.replace(NEW_LINE_REG_EXP, ' ');
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
//# sourceMappingURL=transformation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformation.js","sourceRoot":"","sources":["../src/transformation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACzB,MAAM,eAAe,CAAA;AAEtB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,MAAM,EAAE,YAAY;IACpB,6FAA6F;IAC7F,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,QAAQ;CACrB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,QAAQ;IACnB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,QAAQ;IACnB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,QAAQ;IAChB,SAAS,E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AC,SAAS,EAAE,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;aAC5E;SACJ;QACD,OAAO,WAAW,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,yBAAyB,CAAC,WAAmB;QACjD,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAC3G,OAAO,WAAW,CAAA;IACtB,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,IAAY;QAC/B,IAAI,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAA;QAC3C,IAAI,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;;;OAIG;IACI,sBAAsB,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;IAC9C,CAAC;CACJ"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { GenerateConfig, InheritanceTable, GirModulesGrouped } from './types/index.js';
|
|
2
|
-
import { Generator } from './generator.js';
|
|
3
|
-
import type { GirModule } from './gir-module.js';
|
|
4
|
-
import { Logger } from './logger.js';
|
|
5
|
-
export default class TypeDefinitionGenerator implements Generator {
|
|
6
|
-
protected readonly config: GenerateConfig;
|
|
7
|
-
protected log: Logger;
|
|
8
|
-
constructor(config: GenerateConfig);
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @param namespace E.g. 'Gtk'
|
|
12
|
-
* @param packageName E.g. 'Gtk-3.0'
|
|
13
|
-
* @param asExternType Currently only used for node type imports
|
|
14
|
-
*/
|
|
15
|
-
private generateModuleDependenciesImport;
|
|
16
|
-
private generateExport;
|
|
17
|
-
private generateProperty;
|
|
18
|
-
private generateProperties;
|
|
19
|
-
private generateVariableCallbackType;
|
|
20
|
-
private generateVariable;
|
|
21
|
-
private generateTypes;
|
|
22
|
-
private generateGenericValues;
|
|
23
|
-
private generateType;
|
|
24
|
-
/**
|
|
25
|
-
* Generates signals from all properties of a base class
|
|
26
|
-
* TODO: Build new `GirSignalElement`s in `gir-module.ts` instead of generate the strings directly
|
|
27
|
-
* @param girClass
|
|
28
|
-
* @param namespace
|
|
29
|
-
* @param indentCount
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
private generateClassPropertySignals;
|
|
33
|
-
private generateInParameters;
|
|
34
|
-
private generateSignals;
|
|
35
|
-
/**
|
|
36
|
-
* Adds documentation comments
|
|
37
|
-
* @see https://github.com/microsoft/tsdoc
|
|
38
|
-
* @param lines
|
|
39
|
-
* @param indentCount
|
|
40
|
-
*/
|
|
41
|
-
private addTSDocCommentLines;
|
|
42
|
-
/**
|
|
43
|
-
* Adds the documentation as comments
|
|
44
|
-
* @see https://github.com/microsoft/tsdoc
|
|
45
|
-
* @param girDoc
|
|
46
|
-
* @param indentCount
|
|
47
|
-
* @param overwriteDoc
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
private addGirDocComment;
|
|
51
|
-
/**
|
|
52
|
-
* Adds an info comment, is used for debugging the generated types
|
|
53
|
-
* @param comment
|
|
54
|
-
* @param indentCount
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
private addInfoComment;
|
|
58
|
-
/**
|
|
59
|
-
* Adds an inline info comment, is used for debugging the generated types
|
|
60
|
-
* @param comment
|
|
61
|
-
* @param indentCount
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
private addInlineInfoComment;
|
|
65
|
-
private mergeDescs;
|
|
66
|
-
private generateParameter;
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param tsGenerics
|
|
70
|
-
* @param isOut If this generic parameters are out do only generate the type parameter names
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
private generateGenericParameters;
|
|
74
|
-
private generateOutParameterReturn;
|
|
75
|
-
private generateFunctionReturn;
|
|
76
|
-
private generateFunction;
|
|
77
|
-
private generateFunctions;
|
|
78
|
-
private generateCallbackInterface;
|
|
79
|
-
private generateCallbackInterfaces;
|
|
80
|
-
private generateEnumeration;
|
|
81
|
-
private generateEnumerationMember;
|
|
82
|
-
private generateConstant;
|
|
83
|
-
private generateAlias;
|
|
84
|
-
private generateConstructPropsInterface;
|
|
85
|
-
private generateClassFields;
|
|
86
|
-
private generateClassProperties;
|
|
87
|
-
private generateClassMethods;
|
|
88
|
-
private generateClassConstructors;
|
|
89
|
-
/**
|
|
90
|
-
* Instance methods, vfunc_ prefix
|
|
91
|
-
* @param girClass
|
|
92
|
-
*/
|
|
93
|
-
private generateClassVirtualMethods;
|
|
94
|
-
private generateClassSignalInterfaces;
|
|
95
|
-
private generateClassSignals;
|
|
96
|
-
private generateClassModules;
|
|
97
|
-
/**
|
|
98
|
-
* In Typescript, interfaces and classes can have the same name,
|
|
99
|
-
* so we use this to generate interfaces with the same name to implement multiple inheritance
|
|
100
|
-
* @param girClass
|
|
101
|
-
* @param namespace
|
|
102
|
-
*/
|
|
103
|
-
private generateImplementationInterface;
|
|
104
|
-
/**
|
|
105
|
-
* Represents a record, GObject class or interface as a Typescript class
|
|
106
|
-
* @param girClass
|
|
107
|
-
* @param namespace
|
|
108
|
-
*/
|
|
109
|
-
private generateClass;
|
|
110
|
-
private exportModuleJS;
|
|
111
|
-
private exportModuleTS;
|
|
112
|
-
private exportModule;
|
|
113
|
-
private exportGjs;
|
|
114
|
-
private exportNodeGtk;
|
|
115
|
-
start(girModules: GirModule[], girModulesGrouped?: GirModulesGrouped[], inheritanceTable?: InheritanceTable): Promise<void>;
|
|
116
|
-
}
|