@ts-for-gir/cli 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -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 +45 -0
- package/lib/commands/generate.js +71 -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 +103 -0
- package/lib/config.js +385 -0
- package/lib/config.js.map +1 -0
- package/lib/conflict-resolver.d.ts +154 -0
- package/lib/conflict-resolver.js +1095 -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/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 +50 -0
- package/lib/gir-factory.js +354 -0
- package/lib/gir-factory.js.map +1 -0
- package/lib/gir-module.d.ts +256 -0
- package/lib/gir-module.js +2075 -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 +74 -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 +136 -0
- package/lib/injection/injector.js.map +1 -0
- package/lib/logger.d.ts +36 -0
- package/lib/logger.js +133 -0
- package/lib/logger.js.map +1 -0
- package/lib/messages.d.ts +30 -0
- package/lib/messages.js +45 -0
- package/lib/messages.js.map +1 -0
- package/lib/module-loader.d.ts +131 -0
- package/lib/module-loader.js +467 -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 +46 -0
- package/lib/template-processor.js +154 -0
- package/lib/template-processor.js.map +1 -0
- package/lib/transformation.d.ts +156 -0
- package/lib/transformation.js +523 -0
- package/lib/transformation.js.map +1 -0
- package/lib/type-definition-generator.d.ts +117 -0
- package/lib/type-definition-generator.js +929 -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 +11 -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 +14 -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/generate-config.d.ts +30 -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 +118 -0
- package/lib/types/index.js +119 -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 +24 -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/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 +20 -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 +44 -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 +22 -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 +38 -0
- package/lib/types/user-config.js +2 -0
- package/lib/types/user-config.js.map +1 -0
- package/lib/utils.d.ts +88 -0
- package/lib/utils.js +189 -0
- package/lib/utils.js.map +1 -0
- package/package.json +72 -0
- package/src/commands/doc.ts +65 -0
- package/src/commands/generate.ts +86 -0
- package/src/commands/index.ts +3 -0
- package/src/commands/list.ts +96 -0
- package/src/config.ts +426 -0
- package/src/conflict-resolver.ts +1350 -0
- package/src/constants.ts +29 -0
- package/src/generation-handler.ts +79 -0
- package/src/generator.ts +10 -0
- package/src/gir-factory.ts +488 -0
- package/src/gir-module.ts +2816 -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 +75 -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 +179 -0
- package/src/logger.ts +134 -0
- package/src/messages.ts +68 -0
- package/src/module-loader.ts +573 -0
- package/src/start.ts +16 -0
- package/src/symtable.ts +70 -0
- package/src/template-processor.ts +170 -0
- package/src/transformation.ts +583 -0
- package/src/type-definition-generator.ts +1387 -0
- package/src/types/answer-version.ts +4 -0
- package/src/types/build-type.ts +1 -0
- package/src/types/class-parent.ts +12 -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 +14 -0
- package/src/types/environment.ts +1 -0
- package/src/types/generate-config.ts +31 -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 +118 -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 +23 -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/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 +23 -0
- package/src/types/ts-enum.ts +15 -0
- package/src/types/ts-function.ts +59 -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 +25 -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 +39 -0
- package/src/utils.ts +217 -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 +64 -0
- package/templates/Gjs/Gjs.d.ts +135 -0
- package/templates/Gjs/Gjs.js +21 -0
- package/templates/Gjs/cast.ts +52 -0
- package/templates/Gjs/index.d.ts +279 -0
- package/templates/Gjs/index.js +4 -0
- package/templates/Gjs/module.d.ts +10 -0
- package/templates/Gjs/module.js +16 -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 +10 -0
- package/templates/node-gtk/module.js +17 -0
package/lib/utils.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
2
|
+
import lodash from 'lodash';
|
|
3
|
+
import Path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { inspect } from 'util';
|
|
7
|
+
import { Logger } from './logger.js';
|
|
8
|
+
import { COMMENT_REG_EXP, PARAM_REG_EXP, OPT_PARAM_REG_EXP } from './constants.js';
|
|
9
|
+
export { inspect };
|
|
10
|
+
export const isEqual = lodash.isEqual;
|
|
11
|
+
export const map = lodash.map;
|
|
12
|
+
export const find = lodash.find;
|
|
13
|
+
export const merge = lodash.merge;
|
|
14
|
+
export const clone = lodash.clone;
|
|
15
|
+
export const cloneDeep = lodash.cloneDeep;
|
|
16
|
+
export const splitModuleName = (packageName) => {
|
|
17
|
+
// There are modules that use multiple hyphens like 'GUPnP-DLNA-1.0'
|
|
18
|
+
const splits = packageName.split('-');
|
|
19
|
+
const version = splits.splice(-1, 1)[0];
|
|
20
|
+
const namespace = splits.join('-');
|
|
21
|
+
return {
|
|
22
|
+
packageName,
|
|
23
|
+
namespace,
|
|
24
|
+
version,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/** Remove namespace prefix */
|
|
28
|
+
export const removeNamespace = (type, namespace) => {
|
|
29
|
+
if (type.startsWith(namespace + '.')) {
|
|
30
|
+
type = type.substring(namespace.length + 1);
|
|
31
|
+
}
|
|
32
|
+
return type;
|
|
33
|
+
};
|
|
34
|
+
/** Remove class module name prefix */
|
|
35
|
+
export const removeClassModule = removeNamespace;
|
|
36
|
+
export const addNamespace = (type, namespace) => {
|
|
37
|
+
if (!type.startsWith(namespace + '.')) {
|
|
38
|
+
type = namespace + '.' + type;
|
|
39
|
+
}
|
|
40
|
+
return type;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Checking whether some variable is iterable
|
|
44
|
+
* see https://stackoverflow.com/a/32538867
|
|
45
|
+
* @param obj Variable to check for iterable
|
|
46
|
+
*/
|
|
47
|
+
export const isIterable = (obj) => {
|
|
48
|
+
return obj != null && typeof obj[Symbol.iterator] === 'function';
|
|
49
|
+
};
|
|
50
|
+
export const isNumeric = (str) => {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
return !isNaN(str - parseFloat(str));
|
|
53
|
+
};
|
|
54
|
+
export const getFirstChar = (str) => {
|
|
55
|
+
return str.charAt(0);
|
|
56
|
+
};
|
|
57
|
+
export const getLastChar = (str) => {
|
|
58
|
+
return str.charAt(str.length - 1);
|
|
59
|
+
};
|
|
60
|
+
export const isFirstCharNumeric = (str) => {
|
|
61
|
+
return isNumeric(getFirstChar(str));
|
|
62
|
+
};
|
|
63
|
+
export const camelCase = (str) => {
|
|
64
|
+
return str
|
|
65
|
+
.replace(/\s(.)|(\s|-|_|\.)(.)/g, (a) => {
|
|
66
|
+
return a.toUpperCase();
|
|
67
|
+
})
|
|
68
|
+
.replace(/(\s|-|_|\.)/g, '');
|
|
69
|
+
};
|
|
70
|
+
export const lowerCamelCase = (str) => {
|
|
71
|
+
str = camelCase(str);
|
|
72
|
+
str = getFirstChar(str).toLowerCase() + str.slice(1);
|
|
73
|
+
return str;
|
|
74
|
+
};
|
|
75
|
+
export const upperCamelCase = (str) => {
|
|
76
|
+
str = camelCase(str);
|
|
77
|
+
str = getFirstChar(str).toUpperCase() + str.slice(1);
|
|
78
|
+
return str;
|
|
79
|
+
};
|
|
80
|
+
export const findFileInDirs = (dirs, filename) => {
|
|
81
|
+
let exists = false;
|
|
82
|
+
for (const dir of dirs) {
|
|
83
|
+
const filePath = Path.join(dir, filename);
|
|
84
|
+
exists = fs.existsSync(filePath);
|
|
85
|
+
if (exists) {
|
|
86
|
+
return {
|
|
87
|
+
path: filePath,
|
|
88
|
+
exists,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
path: null,
|
|
94
|
+
exists,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Union (a ∪ b): create a set that contains the elements of both set a and set b.
|
|
99
|
+
* See https://2ality.com/2015/01/es6-set-operations.html#union
|
|
100
|
+
* @param target
|
|
101
|
+
* @param source
|
|
102
|
+
*/
|
|
103
|
+
export const union = (target, source) => {
|
|
104
|
+
return (target = new Set([...target, ...source]));
|
|
105
|
+
};
|
|
106
|
+
export const stripParamNames = (func, ignoreTail = false) => {
|
|
107
|
+
const g = func;
|
|
108
|
+
func = func.replace(COMMENT_REG_EXP, '');
|
|
109
|
+
const lb = func.split('(', 2);
|
|
110
|
+
if (lb.length < 2)
|
|
111
|
+
Logger.error(`Bad function definition ${g}`);
|
|
112
|
+
const rb = lb[1].split(')');
|
|
113
|
+
const tail = ignoreTail ? '' : rb[rb.length - 1];
|
|
114
|
+
let params = rb.slice(0, rb.length - 1).join(')');
|
|
115
|
+
params = params.replace(PARAM_REG_EXP, ':');
|
|
116
|
+
params = params.replace(OPT_PARAM_REG_EXP, '?:');
|
|
117
|
+
return `${lb[0]}(${params})${tail}`;
|
|
118
|
+
};
|
|
119
|
+
export const isCommentLine = (line) => {
|
|
120
|
+
const lineTrim = line.trim();
|
|
121
|
+
return lineTrim.startsWith('//') || (lineTrim.startsWith('/*') && lineTrim.endsWith('*/'));
|
|
122
|
+
};
|
|
123
|
+
export const generateIndent = (indents = 1, spaceForIndent = 4) => {
|
|
124
|
+
return ' '.repeat(indents * spaceForIndent);
|
|
125
|
+
};
|
|
126
|
+
// Get __dirname on ESM
|
|
127
|
+
export const __filename = fileURLToPath(import.meta.url);
|
|
128
|
+
export const __dirname = Path.dirname(__filename);
|
|
129
|
+
export const getEnvironmentDir = (environment, baseDir) => {
|
|
130
|
+
if (!baseDir.endsWith(environment))
|
|
131
|
+
if (environment === 'gjs' && !baseDir.endsWith('/Gjs')) {
|
|
132
|
+
return Path.join(baseDir, 'Gjs');
|
|
133
|
+
}
|
|
134
|
+
if (environment === 'node' && !baseDir.endsWith('/node-gtk')) {
|
|
135
|
+
return Path.join(baseDir, 'node-gtk');
|
|
136
|
+
}
|
|
137
|
+
return baseDir;
|
|
138
|
+
};
|
|
139
|
+
export const getDestPath = (environment, outputDir, outputFilename) => {
|
|
140
|
+
const outputEnvDir = getEnvironmentDir(environment, outputDir);
|
|
141
|
+
const destPath = Path.join(outputEnvDir, outputFilename);
|
|
142
|
+
return destPath;
|
|
143
|
+
};
|
|
144
|
+
export const girBool = (boolStr, defaultVal = false) => {
|
|
145
|
+
if (boolStr) {
|
|
146
|
+
if (parseInt(boolStr) === 0)
|
|
147
|
+
return false;
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return defaultVal;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Returns `true` if the definitions in `d1` and `d2` have equivalent signatures
|
|
154
|
+
* @param d1
|
|
155
|
+
* @param d2
|
|
156
|
+
*/
|
|
157
|
+
export const signaturesMatch = (d1, d2) => {
|
|
158
|
+
if (isCommentLine(d1) || isCommentLine(d2))
|
|
159
|
+
return false;
|
|
160
|
+
return stripParamNames(d1) == stripParamNames(d2);
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* GirElements contains an attribute `introspectable`, which is a GirBoolean.
|
|
164
|
+
* If this is attribute is falsy the element is not introspectable,
|
|
165
|
+
* this means doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
|
|
166
|
+
*/
|
|
167
|
+
export const girElementIsIntrospectable = (girElement, name) => {
|
|
168
|
+
if (!girElement) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
name = name || girElement?.$?.name;
|
|
172
|
+
if (!name) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
// Handle introspectable only if the attribute is also present...
|
|
176
|
+
if (girElement.$.hasOwnProperty('introspectable') && girElement.$.introspectable !== undefined) {
|
|
177
|
+
return girBool(girElement.$.introspectable, true);
|
|
178
|
+
}
|
|
179
|
+
// ...otherwise we assume that it is introspectable
|
|
180
|
+
return true;
|
|
181
|
+
};
|
|
182
|
+
export const typeIsOptional = (types) => {
|
|
183
|
+
for (const type of types) {
|
|
184
|
+
if (type.optional)
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,O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|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ts-for-gir/cli",
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
|
+
"description": "Typescript .d.ts generator from GIR for gjs and node-gtk",
|
|
5
|
+
"module": "lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ts-for-gir": "./lib/start.js"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=16"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "yarn node --max_old_space_size=9216 lib/start.js",
|
|
15
|
+
"build": "yarn run clear:build && yarn run lint && yarn run build:ts && yarn run chmod",
|
|
16
|
+
"chmod": "chmod +x ./lib/start.js",
|
|
17
|
+
"build:ts": "tsc",
|
|
18
|
+
"clear": "yarn run clear:build",
|
|
19
|
+
"clear:build": "rimraf ./lib",
|
|
20
|
+
"watch": "yarn run build:ts -- --watch",
|
|
21
|
+
"lint": "eslint . --ext .ts,.tsx --fix"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/sammydre/ts-for-gjs.git"
|
|
26
|
+
},
|
|
27
|
+
"author": "Pascal Garber <pascal@artandcode.studio>",
|
|
28
|
+
"files": [
|
|
29
|
+
"src",
|
|
30
|
+
"bin",
|
|
31
|
+
"lib",
|
|
32
|
+
"templates"
|
|
33
|
+
],
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/sammydre/ts-for-gjs/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/sammydre/ts-for-gjs#readme",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/change-case": "^2.3.1",
|
|
41
|
+
"@types/columnify": "^1.5.1",
|
|
42
|
+
"@types/ejs": "^3.1.1",
|
|
43
|
+
"@types/eslint": "8.4.5",
|
|
44
|
+
"@types/inquirer": "^8.2.1",
|
|
45
|
+
"@types/lodash": "^4.14.182",
|
|
46
|
+
"@types/node": "^18.0.3",
|
|
47
|
+
"@types/prettier": "^2.6.3",
|
|
48
|
+
"@types/xml2js": "^0.4.11",
|
|
49
|
+
"@types/yargs": "^17.0.10",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
51
|
+
"@typescript-eslint/parser": "^5.30.6",
|
|
52
|
+
"eslint": "^8.19.0",
|
|
53
|
+
"eslint-config-prettier": "^8.5.0",
|
|
54
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
55
|
+
"rimraf": "^3.0.2",
|
|
56
|
+
"typescript": "4.7.4"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"colorette": "^2.0.19",
|
|
60
|
+
"columnify": "^1.6.0",
|
|
61
|
+
"cosmiconfig": "^7.0.1",
|
|
62
|
+
"ejs": "^3.1.8",
|
|
63
|
+
"events": "^3.3.0",
|
|
64
|
+
"globby": "^13.1.2",
|
|
65
|
+
"inquirer": "^9.0.0",
|
|
66
|
+
"lodash": "^4.17.21",
|
|
67
|
+
"prettier": "^2.7.1",
|
|
68
|
+
"tiny-glob": "^0.2.9",
|
|
69
|
+
"xml2js": "^0.4.23",
|
|
70
|
+
"yargs": "^17.5.1"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Argv } from 'yargs'
|
|
6
|
+
|
|
7
|
+
import { GenerationHandler } from '../generation-handler.js'
|
|
8
|
+
import { Config } from '../config.js'
|
|
9
|
+
import { ModuleLoader } from '../module-loader.js'
|
|
10
|
+
import { ConfigFlags, GeneratorType } from '../types/index.js'
|
|
11
|
+
import { Logger } from '../logger.js'
|
|
12
|
+
import { ERROR_NO_MODULES_FOUND } from '../messages.js'
|
|
13
|
+
|
|
14
|
+
const command = 'doc [modules..]'
|
|
15
|
+
|
|
16
|
+
const description = 'The HTML documentation generator is not yet implemented, but feel free to implement it 🤗'
|
|
17
|
+
|
|
18
|
+
const builder = (yargs: Argv) => {
|
|
19
|
+
return yargs
|
|
20
|
+
.option('modules', Config.generateOptions.modules)
|
|
21
|
+
.option('girDirectories', Config.generateOptions.girDirectories)
|
|
22
|
+
.option('outdir', Config.generateOptions.outdir)
|
|
23
|
+
.option('environments', Config.generateOptions.environments)
|
|
24
|
+
.option('ignore', Config.generateOptions.ignore)
|
|
25
|
+
.option('verbose', Config.generateOptions.verbose)
|
|
26
|
+
.option('ignoreVersionConflicts', Config.generateOptions.ignoreVersionConflicts)
|
|
27
|
+
.option('configName', Config.generateOptions.configName)
|
|
28
|
+
.example(examples)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
const handler = async (args: any /* TODO */) => {
|
|
33
|
+
const config = await Config.load(args as ConfigFlags)
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < config.environments.length; i++) {
|
|
36
|
+
if (config.environments[i]) {
|
|
37
|
+
const generateConfig = Config.getGenerateConfig(config, config.environments[i])
|
|
38
|
+
const moduleLoader = new ModuleLoader(generateConfig)
|
|
39
|
+
const { keep, grouped } = await moduleLoader.getModulesResolved(
|
|
40
|
+
config.modules,
|
|
41
|
+
config.ignore || [],
|
|
42
|
+
config.ignoreVersionConflicts,
|
|
43
|
+
)
|
|
44
|
+
if (keep.length === 0) {
|
|
45
|
+
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories))
|
|
46
|
+
}
|
|
47
|
+
const tsForGir = new GenerationHandler(generateConfig, GeneratorType.HTML_DOC)
|
|
48
|
+
|
|
49
|
+
await tsForGir.start(
|
|
50
|
+
Array.from(keep).map((girModuleResolvedBy) => girModuleResolvedBy.module),
|
|
51
|
+
Object.values(grouped),
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const examples: ReadonlyArray<[string, string?]> = []
|
|
58
|
+
|
|
59
|
+
export const doc = {
|
|
60
|
+
command,
|
|
61
|
+
description,
|
|
62
|
+
builder,
|
|
63
|
+
handler,
|
|
64
|
+
examples,
|
|
65
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Argv } from 'yargs'
|
|
6
|
+
|
|
7
|
+
import { GenerationHandler } from '../generation-handler.js'
|
|
8
|
+
import { Config } from '../config.js'
|
|
9
|
+
import { ModuleLoader } from '../module-loader.js'
|
|
10
|
+
import { ConfigFlags, GeneratorType } from '../types/index.js'
|
|
11
|
+
import { Logger } from '../logger.js'
|
|
12
|
+
import { ERROR_NO_MODULES_FOUND } from '../messages.js'
|
|
13
|
+
|
|
14
|
+
const command = 'generate [modules..]'
|
|
15
|
+
|
|
16
|
+
const description = 'Generates .d.ts files from GIR for gjs or node-gtk'
|
|
17
|
+
|
|
18
|
+
const builder = (yargs: Argv) => {
|
|
19
|
+
return yargs
|
|
20
|
+
.option('modules', Config.generateOptions.modules)
|
|
21
|
+
.option('girDirectories', Config.generateOptions.girDirectories)
|
|
22
|
+
.option('outdir', Config.generateOptions.outdir)
|
|
23
|
+
.option('environments', Config.generateOptions.environments)
|
|
24
|
+
.option('ignore', Config.generateOptions.ignore)
|
|
25
|
+
.option('buildType', Config.generateOptions.buildType)
|
|
26
|
+
.option('moduleType', Config.generateOptions.moduleType)
|
|
27
|
+
.option('pretty', Config.generateOptions.pretty)
|
|
28
|
+
.option('verbose', Config.generateOptions.verbose)
|
|
29
|
+
.option('ignoreVersionConflicts', Config.generateOptions.ignoreVersionConflicts)
|
|
30
|
+
.option('print', Config.generateOptions.print)
|
|
31
|
+
.option('configName', Config.generateOptions.configName)
|
|
32
|
+
.option('useNamespace', Config.generateOptions.useNamespace)
|
|
33
|
+
.option('noComments', Config.generateOptions.noComments)
|
|
34
|
+
.option('noDebugComments', Config.generateOptions.noDebugComments)
|
|
35
|
+
.option('noCheck', Config.generateOptions.noCheck)
|
|
36
|
+
.option('fixConflicts', Config.generateOptions.fixConflicts)
|
|
37
|
+
.example(examples)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
const handler = async (args: any /* TODO */) => {
|
|
42
|
+
const config = await Config.load(args as ConfigFlags)
|
|
43
|
+
|
|
44
|
+
for (const env of config.environments) {
|
|
45
|
+
const generateConfig = Config.getGenerateConfig(config, env)
|
|
46
|
+
const moduleLoader = new ModuleLoader(generateConfig)
|
|
47
|
+
const { keep, grouped } = await moduleLoader.getModulesResolved(
|
|
48
|
+
config.modules,
|
|
49
|
+
config.ignore || [],
|
|
50
|
+
config.ignoreVersionConflicts,
|
|
51
|
+
)
|
|
52
|
+
if (keep.length === 0) {
|
|
53
|
+
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories))
|
|
54
|
+
}
|
|
55
|
+
const tsForGir = new GenerationHandler(generateConfig, GeneratorType.TYPES)
|
|
56
|
+
|
|
57
|
+
const girModules = Array.from(keep).map((girModuleResolvedBy) => girModuleResolvedBy.module)
|
|
58
|
+
const girModulesGrouped = Object.values(grouped)
|
|
59
|
+
|
|
60
|
+
await tsForGir.start(girModules, girModulesGrouped)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const examples: ReadonlyArray<[string, string?]> = [
|
|
65
|
+
[
|
|
66
|
+
`${Config.appName} generate`,
|
|
67
|
+
`Run '${Config.appName} generate' in your gjs or node-gtk project to generate typings for your project, pass the gir modules you need for your project`,
|
|
68
|
+
],
|
|
69
|
+
[`${Config.appName} generate Gtk*`, 'You can also use wild cards'],
|
|
70
|
+
[`${Config.appName} generate '*'`, 'If you want to parse all of your locally installed gir modules run'],
|
|
71
|
+
[`${Config.appName} generate '*' -e gjs`, 'Generate .d.ts. files only for gjs'],
|
|
72
|
+
[`${Config.appName} generate '*' -e node`, 'Generate .d.ts. files only for node'],
|
|
73
|
+
[`${Config.appName} generate --configName='.ts-for-gir.gtk4.rc.js`, 'Use a special config file'],
|
|
74
|
+
[
|
|
75
|
+
`${Config.appName} generate --ignore=Gtk-3.0 xrandr-1.3`,
|
|
76
|
+
'Generate .d.ts. files but not for Gtk-3.0 and xrandr-1.3',
|
|
77
|
+
],
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
export const generate = {
|
|
81
|
+
command,
|
|
82
|
+
description,
|
|
83
|
+
builder,
|
|
84
|
+
handler,
|
|
85
|
+
examples,
|
|
86
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything you need for the `ts-for-gir list` command is located here
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Argv } from 'yargs'
|
|
6
|
+
|
|
7
|
+
import { ModuleLoader } from '../module-loader.js'
|
|
8
|
+
import { Config } from '../config.js'
|
|
9
|
+
import { ResolveType, ConfigFlags } from '../types/index.js'
|
|
10
|
+
import { Logger } from '../logger.js'
|
|
11
|
+
import { ERROR_NO_MODULES_FOUND } from '../messages.js'
|
|
12
|
+
|
|
13
|
+
const command = 'list [modules..]'
|
|
14
|
+
|
|
15
|
+
const description = 'Lists all available GIR modules'
|
|
16
|
+
|
|
17
|
+
const builder = (yargs: Argv) => {
|
|
18
|
+
return yargs
|
|
19
|
+
.option('modules', Config.listOptions.modules)
|
|
20
|
+
.option('girDirectories', Config.listOptions.girDirectories)
|
|
21
|
+
.option('ignore', Config.listOptions.ignore)
|
|
22
|
+
.option('verbose', Config.listOptions.verbose)
|
|
23
|
+
.option('configName', Config.listOptions.configName)
|
|
24
|
+
.example(examples)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
const handler = async (args: any /* TODO */) => {
|
|
29
|
+
const config = await Config.load(args as ConfigFlags)
|
|
30
|
+
const generateConfig = Config.getGenerateConfig(config)
|
|
31
|
+
const moduleLoader = new ModuleLoader(generateConfig)
|
|
32
|
+
const { grouped, failed } = await moduleLoader.getModules(config.modules, config.ignore)
|
|
33
|
+
const moduleGroups = Object.values(grouped)
|
|
34
|
+
if (Object.keys(grouped).length === 0) {
|
|
35
|
+
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const conflictModules = moduleGroups.filter((moduleGroup) => moduleGroup.hasConflict)
|
|
39
|
+
|
|
40
|
+
const byHandModules = moduleGroups.filter(
|
|
41
|
+
(moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.BY_HAND,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const depModules = moduleGroups.filter(
|
|
45
|
+
(moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.DEPENDENCE,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
Logger.info('\nSelected Modules:')
|
|
49
|
+
for (const moduleGroup of byHandModules) {
|
|
50
|
+
for (const depModule of moduleGroup.modules) {
|
|
51
|
+
Logger.white(`- ${depModule.packageName}`)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (depModules.length > 0) {
|
|
56
|
+
Logger.yellow('\nDependencies:')
|
|
57
|
+
for (const moduleGroup of depModules) {
|
|
58
|
+
for (const depModule of moduleGroup.modules) {
|
|
59
|
+
Logger.white(`- ${depModule.packageName}`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (conflictModules.length > 0) {
|
|
65
|
+
Logger.danger('\nConflicts:')
|
|
66
|
+
for (const moduleGroup of conflictModules) {
|
|
67
|
+
Logger.white(`- ${moduleGroup.namespace}`)
|
|
68
|
+
for (const conflictModule of moduleGroup.modules) {
|
|
69
|
+
Logger.white(` - ${conflictModule.packageName}`)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (failed.length > 0) {
|
|
75
|
+
Logger.danger('\nDependencies not found:')
|
|
76
|
+
for (const fail of failed) {
|
|
77
|
+
Logger.white(`- ${fail}`)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const examples: ReadonlyArray<[string, string?]> = [
|
|
83
|
+
[`${Config.appName} list -g ./vala-girs/gir-1.0`, `Lists all available GIR modules in ./vala-girs/gir-1.0`],
|
|
84
|
+
[
|
|
85
|
+
`${Config.appName} list --ignore=Gtk-3.0 xrandr-1.3`,
|
|
86
|
+
'Lists all available GIR modules in /usr/share/gir-1.0 but not Gtk-3.0 and xrandr-1.3',
|
|
87
|
+
],
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
export const list = {
|
|
91
|
+
command,
|
|
92
|
+
description,
|
|
93
|
+
builder,
|
|
94
|
+
handler,
|
|
95
|
+
examples,
|
|
96
|
+
}
|