@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
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ModuleLoader is used for reading gir modules from the file system and to solve conflicts (e.g. Gtk-3.0 and Gtk-4.0 would be a conflict)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import inquirer from 'inquirer'
|
|
6
|
+
import glob from 'tiny-glob'
|
|
7
|
+
import Path from 'path'
|
|
8
|
+
import fs from 'fs'
|
|
9
|
+
import { bold } from 'colorette'
|
|
10
|
+
import * as xml2js from 'xml2js'
|
|
11
|
+
import type {
|
|
12
|
+
GirModulesGroupedMap,
|
|
13
|
+
ParsedGir,
|
|
14
|
+
GenerateConfig,
|
|
15
|
+
GirModuleResolvedBy,
|
|
16
|
+
GirModulesGrouped,
|
|
17
|
+
DependencyMap,
|
|
18
|
+
Dependency,
|
|
19
|
+
AnswerVersion,
|
|
20
|
+
} from './types/index.js'
|
|
21
|
+
import { ResolveType } from './types/index.js'
|
|
22
|
+
import { GirModule } from './gir-module.js'
|
|
23
|
+
import { Config } from './config.js'
|
|
24
|
+
import { Logger } from './logger.js'
|
|
25
|
+
import { splitModuleName, union, isIterable, map, findFileInDirs } from './utils.js'
|
|
26
|
+
import { WARN_NO_GIR_FILE_FOUND_FOR_PACKAGE } from './messages.js'
|
|
27
|
+
|
|
28
|
+
export class ModuleLoader {
|
|
29
|
+
log: Logger
|
|
30
|
+
/** Transitive module dependencies */
|
|
31
|
+
modDependencyMap: DependencyMap = {}
|
|
32
|
+
constructor(private readonly config: GenerateConfig) {
|
|
33
|
+
this.log = new Logger('', config.verbose, 'ModuleLoader')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Groups Gir modules by name id
|
|
38
|
+
* E.g. Gtk-3.0 and Gtk-4.0 will be grouped
|
|
39
|
+
* @param girFiles
|
|
40
|
+
*/
|
|
41
|
+
private groupGirFiles(resolveGirModules: Set<GirModuleResolvedBy> | GirModuleResolvedBy[]): GirModulesGroupedMap {
|
|
42
|
+
const girModulesGrouped: GirModulesGroupedMap = {}
|
|
43
|
+
|
|
44
|
+
for (const resolveGirModule of resolveGirModules) {
|
|
45
|
+
const { namespace } = splitModuleName(resolveGirModule.packageName)
|
|
46
|
+
const id = namespace.toLowerCase()
|
|
47
|
+
|
|
48
|
+
if (!girModulesGrouped[id]) {
|
|
49
|
+
girModulesGrouped[id] = {
|
|
50
|
+
namespace: namespace,
|
|
51
|
+
modules: [resolveGirModule],
|
|
52
|
+
hasConflict: false,
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
girModulesGrouped[id].modules.push(resolveGirModule)
|
|
56
|
+
girModulesGrouped[id].hasConflict = true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return girModulesGrouped
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sorts out the module the user has not selected via cli prompt
|
|
65
|
+
* @param girModulesGrouped
|
|
66
|
+
* @param keepFullName Users selected module packageName
|
|
67
|
+
*/
|
|
68
|
+
private sortVersionsByAnswer(
|
|
69
|
+
girModulesGrouped: GirModulesGrouped,
|
|
70
|
+
selected: string[],
|
|
71
|
+
): { keep: Set<GirModuleResolvedBy>; ignore: string[] } {
|
|
72
|
+
const keep = new Set<GirModuleResolvedBy>()
|
|
73
|
+
let ignore: string[] = []
|
|
74
|
+
|
|
75
|
+
if (!girModulesGrouped.hasConflict) {
|
|
76
|
+
keep.add(girModulesGrouped.modules[0])
|
|
77
|
+
} else {
|
|
78
|
+
const keepModules = this.findGirModuleByFullNames(
|
|
79
|
+
girModulesGrouped.modules,
|
|
80
|
+
selected,
|
|
81
|
+
) as GirModuleResolvedBy[]
|
|
82
|
+
const girModulePackageNames = girModulesGrouped.modules.map(
|
|
83
|
+
(resolveGirModule) => resolveGirModule.packageName,
|
|
84
|
+
)
|
|
85
|
+
if (!keepModules || keepModules.length <= 0) {
|
|
86
|
+
throw new Error('Module not found!')
|
|
87
|
+
}
|
|
88
|
+
for (const keepModule of keepModules) {
|
|
89
|
+
keep.add(keepModule)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const toIgnore = girModulePackageNames.filter((packageName) => !selected.includes(packageName))
|
|
93
|
+
ignore = ignore.concat(toIgnore)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
keep,
|
|
98
|
+
ignore,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private generateContinueQuestion(
|
|
103
|
+
message = `do you want to continue?`,
|
|
104
|
+
choices = ['Yes', 'Go back'],
|
|
105
|
+
): inquirer.ListQuestion {
|
|
106
|
+
const question: inquirer.ListQuestion = {
|
|
107
|
+
name: 'continue',
|
|
108
|
+
message,
|
|
109
|
+
type: 'list',
|
|
110
|
+
choices,
|
|
111
|
+
}
|
|
112
|
+
return question
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private generateIgnoreDepsQuestion(
|
|
116
|
+
message = `Do you want to ignore them too?`,
|
|
117
|
+
choices = ['Yes', 'No', 'Go back'],
|
|
118
|
+
): inquirer.ListQuestion {
|
|
119
|
+
const question: inquirer.ListQuestion = {
|
|
120
|
+
name: 'continue',
|
|
121
|
+
message,
|
|
122
|
+
type: 'list',
|
|
123
|
+
choices,
|
|
124
|
+
}
|
|
125
|
+
return question
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private async askIgnoreDepsPrompt(
|
|
129
|
+
deps: GirModuleResolvedBy[] | Set<GirModuleResolvedBy>,
|
|
130
|
+
): Promise<'Yes' | 'No' | 'Go back'> {
|
|
131
|
+
let question: inquirer.ListQuestion<inquirer.Answers> | null = null
|
|
132
|
+
const size = (deps as GirModuleResolvedBy[]).length || (deps as Set<GirModuleResolvedBy>).size || 0
|
|
133
|
+
if (size > 0) {
|
|
134
|
+
this.log.log(bold('\nThe following modules have the ignored modules as dependencies:'))
|
|
135
|
+
for (const dep of deps) {
|
|
136
|
+
this.log.log(`- ${dep.packageName}`)
|
|
137
|
+
}
|
|
138
|
+
this.log.log(bold('\n'))
|
|
139
|
+
question = this.generateIgnoreDepsQuestion()
|
|
140
|
+
} else {
|
|
141
|
+
this.log.log(bold('\nNo dependencies found on the ignored modules'))
|
|
142
|
+
question = this.generateContinueQuestion()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
146
|
+
const answer: string = (await inquirer.prompt([question])).continue
|
|
147
|
+
return answer as 'Yes' | 'No' | 'Go back'
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Ask for duplicates / multiple versions of a module
|
|
152
|
+
* @param girModuleGrouped
|
|
153
|
+
* @param message
|
|
154
|
+
*/
|
|
155
|
+
private generateModuleVersionQuestion(
|
|
156
|
+
girModuleGrouped: GirModulesGrouped,
|
|
157
|
+
message?: string,
|
|
158
|
+
): inquirer.ListQuestion {
|
|
159
|
+
message = message || `Multiple versions of '${girModuleGrouped.namespace}' found, which one do you want to use?`
|
|
160
|
+
const choices = ['All', ...girModuleGrouped.modules.map((module) => module.packageName)]
|
|
161
|
+
const question: inquirer.ListQuestion = {
|
|
162
|
+
name: girModuleGrouped.namespace,
|
|
163
|
+
message,
|
|
164
|
+
type: 'list',
|
|
165
|
+
choices,
|
|
166
|
+
}
|
|
167
|
+
return question
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Find modules that depend on the module with the name 'packageName'
|
|
172
|
+
* @param girModulesGroupedMap
|
|
173
|
+
* @param packageName
|
|
174
|
+
*/
|
|
175
|
+
private findModulesDependOnPackage(
|
|
176
|
+
girModulesGroupedMap: GirModulesGroupedMap,
|
|
177
|
+
packageName: string,
|
|
178
|
+
): GirModuleResolvedBy[] {
|
|
179
|
+
const girModules: GirModuleResolvedBy[] = []
|
|
180
|
+
for (const girModulesGrouped of Object.values(girModulesGroupedMap)) {
|
|
181
|
+
for (const girModuleResolvedBy of girModulesGrouped.modules) {
|
|
182
|
+
if (girModuleResolvedBy.packageName === packageName) {
|
|
183
|
+
continue
|
|
184
|
+
}
|
|
185
|
+
for (const dep of girModuleResolvedBy.module.dependencies) {
|
|
186
|
+
if (dep === packageName && !girModules.includes(girModuleResolvedBy)) {
|
|
187
|
+
girModules.push(girModuleResolvedBy)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return girModules
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Find modules that depend on the module with the names in `packageNames`
|
|
197
|
+
* @param girModulesGroupedMap
|
|
198
|
+
* @param packageName
|
|
199
|
+
*/
|
|
200
|
+
private findModulesDependOnPackages(
|
|
201
|
+
girModulesGroupedMap: GirModulesGroupedMap,
|
|
202
|
+
packageNames: string[],
|
|
203
|
+
): GirModuleResolvedBy[] {
|
|
204
|
+
let girModules: GirModuleResolvedBy[] = []
|
|
205
|
+
for (const packageName of packageNames) {
|
|
206
|
+
girModules = girModules.concat(this.findModulesDependOnPackage(girModulesGroupedMap, packageName))
|
|
207
|
+
}
|
|
208
|
+
return girModules
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private async askForVersionsPrompt(girModulesGrouped: GirModulesGrouped): Promise<AnswerVersion> {
|
|
212
|
+
const question = this.generateModuleVersionQuestion(girModulesGrouped)
|
|
213
|
+
const choices = question.choices as string[]
|
|
214
|
+
if (!choices) {
|
|
215
|
+
throw new Error('No valid questions!')
|
|
216
|
+
}
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
218
|
+
const selected: string = (await inquirer.prompt([question]))[girModulesGrouped.namespace]
|
|
219
|
+
if (!selected) {
|
|
220
|
+
throw new Error('No valid answer!')
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (selected === 'All') {
|
|
224
|
+
return {
|
|
225
|
+
selected: choices.filter((choice) => choice !== 'All'),
|
|
226
|
+
unselected: [],
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const unselected = choices.filter((choice) => choice !== selected)
|
|
231
|
+
return {
|
|
232
|
+
selected: [selected],
|
|
233
|
+
unselected,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* If multiple versions of the same module are found, this will aks the user with input prompts for the version he wish to use.
|
|
239
|
+
* Ignores also modules that depend on a module that should be ignored
|
|
240
|
+
* @param resolveFirModules
|
|
241
|
+
*/
|
|
242
|
+
private async askForEachConflictVersionsPrompt(
|
|
243
|
+
girModulesGroupedMap: GirModulesGroupedMap,
|
|
244
|
+
ignore: string[],
|
|
245
|
+
): Promise<{ keep: Set<GirModuleResolvedBy>; ignore: string[] }> {
|
|
246
|
+
let keep = new Set<GirModuleResolvedBy>()
|
|
247
|
+
for (const girModulesGrouped of Object.values(girModulesGroupedMap)) {
|
|
248
|
+
// Remove ignored modules from group
|
|
249
|
+
girModulesGrouped.modules = girModulesGrouped.modules.filter(
|
|
250
|
+
(girGroup) => !ignore.includes(girGroup.packageName),
|
|
251
|
+
)
|
|
252
|
+
girModulesGrouped.hasConflict = girModulesGrouped.modules.length >= 2
|
|
253
|
+
|
|
254
|
+
if (girModulesGrouped.modules.length <= 0) {
|
|
255
|
+
continue
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Ask for version if there is a conflict
|
|
259
|
+
if (!girModulesGrouped.hasConflict) {
|
|
260
|
+
keep = union<GirModuleResolvedBy>(keep, girModulesGrouped.modules)
|
|
261
|
+
} else {
|
|
262
|
+
let goBack = true
|
|
263
|
+
let versionAnswer: AnswerVersion | null = null
|
|
264
|
+
let ignoreDepsAnswer: 'Yes' | 'No' | 'Go back' | null = null
|
|
265
|
+
let wouldIgnoreDeps: GirModuleResolvedBy[] = []
|
|
266
|
+
while (goBack) {
|
|
267
|
+
versionAnswer = await this.askForVersionsPrompt(girModulesGrouped)
|
|
268
|
+
// Check modules that depend on the unchosen modules
|
|
269
|
+
wouldIgnoreDeps = this.findModulesDependOnPackages(girModulesGroupedMap, versionAnswer.unselected)
|
|
270
|
+
// Do not check dependencies that have already been ignored
|
|
271
|
+
wouldIgnoreDeps = wouldIgnoreDeps.filter((dep) => !ignore.includes(dep.packageName))
|
|
272
|
+
ignoreDepsAnswer = await this.askIgnoreDepsPrompt(wouldIgnoreDeps)
|
|
273
|
+
goBack = ignoreDepsAnswer === 'Go back'
|
|
274
|
+
}
|
|
275
|
+
if (!versionAnswer) {
|
|
276
|
+
throw new Error('Error in processing the prompt versionAnswer')
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (ignoreDepsAnswer === 'Yes') {
|
|
280
|
+
// Also ignore the dependencies of the unselected version
|
|
281
|
+
ignore = ignore.concat(wouldIgnoreDeps.map((dep) => dep.packageName))
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const unionMe = this.sortVersionsByAnswer(girModulesGrouped, versionAnswer.selected)
|
|
285
|
+
// Do not ignore the selected package version
|
|
286
|
+
keep = union<GirModuleResolvedBy>(keep, unionMe.keep)
|
|
287
|
+
// Ignore the unchosen package versions
|
|
288
|
+
ignore = ignore.concat(unionMe.ignore)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (ignore && ignore.length > 0) {
|
|
292
|
+
const ignoreLogList = '- ' + ignore.join('\n- ')
|
|
293
|
+
|
|
294
|
+
this.log.log(bold(`\n The following modules will be ignored:`))
|
|
295
|
+
this.log.log(`\n${ignoreLogList}\n`)
|
|
296
|
+
await this.askAddToIgnoreToConfigPrompt(ignore)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
keep,
|
|
301
|
+
ignore,
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Asks via cli prompt if the user wants to add the ignored modules to his config file
|
|
307
|
+
* @param ignore
|
|
308
|
+
*/
|
|
309
|
+
private async askAddToIgnoreToConfigPrompt(ignore: string[] | Set<string>): Promise<void> {
|
|
310
|
+
const questions = [
|
|
311
|
+
{
|
|
312
|
+
name: 'addToIgnore',
|
|
313
|
+
message: `Do you want to add the ignored modules to your config so that you don't need to select them again next time?\n Config path: '${Config.configFilePath}`,
|
|
314
|
+
type: 'list',
|
|
315
|
+
choices: ['No', 'Yes'],
|
|
316
|
+
},
|
|
317
|
+
]
|
|
318
|
+
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
320
|
+
const answer: { [name: string]: string } = await inquirer.prompt(questions)
|
|
321
|
+
|
|
322
|
+
if (answer.addToIgnore === 'Yes') {
|
|
323
|
+
await Config.addToConfig({
|
|
324
|
+
ignore: Array.from(ignore),
|
|
325
|
+
})
|
|
326
|
+
this.log.log(`Add ignored modules to '${Config.configFilePath}'`)
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Figure out transitive module dependencies
|
|
332
|
+
* @param packageName
|
|
333
|
+
* @param result
|
|
334
|
+
*/
|
|
335
|
+
private traverseDependencies(packageName: string, result: { [name: string]: 1 } = {}): void {
|
|
336
|
+
const deps = this.modDependencyMap[packageName]
|
|
337
|
+
if (isIterable(deps)) {
|
|
338
|
+
for (const dep of deps) {
|
|
339
|
+
if (result[dep.packageName]) continue
|
|
340
|
+
result[dep.packageName] = 1
|
|
341
|
+
this.traverseDependencies(dep.packageName, result)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Extends the modDependencyMap by the current Module,
|
|
348
|
+
* should be called for each girModule so that the modDependencyMap is complete
|
|
349
|
+
* @param girModule
|
|
350
|
+
*/
|
|
351
|
+
private extendDependencyMapByGirModule(girModule: GirModule): void {
|
|
352
|
+
this.modDependencyMap[girModule.packageName || '-'] = map(
|
|
353
|
+
girModule.dependencies || [],
|
|
354
|
+
(packageName: string): Dependency => {
|
|
355
|
+
const { namespace, version } = splitModuleName(packageName)
|
|
356
|
+
return {
|
|
357
|
+
namespace,
|
|
358
|
+
version,
|
|
359
|
+
packageName,
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Sets the traverse dependencies for the current girModule,
|
|
367
|
+
* is required so that all dependencies can be found internally when generating the dependency imports for the module .d.ts file
|
|
368
|
+
* @param girModules
|
|
369
|
+
*/
|
|
370
|
+
private setTraverseDependenciesForModules(girModules: GirModuleResolvedBy[]): void {
|
|
371
|
+
for (const girModule of girModules) {
|
|
372
|
+
const result: { [name: string]: 1 } = {}
|
|
373
|
+
this.traverseDependencies(girModule.packageName, result)
|
|
374
|
+
girModule.module.transitiveDependencies = Object.keys(result)
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Reads a gir xml module file and creates an object of GirModule.
|
|
380
|
+
* Also sets the setDependencyMap
|
|
381
|
+
* @param fillName
|
|
382
|
+
* @param config
|
|
383
|
+
*/
|
|
384
|
+
private async loadAndCreateGirModule(packageName: string): Promise<GirModule | null> {
|
|
385
|
+
const file = findFileInDirs(this.config.girDirectories, packageName + '.gir')
|
|
386
|
+
if (!file.exists || file.path === null) {
|
|
387
|
+
return null
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
this.log.log(`Parsing ${file.path}...`)
|
|
391
|
+
const fileContents = fs.readFileSync(file.path, 'utf8')
|
|
392
|
+
const result = (await xml2js.parseStringPromise(fileContents)) as ParsedGir
|
|
393
|
+
const girModule = new GirModule(result, this.config)
|
|
394
|
+
// Figure out transitive module dependencies
|
|
395
|
+
this.extendDependencyMapByGirModule(girModule)
|
|
396
|
+
return girModule
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Returns a girModule found by `packageName` property
|
|
401
|
+
* @param girModules Array of girModules
|
|
402
|
+
* @param packageNames Full name like 'Gtk-3.0' you are looking for
|
|
403
|
+
*/
|
|
404
|
+
private findGirModuleByFullNames(
|
|
405
|
+
girModules: (GirModuleResolvedBy | GirModule)[],
|
|
406
|
+
packageNames: string[],
|
|
407
|
+
): Array<GirModuleResolvedBy | GirModule> {
|
|
408
|
+
return girModules.filter((girModule) => packageNames.includes(girModule.packageName))
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Checks if a girModules with the `packageNames` exists
|
|
413
|
+
* @param girModules
|
|
414
|
+
* @param packageName
|
|
415
|
+
*/
|
|
416
|
+
private existsGirModules(girModules: (GirModuleResolvedBy | GirModule)[], packageNames: string[]): boolean {
|
|
417
|
+
const foundModule = this.findGirModuleByFullNames(girModules, packageNames)
|
|
418
|
+
return foundModule.length > 0
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Reads the gir xml module files and creates an object of GirModule for each module
|
|
423
|
+
* @param girModulesToRead
|
|
424
|
+
* @param girModules
|
|
425
|
+
* @param resolvedBy
|
|
426
|
+
* @param failedGirModules
|
|
427
|
+
* @param ignoreDependencies
|
|
428
|
+
* @returns
|
|
429
|
+
*/
|
|
430
|
+
private async loadGirModules(
|
|
431
|
+
girModulesToRead: string[] | Set<string>,
|
|
432
|
+
ignoreDependencies: string[] = [],
|
|
433
|
+
girModules: GirModuleResolvedBy[] = [],
|
|
434
|
+
resolvedBy = ResolveType.BY_HAND,
|
|
435
|
+
failedGirModules = new Set<string>(),
|
|
436
|
+
): Promise<{ loaded: GirModuleResolvedBy[]; failed: Set<string> }> {
|
|
437
|
+
// A copy is needed here because we are changing the array for the while loop
|
|
438
|
+
const girToLoad = Array.from(girModulesToRead)
|
|
439
|
+
let newModuleFound = false
|
|
440
|
+
|
|
441
|
+
while (girToLoad.length > 0) {
|
|
442
|
+
const packageName = girToLoad.shift() || 'unknown'
|
|
443
|
+
if (!packageName) throw new Error(`Module name '${packageName} 'not found!`)
|
|
444
|
+
// If module has not already been loaded
|
|
445
|
+
if (!this.existsGirModules(girModules, [packageName])) {
|
|
446
|
+
const girModule = await this.loadAndCreateGirModule(packageName)
|
|
447
|
+
if (!girModule) {
|
|
448
|
+
if (!failedGirModules.has(packageName)) {
|
|
449
|
+
this.log.warn(WARN_NO_GIR_FILE_FOUND_FOR_PACKAGE(packageName))
|
|
450
|
+
failedGirModules.add(packageName)
|
|
451
|
+
}
|
|
452
|
+
} else if (girModule && girModule.packageName) {
|
|
453
|
+
const addModule = {
|
|
454
|
+
packageName: girModule.packageName,
|
|
455
|
+
module: girModule,
|
|
456
|
+
resolvedBy,
|
|
457
|
+
}
|
|
458
|
+
girModules.push(addModule)
|
|
459
|
+
newModuleFound = true
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (!newModuleFound) {
|
|
465
|
+
return {
|
|
466
|
+
loaded: girModules,
|
|
467
|
+
failed: failedGirModules,
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Figure out transitive module dependencies
|
|
472
|
+
this.setTraverseDependenciesForModules(girModules)
|
|
473
|
+
|
|
474
|
+
// Load girModules for dependencies
|
|
475
|
+
for (const girModule of girModules) {
|
|
476
|
+
// Load dependencies
|
|
477
|
+
const transitiveDependencies = girModule.module.transitiveDependencies
|
|
478
|
+
if (transitiveDependencies.length > 0) {
|
|
479
|
+
for (const transitiveDependency of transitiveDependencies) {
|
|
480
|
+
if (ignoreDependencies.includes(transitiveDependency)) {
|
|
481
|
+
this.log.warn(
|
|
482
|
+
`Load dependency "${transitiveDependency}" which is in the ignore list, if this should really be ignored also ignore "${girModule.packageName}"`,
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
await this.loadGirModules(
|
|
488
|
+
transitiveDependencies,
|
|
489
|
+
ignoreDependencies,
|
|
490
|
+
girModules,
|
|
491
|
+
ResolveType.DEPENDENCE,
|
|
492
|
+
failedGirModules,
|
|
493
|
+
)
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
loaded: girModules,
|
|
498
|
+
failed: failedGirModules,
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Find modules with the possibility to use wild cards for module names. E.g. `Gtk*` or `'*'`
|
|
504
|
+
* @param girDirectories
|
|
505
|
+
* @param modules
|
|
506
|
+
*/
|
|
507
|
+
private async findModules(modules: string[], ignore: string[] = []): Promise<Set<string>> {
|
|
508
|
+
const foundModules = new Set<string>()
|
|
509
|
+
|
|
510
|
+
for (let i = 0; i < modules.length; i++) {
|
|
511
|
+
if (modules[i]) {
|
|
512
|
+
const filename = `${modules[i]}.gir`
|
|
513
|
+
let files: string[] = []
|
|
514
|
+
for (const girDirectory of this.config.girDirectories) {
|
|
515
|
+
files = files.concat(await glob(filename, { cwd: girDirectory }))
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
let globModules = files.map((file) => Path.basename(file, '.gir'))
|
|
519
|
+
// Filter out the ignored modules
|
|
520
|
+
globModules = globModules.filter((mod) => {
|
|
521
|
+
const isIgnored = ignore.includes(mod)
|
|
522
|
+
if (isIgnored) {
|
|
523
|
+
this.log.warn(`Ignore ${mod}`)
|
|
524
|
+
}
|
|
525
|
+
return !isIgnored
|
|
526
|
+
})
|
|
527
|
+
globModules.forEach((mod) => foundModules.add(mod))
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return foundModules
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Loads all found modules and sorts out those that the user does not want to use including their dependencies
|
|
535
|
+
* @param girDirectories
|
|
536
|
+
* @param modules
|
|
537
|
+
*/
|
|
538
|
+
public async getModulesResolved(
|
|
539
|
+
modules: string[],
|
|
540
|
+
ignore: string[] = [],
|
|
541
|
+
doNotAskForVersionOnConflict = true,
|
|
542
|
+
): Promise<{ keep: GirModuleResolvedBy[]; grouped: GirModulesGroupedMap; ignore: string[]; failed: Set<string> }> {
|
|
543
|
+
const foundGirModules = await this.findModules(modules, ignore)
|
|
544
|
+
const { loaded, failed } = await this.loadGirModules(foundGirModules, ignore)
|
|
545
|
+
let keep: GirModuleResolvedBy[] = []
|
|
546
|
+
if (doNotAskForVersionOnConflict) {
|
|
547
|
+
keep = loaded
|
|
548
|
+
} else {
|
|
549
|
+
const girModulesGrouped = this.groupGirFiles(loaded)
|
|
550
|
+
const filtered = await this.askForEachConflictVersionsPrompt(girModulesGrouped, ignore)
|
|
551
|
+
keep = Array.from(filtered.keep)
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
const grouped = this.groupGirFiles(keep)
|
|
555
|
+
|
|
556
|
+
return { keep, grouped, ignore, failed }
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Find modules with the possibility to use wild cards for module names. E.g. `Gtk*` or `'*'`
|
|
561
|
+
* @param girDirectories
|
|
562
|
+
* @param modules
|
|
563
|
+
*/
|
|
564
|
+
public async getModules(
|
|
565
|
+
modules: string[],
|
|
566
|
+
ignore: string[] = [],
|
|
567
|
+
): Promise<{ grouped: GirModulesGroupedMap; loaded: GirModuleResolvedBy[]; failed: string[] }> {
|
|
568
|
+
const foundGirModules = await this.findModules(modules, ignore)
|
|
569
|
+
const { loaded, failed } = await this.loadGirModules(foundGirModules, ignore)
|
|
570
|
+
const grouped = this.groupGirFiles(loaded)
|
|
571
|
+
return { grouped, loaded, failed: Array.from(failed) }
|
|
572
|
+
}
|
|
573
|
+
}
|
package/src/start.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import yargs from 'yargs'
|
|
3
|
+
import { hideBin } from 'yargs/helpers'
|
|
4
|
+
|
|
5
|
+
import { generate, list, doc } from './commands/index.js'
|
|
6
|
+
import { Config } from './config.js'
|
|
7
|
+
|
|
8
|
+
void yargs(hideBin(process.argv))
|
|
9
|
+
.scriptName(Config.appName)
|
|
10
|
+
.strict()
|
|
11
|
+
.usage(Config.usage)
|
|
12
|
+
.command(generate.command, generate.description, generate.builder, generate.handler)
|
|
13
|
+
.command(list.command, list.description, list.builder, list.handler)
|
|
14
|
+
.command(doc.command, doc.description, doc.builder, doc.handler)
|
|
15
|
+
.demandCommand(1)
|
|
16
|
+
.help().argv
|
package/src/symtable.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { SymTableItems, GenerateConfig, GirAnyElement } from './types/index.js'
|
|
2
|
+
import { Logger } from './logger.js'
|
|
3
|
+
import { WARN_NOT_FOUND_PACKAGE_NAME } from './messages.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The SymTable is used to get any Type from any dependency to compare or to get information from
|
|
7
|
+
*/
|
|
8
|
+
export class SymTable {
|
|
9
|
+
/**
|
|
10
|
+
* The items are static because any GirModule has the same items to be able to access the types of dependencies as well
|
|
11
|
+
*/
|
|
12
|
+
private static items: SymTableItems = {}
|
|
13
|
+
private log: Logger
|
|
14
|
+
|
|
15
|
+
public constructor(
|
|
16
|
+
private readonly config: GenerateConfig,
|
|
17
|
+
private readonly modPackageName: string,
|
|
18
|
+
private readonly modNamespace: string,
|
|
19
|
+
) {
|
|
20
|
+
this.log = new Logger(this.config.environment, this.config.verbose, 'SymTable')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get symTable key, we use this method to prepend the package version to each key to prevent version conflicts e.g. in 'Gtk-3.0' and 'Gtk-4.0'
|
|
25
|
+
* @param implementation E.g. Gtk.Window
|
|
26
|
+
* @returns E.g. 'Gtk-3.0.Gtk.Window'
|
|
27
|
+
*/
|
|
28
|
+
public getKey(dependencies: string[], implementation: string): string | null {
|
|
29
|
+
if (implementation.startsWith(this.modPackageName + '.')) {
|
|
30
|
+
return implementation
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (implementation.startsWith(this.modNamespace + '.')) {
|
|
34
|
+
return this.modPackageName + '.' + implementation
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!implementation.includes('.')) {
|
|
38
|
+
return this.modPackageName + '.' + this.modNamespace + '.' + implementation
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const split = implementation.split('.')
|
|
42
|
+
const namespace = split[0]
|
|
43
|
+
const packageName = dependencies.find((dependency) => dependency.startsWith(namespace + '-'))
|
|
44
|
+
if (!packageName) {
|
|
45
|
+
this.log.warn(WARN_NOT_FOUND_PACKAGE_NAME(namespace, implementation))
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
return packageName + '.' + implementation
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public get<T>(dependencies: string[], fullTypeName: string): T | null {
|
|
52
|
+
const key = this.getKey(dependencies, fullTypeName)
|
|
53
|
+
if (!key || !SymTable.items[key]) {
|
|
54
|
+
return null
|
|
55
|
+
}
|
|
56
|
+
const result = SymTable.items[key] || null
|
|
57
|
+
return result as unknown as T | null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public getByHand<T = GirAnyElement>(key: string): T | null {
|
|
61
|
+
return (SymTable.items[key] || null) as unknown as T | null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public set(dependencies: string[], fullTypeName: string, GirElement: GirAnyElement): void {
|
|
65
|
+
const key = this.getKey(dependencies, fullTypeName)
|
|
66
|
+
if (key) {
|
|
67
|
+
SymTable.items[key] = GirElement
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|