@ts-for-gir/lib 4.0.0-beta.25 → 4.0.0-beta.26
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/package.json +12 -26
- package/src/constants.ts +154 -0
- package/src/dependency-manager.ts +427 -0
- package/src/formatters/default.ts +7 -0
- package/src/formatters/formatter.ts +3 -0
- package/src/formatters/index.ts +3 -0
- package/src/formatters/json.ts +7 -0
- package/src/generators/generator.ts +65 -0
- package/src/generators/index.ts +2 -0
- package/src/generics/clutter.ts +71 -0
- package/src/generics/generify.ts +74 -0
- package/src/generics/gio.ts +91 -0
- package/src/generics/glib.ts +31 -0
- package/src/generics/gtk.ts +99 -0
- package/src/generics/meta.ts +41 -0
- package/src/generics/st.ts +197 -0
- package/src/generics/visitor.ts +484 -0
- package/src/gir/alias.ts +73 -0
- package/src/gir/callback.ts +79 -0
- package/src/gir/const.ts +73 -0
- package/src/gir/constructor.ts +91 -0
- package/src/gir/data.ts +12 -0
- package/src/gir/dependency-resolver.ts +81 -0
- package/src/gir/direct-allocation-constructor.ts +65 -0
- package/src/gir/enum-member.ts +51 -0
- package/src/gir/enum.ts +126 -0
- package/src/gir/error.ts +82 -0
- package/src/gir/function.ts +296 -0
- package/src/gir/generics.ts +66 -0
- package/src/gir/gir-complex-record.ts +7 -0
- package/src/gir/index.ts +25 -0
- package/src/gir/introspected-base.ts +104 -0
- package/src/gir/introspected-class-member.ts +15 -0
- package/src/gir/introspected-classes.ts +1517 -0
- package/src/gir/introspected-namespace-member.ts +24 -0
- package/src/gir/namespace.ts +76 -0
- package/src/gir/parameter.ts +199 -0
- package/src/gir/promisify.ts +209 -0
- package/src/gir/property.ts +203 -0
- package/src/gir/record.ts +477 -0
- package/src/gir/registry.ts +184 -0
- package/src/gir/signal.ts +246 -0
- package/src/gir-module.ts +703 -0
- package/src/gir.ts +892 -0
- package/src/index.ts +16 -0
- package/src/injections/gee08.ts +89 -0
- package/src/injections/gee1.ts +35 -0
- package/src/injections/gio.ts +707 -0
- package/src/injections/glib.ts +275 -0
- package/src/injections/gobject.ts +901 -0
- package/src/injections/gtk4.ts +23 -0
- package/src/injections/inject.ts +43 -0
- package/src/injections/shell.ts +45 -0
- package/src/injections/tracker1.ts +42 -0
- package/src/library-version.ts +50 -0
- package/src/logger.ts +104 -0
- package/src/messages.ts +57 -0
- package/src/templates/index.ts +1 -0
- package/src/templates/template-engine.ts +178 -0
- package/src/types/answer-version.ts +4 -0
- package/src/types/any-introspected-type.ts +3 -0
- package/src/types/class-function-types.ts +49 -0
- package/src/types/class-member.ts +5 -0
- package/src/types/class-parent.ts +14 -0
- package/src/types/class.ts +45 -0
- package/src/types/config-flags.ts +5 -0
- package/src/types/construct-name.ts +13 -0
- package/src/types/dependency-map.ts +4 -0
- package/{lib/types/dependency.d.ts → src/types/dependency.ts} +17 -15
- package/{lib/types/file-info.d.ts → src/types/file-info.ts} +3 -3
- package/src/types/format.ts +1 -0
- package/src/types/generator-constructor.ts +7 -0
- package/src/types/generics-config.ts +90 -0
- package/src/types/gir-any-element.ts +35 -0
- package/src/types/gir-module-interface.ts +22 -0
- package/src/types/gir-module-resolved.ts +32 -0
- package/src/types/gir-type-name.ts +20 -0
- package/src/types/index.ts +94 -0
- package/{lib/types/inheritance-table.d.ts → src/types/inheritance-table.ts} +1 -1
- package/src/types/introspected.ts +18 -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/metadata.ts +6 -0
- package/src/types/ns-loader.ts +7 -0
- package/src/types/options-base.ts +8 -0
- package/{lib/types/options-generation.d.ts → src/types/options-generation.ts} +22 -13
- package/src/types/options-load.ts +6 -0
- package/src/types/options-transform.ts +5 -0
- package/src/types/output-format.ts +1 -0
- package/{lib/types/package-data-parsed.d.ts → src/types/package-data-parsed.ts} +13 -13
- package/{lib/types/package-data.d.ts → src/types/package-data.ts} +12 -11
- package/src/types/package-section-parsed.ts +9 -0
- package/src/types/parsed-gir.ts +5 -0
- package/src/types/parsed-package-data.ts +7 -0
- package/src/types/property-case.ts +1 -0
- package/src/types/resolve-type.ts +4 -0
- package/src/types/template-data.ts +8 -0
- package/src/types/template-options.ts +33 -0
- package/src/types/transformation-case.ts +9 -0
- package/src/types/transformations.ts +5 -0
- package/{lib/types/ts-doc-tag.d.ts → src/types/ts-doc-tag.ts} +5 -3
- package/{lib/types/ts-doc.d.ts → src/types/ts-doc.ts} +5 -3
- package/{lib/types/type-gir-alias.d.ts → src/types/type-gir-alias.ts} +1 -1
- package/{lib/types/type-gir-class.d.ts → src/types/type-gir-class.ts} +1 -1
- package/src/types/type-gir-element.ts +25 -0
- package/{lib/types/type-gir-enumeration-member.d.ts → src/types/type-gir-enumeration-member.ts} +1 -1
- package/{lib/types/type-ts-enumeration-member.d.ts → src/types/type-gir-enumeration.ts} +1 -1
- package/src/types/type-gir-function.ts +8 -0
- package/{lib/types/type-gir-interface.d.ts → src/types/type-gir-interface.ts} +1 -1
- package/{lib/types/type-gir-method.d.ts → src/types/type-gir-method.ts} +1 -1
- package/src/types/type-gir-parameter.ts +1 -0
- package/{lib/types/type-gir-property.d.ts → src/types/type-gir-property.ts} +1 -1
- package/src/types/type-gir-variable.ts +1 -0
- package/src/types/type-ts-element.ts +13 -0
- package/{lib/types/type-gir-enumeration.d.ts → src/types/type-ts-enumeration-member.ts} +1 -1
- package/{lib/types/type-ts-function.d.ts → src/types/type-ts-function.ts} +1 -1
- package/{lib/types/type-ts-property.d.ts → src/types/type-ts-property.ts} +1 -1
- package/src/types/user-config-load-result.ts +6 -0
- package/{lib/types/user-config.d.ts → src/types/user-config.ts} +25 -17
- package/src/util.ts +84 -0
- package/src/utils/conflicts/conflict-resolver.ts +122 -0
- package/src/utils/conflicts/function-conflict-detector.ts +139 -0
- package/src/utils/conflicts/index.ts +2 -0
- package/src/utils/conflicts.ts +490 -0
- package/{lib/utils/documentation.js → src/utils/documentation.ts} +25 -22
- package/src/utils/files.ts +71 -0
- package/src/utils/function-type-guards.ts +61 -0
- package/src/utils/generation.ts +69 -0
- package/src/utils/gir-parsing.ts +243 -0
- package/src/utils/girs.ts +113 -0
- package/src/utils/index.ts +14 -0
- package/src/utils/naming.ts +188 -0
- package/{lib/utils/numbers.d.ts → src/utils/numbers.ts} +3 -1
- package/{lib/utils/objects.js → src/utils/objects.ts} +15 -7
- package/src/utils/path.ts +7 -0
- package/src/utils/registry.ts +5 -0
- package/src/utils/strings.ts +134 -0
- package/src/utils/type-resolution.ts +116 -0
- package/src/utils/types.ts +247 -0
- package/src/validators/class.ts +324 -0
- package/src/validators/function-parameters.ts +52 -0
- package/src/validators/interface.ts +20 -0
- package/src/visitor.ts +58 -0
- package/lib/constants.d.ts +0 -25
- package/lib/constants.js +0 -93
- package/lib/constants.js.map +0 -1
- package/lib/dependency-manager.d.ts +0 -151
- package/lib/dependency-manager.js +0 -340
- package/lib/dependency-manager.js.map +0 -1
- package/lib/formatters/default.d.ts +0 -4
- package/lib/formatters/default.js +0 -7
- package/lib/formatters/default.js.map +0 -1
- package/lib/formatters/formatter.d.ts +0 -3
- package/lib/formatters/formatter.js +0 -3
- package/lib/formatters/formatter.js.map +0 -1
- package/lib/formatters/json.d.ts +0 -4
- package/lib/formatters/json.js +0 -7
- package/lib/formatters/json.js.map +0 -1
- package/lib/generators/dts/glib.d.ts +0 -2
- package/lib/generators/dts/glib.js +0 -514
- package/lib/generators/dts/glib.js.map +0 -1
- package/lib/generators/dts/gobject.d.ts +0 -2
- package/lib/generators/dts/gobject.js +0 -117
- package/lib/generators/dts/gobject.js.map +0 -1
- package/lib/generators/dts-inline.d.ts +0 -10
- package/lib/generators/dts-inline.js +0 -57
- package/lib/generators/dts-inline.js.map +0 -1
- package/lib/generators/dts-modules.d.ts +0 -10
- package/lib/generators/dts-modules.js +0 -98
- package/lib/generators/dts-modules.js.map +0 -1
- package/lib/generators/dts.d.ts +0 -45
- package/lib/generators/dts.js +0 -683
- package/lib/generators/dts.js.map +0 -1
- package/lib/generators/generator.d.ts +0 -45
- package/lib/generators/generator.js +0 -9
- package/lib/generators/generator.js.map +0 -1
- package/lib/generators/index.d.ts +0 -5
- package/lib/generators/index.js +0 -6
- package/lib/generators/index.js.map +0 -1
- package/lib/generators/json.d.ts +0 -257
- package/lib/generators/json.js +0 -866
- package/lib/generators/json.js.map +0 -1
- package/lib/generics/clutter.d.ts +0 -41
- package/lib/generics/clutter.js +0 -52
- package/lib/generics/clutter.js.map +0 -1
- package/lib/generics/generify.d.ts +0 -2
- package/lib/generics/generify.js +0 -47
- package/lib/generics/generify.js.map +0 -1
- package/lib/generics/gio.d.ts +0 -7
- package/lib/generics/gio.js +0 -51
- package/lib/generics/gio.js.map +0 -1
- package/lib/generics/glib.d.ts +0 -7
- package/lib/generics/glib.js +0 -18
- package/lib/generics/glib.js.map +0 -1
- package/lib/generics/gtk.d.ts +0 -7
- package/lib/generics/gtk.js +0 -56
- package/lib/generics/gtk.js.map +0 -1
- package/lib/generics/meta.d.ts +0 -36
- package/lib/generics/meta.js +0 -29
- package/lib/generics/meta.js.map +0 -1
- package/lib/generics/st.d.ts +0 -31
- package/lib/generics/st.js +0 -98
- package/lib/generics/st.js.map +0 -1
- package/lib/generics/visitor.d.ts +0 -20
- package/lib/generics/visitor.js +0 -255
- package/lib/generics/visitor.js.map +0 -1
- package/lib/gir/alias.d.ts +0 -24
- package/lib/gir/alias.js +0 -43
- package/lib/gir/alias.js.map +0 -1
- package/lib/gir/base.d.ts +0 -62
- package/lib/gir/base.js +0 -83
- package/lib/gir/base.js.map +0 -1
- package/lib/gir/class.d.ts +0 -228
- package/lib/gir/class.js +0 -1151
- package/lib/gir/class.js.map +0 -1
- package/lib/gir/const.d.ts +0 -25
- package/lib/gir/const.js +0 -43
- package/lib/gir/const.js.map +0 -1
- package/lib/gir/enum.d.ts +0 -45
- package/lib/gir/enum.js +0 -164
- package/lib/gir/enum.js.map +0 -1
- package/lib/gir/function.d.ts +0 -200
- package/lib/gir/function.js +0 -683
- package/lib/gir/function.js.map +0 -1
- package/lib/gir/generics.d.ts +0 -5
- package/lib/gir/generics.js +0 -57
- package/lib/gir/generics.js.map +0 -1
- package/lib/gir/index.d.ts +0 -14
- package/lib/gir/index.js +0 -15
- package/lib/gir/index.js.map +0 -1
- package/lib/gir/namespace.d.ts +0 -21
- package/lib/gir/namespace.js +0 -57
- package/lib/gir/namespace.js.map +0 -1
- package/lib/gir/nodes.d.ts +0 -11
- package/lib/gir/nodes.js +0 -12
- package/lib/gir/nodes.js.map +0 -1
- package/lib/gir/promisify.d.ts +0 -5
- package/lib/gir/promisify.js +0 -158
- package/lib/gir/promisify.js.map +0 -1
- package/lib/gir/property.d.ts +0 -60
- package/lib/gir/property.js +0 -128
- package/lib/gir/property.js.map +0 -1
- package/lib/gir/registry.d.ts +0 -51
- package/lib/gir/registry.js +0 -147
- package/lib/gir/registry.js.map +0 -1
- package/lib/gir/signal.d.ts +0 -36
- package/lib/gir/signal.js +0 -169
- package/lib/gir/signal.js.map +0 -1
- package/lib/gir/util.d.ts +0 -49
- package/lib/gir/util.js +0 -561
- package/lib/gir/util.js.map +0 -1
- package/lib/gir-module.d.ts +0 -104
- package/lib/gir-module.js +0 -584
- package/lib/gir-module.js.map +0 -1
- package/lib/gir.d.ts +0 -254
- package/lib/gir.js +0 -639
- package/lib/gir.js.map +0 -1
- package/lib/index.d.ts +0 -13
- package/lib/index.js +0 -16
- package/lib/index.js.map +0 -1
- package/lib/injections/gee08.d.ts +0 -7
- package/lib/injections/gee08.js +0 -68
- package/lib/injections/gee08.js.map +0 -1
- package/lib/injections/gee1.d.ts +0 -7
- package/lib/injections/gee1.js +0 -28
- package/lib/injections/gee1.js.map +0 -1
- package/lib/injections/gio.d.ts +0 -7
- package/lib/injections/gio.js +0 -563
- package/lib/injections/gio.js.map +0 -1
- package/lib/injections/glib.d.ts +0 -7
- package/lib/injections/glib.js +0 -210
- package/lib/injections/glib.js.map +0 -1
- package/lib/injections/gobject.d.ts +0 -7
- package/lib/injections/gobject.js +0 -594
- package/lib/injections/gobject.js.map +0 -1
- package/lib/injections/gtk4.d.ts +0 -7
- package/lib/injections/gtk4.js +0 -19
- package/lib/injections/gtk4.js.map +0 -1
- package/lib/injections/inject.d.ts +0 -4
- package/lib/injections/inject.js +0 -33
- package/lib/injections/inject.js.map +0 -1
- package/lib/injections/shell.d.ts +0 -20
- package/lib/injections/shell.js +0 -34
- package/lib/injections/shell.js.map +0 -1
- package/lib/injections/tracker1.d.ts +0 -7
- package/lib/injections/tracker1.js +0 -30
- package/lib/injections/tracker1.js.map +0 -1
- package/lib/library-version.d.ts +0 -10
- package/lib/library-version.js +0 -45
- package/lib/library-version.js.map +0 -1
- package/lib/logger.d.ts +0 -36
- package/lib/logger.js +0 -134
- package/lib/logger.js.map +0 -1
- package/lib/messages.d.ts +0 -23
- package/lib/messages.js +0 -39
- package/lib/messages.js.map +0 -1
- package/lib/registry.d.ts +0 -8
- package/lib/registry.js +0 -12
- package/lib/registry.js.map +0 -1
- package/lib/transformation.d.ts +0 -169
- package/lib/transformation.js +0 -393
- package/lib/transformation.js.map +0 -1
- package/lib/types/answer-version.d.ts +0 -4
- package/lib/types/answer-version.js +0 -2
- package/lib/types/answer-version.js.map +0 -1
- package/lib/types/class-parent.d.ts +0 -13
- package/lib/types/class-parent.js +0 -2
- package/lib/types/class-parent.js.map +0 -1
- package/lib/types/config-flags.d.ts +0 -4
- package/lib/types/config-flags.js +0 -2
- package/lib/types/config-flags.js.map +0 -1
- package/lib/types/construct-name.d.ts +0 -1
- package/lib/types/construct-name.js +0 -2
- package/lib/types/construct-name.js.map +0 -1
- package/lib/types/dependency-map.d.ts +0 -4
- package/lib/types/dependency-map.js +0 -2
- package/lib/types/dependency-map.js.map +0 -1
- package/lib/types/dependency.js +0 -2
- package/lib/types/dependency.js.map +0 -1
- package/lib/types/file-info.js +0 -2
- package/lib/types/file-info.js.map +0 -1
- package/lib/types/format.d.ts +0 -1
- package/lib/types/format.js +0 -2
- package/lib/types/format.js.map +0 -1
- package/lib/types/gir-alias-element.d.ts +0 -4
- package/lib/types/gir-alias-element.js +0 -2
- package/lib/types/gir-alias-element.js.map +0 -1
- package/lib/types/gir-annotation.d.ts +0 -9
- package/lib/types/gir-annotation.js +0 -2
- package/lib/types/gir-annotation.js.map +0 -1
- package/lib/types/gir-any-element.d.ts +0 -2
- package/lib/types/gir-any-element.js +0 -2
- package/lib/types/gir-any-element.js.map +0 -1
- package/lib/types/gir-bitfield-element.d.ts +0 -6
- package/lib/types/gir-bitfield-element.js +0 -2
- package/lib/types/gir-bitfield-element.js.map +0 -1
- package/lib/types/gir-callable-param-element.d.ts +0 -4
- package/lib/types/gir-callable-param-element.js +0 -2
- package/lib/types/gir-callable-param-element.js.map +0 -1
- package/lib/types/gir-callable-params.d.ts +0 -7
- package/lib/types/gir-callable-params.js +0 -2
- package/lib/types/gir-callable-params.js.map +0 -1
- package/lib/types/gir-callable-return.d.ts +0 -5
- package/lib/types/gir-callable-return.js +0 -2
- package/lib/types/gir-callable-return.js.map +0 -1
- package/lib/types/gir-callback-element.d.ts +0 -6
- package/lib/types/gir-callback-element.js +0 -2
- package/lib/types/gir-callback-element.js.map +0 -1
- package/lib/types/gir-class-element.d.ts +0 -17
- package/lib/types/gir-class-element.js +0 -2
- package/lib/types/gir-class-element.js.map +0 -1
- package/lib/types/gir-constant-element.d.ts +0 -4
- package/lib/types/gir-constant-element.js +0 -2
- package/lib/types/gir-constant-element.js.map +0 -1
- package/lib/types/gir-constructor-element.d.ts +0 -6
- package/lib/types/gir-constructor-element.js +0 -2
- package/lib/types/gir-constructor-element.js.map +0 -1
- package/lib/types/gir-enum-element.d.ts +0 -6
- package/lib/types/gir-enum-element.js +0 -2
- package/lib/types/gir-enum-element.js.map +0 -1
- package/lib/types/gir-field-element.d.ts +0 -5
- package/lib/types/gir-field-element.js +0 -2
- package/lib/types/gir-field-element.js.map +0 -1
- package/lib/types/gir-function-element.d.ts +0 -6
- package/lib/types/gir-function-element.js +0 -2
- package/lib/types/gir-function-element.js.map +0 -1
- package/lib/types/gir-instance-parameter.d.ts +0 -7
- package/lib/types/gir-instance-parameter.js +0 -2
- package/lib/types/gir-instance-parameter.js.map +0 -1
- package/lib/types/gir-interface-element.d.ts +0 -16
- package/lib/types/gir-interface-element.js +0 -2
- package/lib/types/gir-interface-element.js.map +0 -1
- package/lib/types/gir-member-element.d.ts +0 -5
- package/lib/types/gir-member-element.js +0 -2
- package/lib/types/gir-member-element.js.map +0 -1
- package/lib/types/gir-method-element.d.ts +0 -7
- package/lib/types/gir-method-element.js +0 -2
- package/lib/types/gir-method-element.js.map +0 -1
- package/lib/types/gir-module-resolved-by.d.ts +0 -15
- package/lib/types/gir-module-resolved-by.js +0 -2
- package/lib/types/gir-module-resolved-by.js.map +0 -1
- package/lib/types/gir-modules-grouped-map.d.ts +0 -4
- package/lib/types/gir-modules-grouped-map.js +0 -2
- package/lib/types/gir-modules-grouped-map.js.map +0 -1
- package/lib/types/gir-modules-grouped.d.ts +0 -12
- package/lib/types/gir-modules-grouped.js +0 -2
- package/lib/types/gir-modules-grouped.js.map +0 -1
- package/lib/types/gir-namespace.d.ts +0 -27
- package/lib/types/gir-namespace.js +0 -2
- package/lib/types/gir-namespace.js.map +0 -1
- package/lib/types/gir-property-element.d.ts +0 -4
- package/lib/types/gir-property-element.js +0 -2
- package/lib/types/gir-property-element.js.map +0 -1
- package/lib/types/gir-record-element.d.ts +0 -10
- package/lib/types/gir-record-element.js +0 -2
- package/lib/types/gir-record-element.js.map +0 -1
- package/lib/types/gir-repository.d.ts +0 -5
- package/lib/types/gir-repository.js +0 -2
- package/lib/types/gir-repository.js.map +0 -1
- package/lib/types/gir-signal.d.ts +0 -10
- package/lib/types/gir-signal.js +0 -2
- package/lib/types/gir-signal.js.map +0 -1
- package/lib/types/gir-type-name.d.ts +0 -2
- package/lib/types/gir-type-name.js +0 -2
- package/lib/types/gir-type-name.js.map +0 -1
- package/lib/types/gir-union-element.d.ts +0 -9
- package/lib/types/gir-union-element.js +0 -2
- package/lib/types/gir-union-element.js.map +0 -1
- package/lib/types/gir-unparsed-number.d.ts +0 -2
- package/lib/types/gir-unparsed-number.js +0 -2
- package/lib/types/gir-unparsed-number.js.map +0 -1
- package/lib/types/gir-virtual-method.d.ts +0 -6
- package/lib/types/gir-virtual-method.js +0 -2
- package/lib/types/gir-virtual-method.js.map +0 -1
- package/lib/types/index.d.ts +0 -79
- package/lib/types/index.js +0 -80
- package/lib/types/index.js.map +0 -1
- package/lib/types/inheritance-table.js +0 -2
- package/lib/types/inheritance-table.js.map +0 -1
- package/lib/types/local-name-check.d.ts +0 -4
- package/lib/types/local-name-check.js +0 -2
- package/lib/types/local-name-check.js.map +0 -1
- package/lib/types/local-name-type.d.ts +0 -1
- package/lib/types/local-name-type.js +0 -2
- package/lib/types/local-name-type.js.map +0 -1
- package/lib/types/local-name.d.ts +0 -7
- package/lib/types/local-name.js +0 -2
- package/lib/types/local-name.js.map +0 -1
- package/lib/types/local-names.d.ts +0 -4
- package/lib/types/local-names.js +0 -2
- package/lib/types/local-names.js.map +0 -1
- package/lib/types/metadata.d.ts +0 -8
- package/lib/types/metadata.js +0 -2
- package/lib/types/metadata.js.map +0 -1
- package/lib/types/options-base.d.ts +0 -4
- package/lib/types/options-base.js +0 -2
- package/lib/types/options-base.js.map +0 -1
- package/lib/types/options-generation.js +0 -2
- package/lib/types/options-generation.js.map +0 -1
- package/lib/types/options-load.d.ts +0 -5
- package/lib/types/options-load.js +0 -2
- package/lib/types/options-load.js.map +0 -1
- package/lib/types/options-transform.d.ts +0 -4
- package/lib/types/options-transform.js +0 -2
- package/lib/types/options-transform.js.map +0 -1
- package/lib/types/output-format.d.ts +0 -1
- package/lib/types/output-format.js +0 -2
- package/lib/types/output-format.js.map +0 -1
- package/lib/types/package-data-parsed.js +0 -2
- package/lib/types/package-data-parsed.js.map +0 -1
- package/lib/types/package-data.js +0 -2
- package/lib/types/package-data.js.map +0 -1
- package/lib/types/package-section-parsed.d.ts +0 -8
- package/lib/types/package-section-parsed.js +0 -2
- package/lib/types/package-section-parsed.js.map +0 -1
- package/lib/types/parsed-gir.d.ts +0 -5
- package/lib/types/parsed-gir.js +0 -2
- package/lib/types/parsed-gir.js.map +0 -1
- package/lib/types/parsed-package-data.d.ts +0 -6
- package/lib/types/parsed-package-data.js +0 -2
- package/lib/types/parsed-package-data.js.map +0 -1
- package/lib/types/part-of-class.d.ts +0 -7
- package/lib/types/part-of-class.js +0 -2
- package/lib/types/part-of-class.js.map +0 -1
- package/lib/types/part-of-module.d.ts +0 -6
- package/lib/types/part-of-module.js +0 -2
- package/lib/types/part-of-module.js.map +0 -1
- package/lib/types/property-case.d.ts +0 -1
- package/lib/types/property-case.js +0 -2
- package/lib/types/property-case.js.map +0 -1
- package/lib/types/resolve-type.d.ts +0 -4
- package/lib/types/resolve-type.js +0 -6
- package/lib/types/resolve-type.js.map +0 -1
- package/lib/types/template-data.d.ts +0 -7
- package/lib/types/template-data.js +0 -2
- package/lib/types/template-data.js.map +0 -1
- package/lib/types/transformation-case.d.ts +0 -1
- package/lib/types/transformation-case.js +0 -2
- package/lib/types/transformation-case.js.map +0 -1
- package/lib/types/transformations.d.ts +0 -4
- package/lib/types/transformations.js +0 -2
- package/lib/types/transformations.js.map +0 -1
- package/lib/types/ts-doc-tag.js +0 -2
- package/lib/types/ts-doc-tag.js.map +0 -1
- package/lib/types/ts-doc.js +0 -2
- package/lib/types/ts-doc.js.map +0 -1
- package/lib/types/type-gir-alias.js +0 -2
- package/lib/types/type-gir-alias.js.map +0 -1
- package/lib/types/type-gir-class.js +0 -2
- package/lib/types/type-gir-class.js.map +0 -1
- package/lib/types/type-gir-element.d.ts +0 -3
- package/lib/types/type-gir-element.js +0 -2
- package/lib/types/type-gir-element.js.map +0 -1
- package/lib/types/type-gir-enumeration-member.js +0 -2
- package/lib/types/type-gir-enumeration-member.js.map +0 -1
- package/lib/types/type-gir-enumeration.js +0 -2
- package/lib/types/type-gir-enumeration.js.map +0 -1
- package/lib/types/type-gir-function.d.ts +0 -1
- package/lib/types/type-gir-function.js +0 -2
- package/lib/types/type-gir-function.js.map +0 -1
- package/lib/types/type-gir-interface.js +0 -2
- package/lib/types/type-gir-interface.js.map +0 -1
- package/lib/types/type-gir-method.js +0 -2
- package/lib/types/type-gir-method.js.map +0 -1
- package/lib/types/type-gir-parameter.d.ts +0 -1
- package/lib/types/type-gir-parameter.js +0 -2
- package/lib/types/type-gir-parameter.js.map +0 -1
- package/lib/types/type-gir-property.js +0 -2
- package/lib/types/type-gir-property.js.map +0 -1
- package/lib/types/type-gir-variable.d.ts +0 -1
- package/lib/types/type-gir-variable.js +0 -2
- package/lib/types/type-gir-variable.js.map +0 -1
- package/lib/types/type-ts-element.d.ts +0 -3
- package/lib/types/type-ts-element.js +0 -2
- package/lib/types/type-ts-element.js.map +0 -1
- package/lib/types/type-ts-enumeration-member.js +0 -2
- package/lib/types/type-ts-enumeration-member.js.map +0 -1
- package/lib/types/type-ts-function.js +0 -2
- package/lib/types/type-ts-function.js.map +0 -1
- package/lib/types/type-ts-property.js +0 -2
- package/lib/types/type-ts-property.js.map +0 -1
- package/lib/types/user-config-load-result.d.ts +0 -6
- package/lib/types/user-config-load-result.js +0 -2
- package/lib/types/user-config-load-result.js.map +0 -1
- package/lib/types/user-config.js +0 -2
- package/lib/types/user-config.js.map +0 -1
- package/lib/util.d.ts +0 -20
- package/lib/util.js +0 -67
- package/lib/util.js.map +0 -1
- package/lib/utils/documentation.d.ts +0 -13
- package/lib/utils/documentation.js.map +0 -1
- package/lib/utils/files.d.ts +0 -21
- package/lib/utils/files.js +0 -62
- package/lib/utils/files.js.map +0 -1
- package/lib/utils/girs.d.ts +0 -45
- package/lib/utils/girs.js +0 -101
- package/lib/utils/girs.js.map +0 -1
- package/lib/utils/index.d.ts +0 -8
- package/lib/utils/index.js +0 -9
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/naming.d.ts +0 -13
- package/lib/utils/naming.js +0 -40
- package/lib/utils/naming.js.map +0 -1
- package/lib/utils/numbers.js +0 -9
- package/lib/utils/numbers.js.map +0 -1
- package/lib/utils/objects.d.ts +0 -136
- package/lib/utils/objects.js.map +0 -1
- package/lib/utils/path.d.ts +0 -1
- package/lib/utils/path.js +0 -7
- package/lib/utils/path.js.map +0 -1
- package/lib/utils/strings.d.ts +0 -74
- package/lib/utils/strings.js +0 -121
- package/lib/utils/strings.js.map +0 -1
- package/lib/validators/class.d.ts +0 -7
- package/lib/validators/class.js +0 -217
- package/lib/validators/class.js.map +0 -1
- package/lib/validators/function-parameters.d.ts +0 -14
- package/lib/validators/function-parameters.js +0 -31
- package/lib/validators/function-parameters.js.map +0 -1
- package/lib/validators/interface.d.ts +0 -5
- package/lib/validators/interface.js +0 -16
- package/lib/validators/interface.js.map +0 -1
- package/lib/visitor.d.ts +0 -35
- package/lib/visitor.js +0 -29
- package/lib/visitor.js.map +0 -1
package/lib/utils/path.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { dirname, resolve } from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
// Get __filename on ESM
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
// Get __dirname on ESM, resolve to the root directory of this package
|
|
6
|
-
export const __dirname = resolve(dirname(__filename), '../..');
|
|
7
|
-
//# sourceMappingURL=path.js.map
|
package/lib/utils/path.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,wBAAwB;AACxB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAA"}
|
package/lib/utils/strings.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes line breaks and consecutive white spaces from a given string
|
|
3
|
-
* @param str
|
|
4
|
-
* @returns
|
|
5
|
-
*/
|
|
6
|
-
export declare const cleanString: (str: string) => string;
|
|
7
|
-
/**
|
|
8
|
-
* Get the first character of a string
|
|
9
|
-
* @param str The string to get the first character from
|
|
10
|
-
* @returns The first character
|
|
11
|
-
*/
|
|
12
|
-
export declare const getFirstChar: (str: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Get the last character of a string
|
|
15
|
-
* @param str The string to get the last character from
|
|
16
|
-
* @returns The last character
|
|
17
|
-
*/
|
|
18
|
-
export declare const getLastChar: (str: string) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Check if the first character of a string is numeric
|
|
21
|
-
* @param str The string to check
|
|
22
|
-
* @returns Whether the first character is numeric or not
|
|
23
|
-
*/
|
|
24
|
-
export declare const isFirstCharNumeric: (str: string) => boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Convert a string to camelCase, keeps the first alphabet character as it is.
|
|
27
|
-
* @param str The string to convert
|
|
28
|
-
* @returns The converted string
|
|
29
|
-
*/
|
|
30
|
-
export declare const camelCase: (str: string) => string;
|
|
31
|
-
/**
|
|
32
|
-
* Convert a string to `lowerCamelCase`
|
|
33
|
-
* @param str The string to convert
|
|
34
|
-
* @returns The converted string
|
|
35
|
-
*/
|
|
36
|
-
export declare const lowerCamelCase: (str: string) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Convert a string to `PascalCase`
|
|
39
|
-
* @param str The string to convert
|
|
40
|
-
* @returns The converted string
|
|
41
|
-
*/
|
|
42
|
-
export declare const pascalCase: (str: string) => string;
|
|
43
|
-
/** Alias for {@link pascalCase} */
|
|
44
|
-
export declare const upperCamelCase: (str: string) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Convert a string to `snake_case`
|
|
47
|
-
* @param str The string to convert
|
|
48
|
-
* @returns The converted string
|
|
49
|
-
*/
|
|
50
|
-
export declare const snakeCase: (str: string) => string;
|
|
51
|
-
/**
|
|
52
|
-
* Convert a string to `kebab-case`
|
|
53
|
-
* @param str The string to convert
|
|
54
|
-
* @returns The converted string
|
|
55
|
-
*/
|
|
56
|
-
export declare const kebabCase: (str: string) => string;
|
|
57
|
-
/** Alias for {@link kebabCase} */
|
|
58
|
-
export declare const slugCase: (str: string) => string;
|
|
59
|
-
export declare const underscores: (str: string) => string;
|
|
60
|
-
/**
|
|
61
|
-
* Add indents to a string
|
|
62
|
-
* @param indents The number of indents
|
|
63
|
-
* @param spaceForIndent The number of spaces for each indent
|
|
64
|
-
* @returns The indented string
|
|
65
|
-
*/
|
|
66
|
-
export declare const generateIndent: (indents?: number, spaceForIndent?: number) => string;
|
|
67
|
-
/**
|
|
68
|
-
* Merge a large array of strings by using a smaller chunk size
|
|
69
|
-
* @param target The target array to merge into
|
|
70
|
-
* @param source The source array to merge from
|
|
71
|
-
* @param chunkSize The size of the chunks to merge
|
|
72
|
-
* @returns The merged array
|
|
73
|
-
*/
|
|
74
|
-
export declare const mergeLargeStringArray: (target: string[], source: string[], chunkSize?: number) => string[];
|
package/lib/utils/strings.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { isNumeric } from './numbers.js';
|
|
2
|
-
/**
|
|
3
|
-
* Removes line breaks and consecutive white spaces from a given string
|
|
4
|
-
* @param str
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export const cleanString = (str) => {
|
|
8
|
-
str = str.replace(/\r?\n|\r/g, ' ');
|
|
9
|
-
str = str.replace(/\s+/g, ' ');
|
|
10
|
-
return str.trim();
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Get the first character of a string
|
|
14
|
-
* @param str The string to get the first character from
|
|
15
|
-
* @returns The first character
|
|
16
|
-
*/
|
|
17
|
-
export const getFirstChar = (str) => {
|
|
18
|
-
return str.charAt(0);
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Get the last character of a string
|
|
22
|
-
* @param str The string to get the last character from
|
|
23
|
-
* @returns The last character
|
|
24
|
-
*/
|
|
25
|
-
export const getLastChar = (str) => {
|
|
26
|
-
return str.charAt(str.length - 1);
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Check if the first character of a string is numeric
|
|
30
|
-
* @param str The string to check
|
|
31
|
-
* @returns Whether the first character is numeric or not
|
|
32
|
-
*/
|
|
33
|
-
export const isFirstCharNumeric = (str) => {
|
|
34
|
-
return isNumeric(getFirstChar(str));
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Convert a string to camelCase, keeps the first alphabet character as it is.
|
|
38
|
-
* @param str The string to convert
|
|
39
|
-
* @returns The converted string
|
|
40
|
-
*/
|
|
41
|
-
export const camelCase = (str) => {
|
|
42
|
-
return str
|
|
43
|
-
.replace(/\s(.)|(\s|-|_|\.)(.)/g, (a) => {
|
|
44
|
-
return a.toUpperCase();
|
|
45
|
-
})
|
|
46
|
-
.replace(/(\s|-|_|\.)/g, '');
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Convert a string to `lowerCamelCase`
|
|
50
|
-
* @param str The string to convert
|
|
51
|
-
* @returns The converted string
|
|
52
|
-
*/
|
|
53
|
-
export const lowerCamelCase = (str) => {
|
|
54
|
-
str = camelCase(str);
|
|
55
|
-
str = getFirstChar(str).toLowerCase() + str.slice(1);
|
|
56
|
-
return str;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Convert a string to `PascalCase`
|
|
60
|
-
* @param str The string to convert
|
|
61
|
-
* @returns The converted string
|
|
62
|
-
*/
|
|
63
|
-
export const pascalCase = (str) => {
|
|
64
|
-
str = camelCase(str);
|
|
65
|
-
str = getFirstChar(str).toUpperCase() + str.slice(1);
|
|
66
|
-
return str;
|
|
67
|
-
};
|
|
68
|
-
/** Alias for {@link pascalCase} */
|
|
69
|
-
export const upperCamelCase = pascalCase;
|
|
70
|
-
/**
|
|
71
|
-
* Convert a string to `snake_case`
|
|
72
|
-
* @param str The string to convert
|
|
73
|
-
* @returns The converted string
|
|
74
|
-
*/
|
|
75
|
-
export const snakeCase = (str) => {
|
|
76
|
-
return str
|
|
77
|
-
.replace(/([a-z])([A-Z])/g, '$1-$2') // replace camelCase with hyphen-case
|
|
78
|
-
.replace(/[^a-zA-Z0-9-]+/g, '_') // replace non-alphanumeric characters with underscore
|
|
79
|
-
.replace(/^_+|_+$/g, '') // remove any leading or trailing underscores
|
|
80
|
-
.toLowerCase();
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Convert a string to `kebab-case`
|
|
84
|
-
* @param str The string to convert
|
|
85
|
-
* @returns The converted string
|
|
86
|
-
*/
|
|
87
|
-
export const kebabCase = (str) => {
|
|
88
|
-
return str
|
|
89
|
-
.replace(/([a-z])([A-Z])/g, '$1-$2') // replace camelCase with hyphen-case
|
|
90
|
-
.replace(/[^a-zA-Z0-9-]+/g, '-') // replace non-alphanumeric characters with hyphen
|
|
91
|
-
.replace(/^-+|-+$/g, '') // remove any leading or trailing hyphens
|
|
92
|
-
.toLowerCase();
|
|
93
|
-
};
|
|
94
|
-
/** Alias for {@link kebabCase} */
|
|
95
|
-
export const slugCase = kebabCase;
|
|
96
|
-
export const underscores = (str) => {
|
|
97
|
-
return str.replace(/-|_/g, '_');
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Add indents to a string
|
|
101
|
-
* @param indents The number of indents
|
|
102
|
-
* @param spaceForIndent The number of spaces for each indent
|
|
103
|
-
* @returns The indented string
|
|
104
|
-
*/
|
|
105
|
-
export const generateIndent = (indents = 1, spaceForIndent = 4) => {
|
|
106
|
-
return ' '.repeat(indents * spaceForIndent);
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Merge a large array of strings by using a smaller chunk size
|
|
110
|
-
* @param target The target array to merge into
|
|
111
|
-
* @param source The source array to merge from
|
|
112
|
-
* @param chunkSize The size of the chunks to merge
|
|
113
|
-
* @returns The merged array
|
|
114
|
-
*/
|
|
115
|
-
export const mergeLargeStringArray = (target, source, chunkSize = 1000) => {
|
|
116
|
-
for (let i = 0; i < source.length; i += chunkSize) {
|
|
117
|
-
target.push(...source.slice(i, i + chunkSize));
|
|
118
|
-
}
|
|
119
|
-
return target;
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=strings.js.map
|
package/lib/utils/strings.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;IACvC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;IACnC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACrB,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;IAChD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACxB,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AACrC,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAW,EAAE;IACvD,OAAO,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;AACvC,CAAC,CAAA;AA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G,CAAC,GAAW,EAAU,EAAE;IAC7C,OAAO,GAAG;SACL,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,qCAAqC;SACzE,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,kDAAkD;SAClF,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,yCAAyC;SACjE,WAAW,EAAE,CAAA;AACtB,CAAC,CAAA;AAED,kCAAkC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACnC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,cAAc,GAAG,CAAC,EAAU,EAAE;IACtE,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAgB,EAAE,MAAgB,EAAE,YAAoB,IAAI,EAAY,EAAE;IAC5G,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IntrospectedClass, IntrospectedInterface, IntrospectedRecord } from "../gir/class.js";
|
|
2
|
-
import { GirVisitor } from "../visitor.js";
|
|
3
|
-
export declare class ClassVisitor extends GirVisitor {
|
|
4
|
-
visitClass: (node: IntrospectedClass) => IntrospectedClass;
|
|
5
|
-
visitInterface: (node: IntrospectedInterface) => IntrospectedInterface;
|
|
6
|
-
visitRecord: (node: IntrospectedRecord) => IntrospectedRecord;
|
|
7
|
-
}
|
package/lib/validators/class.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { AnyType, NativeType, TypeIdentifier } from "../gir.js";
|
|
2
|
-
import { IntrospectedRecord } from "../gir/class.js";
|
|
3
|
-
import { IntrospectedError } from "../gir/enum.js";
|
|
4
|
-
import { IntrospectedClassFunction, IntrospectedDirectAllocationConstructor, IntrospectedStaticClassFunction } from "../gir/function.js";
|
|
5
|
-
import { resolveTypeIdentifier } from "../gir/util.js";
|
|
6
|
-
import { GirVisitor } from "../visitor.js";
|
|
7
|
-
const filterIntrospectableClassMembers = (node) => {
|
|
8
|
-
node.fields = node.fields.filter(field => field.isIntrospectable);
|
|
9
|
-
node.props = node.props.filter(prop => prop.isIntrospectable);
|
|
10
|
-
node.callbacks = node.callbacks.filter(prop => prop.isIntrospectable);
|
|
11
|
-
node.constructors = node.constructors.filter(prop => prop.isIntrospectable);
|
|
12
|
-
node.members = node.members.filter(prop => prop.isIntrospectable);
|
|
13
|
-
return node;
|
|
14
|
-
};
|
|
15
|
-
const PROTECTED_FIELD_NAMES = ["parent_instance", "parent", "parent_class", "object_class"];
|
|
16
|
-
const filterProtectedFields = (node) => {
|
|
17
|
-
const set = new Set(PROTECTED_FIELD_NAMES);
|
|
18
|
-
node.fields = node.fields.filter(f => {
|
|
19
|
-
return !set.has(f.name);
|
|
20
|
-
});
|
|
21
|
-
return node;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Filters fields, properties, and members to ensure they are not named
|
|
25
|
-
* after reserved object keys (prototype, constructor)
|
|
26
|
-
*/
|
|
27
|
-
const filterReservedProperties = (node) => {
|
|
28
|
-
const set = new Set(["prototype", "constructor"]);
|
|
29
|
-
node.fields = node.fields.filter(f => {
|
|
30
|
-
return !set.has(f.name);
|
|
31
|
-
});
|
|
32
|
-
node.props = node.props.filter(p => {
|
|
33
|
-
return !set.has(p.name);
|
|
34
|
-
});
|
|
35
|
-
node.members = node.members.filter(m => {
|
|
36
|
-
return !set.has(m.name);
|
|
37
|
-
});
|
|
38
|
-
return node;
|
|
39
|
-
};
|
|
40
|
-
const filterConflictingNamedClassMembers = (node) => {
|
|
41
|
-
// Props shadow members
|
|
42
|
-
node.members = node.members.filter(m => {
|
|
43
|
-
return !node.props.some(prop => prop.name === m.name && !(m instanceof IntrospectedStaticClassFunction));
|
|
44
|
-
});
|
|
45
|
-
// Props and members shadow fields
|
|
46
|
-
node.fields = node.fields.filter(f => !node.members.some(n => n.name === f.name && !(n instanceof IntrospectedStaticClassFunction)) &&
|
|
47
|
-
!node.props.some(n => n.name === f.name));
|
|
48
|
-
return node;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Subtypes of ParamSpec are not supported (e.g. a subtype of ParamSpecString).
|
|
52
|
-
*
|
|
53
|
-
* First, we transform the node to use ParamSpec as a parent and then flag it
|
|
54
|
-
* to not emit.
|
|
55
|
-
*
|
|
56
|
-
* If a generator doesn't follow the emit() standard, the parent type will at least
|
|
57
|
-
* be valid.
|
|
58
|
-
*
|
|
59
|
-
* @param node
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
const fixParamSpecSubtypes = (node) => {
|
|
63
|
-
if (node.superType?.namespace === "GObject" && node.superType.name.startsWith("ParamSpec")) {
|
|
64
|
-
// We don't assert this import because we don't want to force libraries
|
|
65
|
-
// to unnecessarily import GObject.
|
|
66
|
-
node.superType = new TypeIdentifier("ParamSpec", "GObject");
|
|
67
|
-
node.noEmit();
|
|
68
|
-
}
|
|
69
|
-
return node;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Checks if a class implements a GObject.Object-based interface
|
|
73
|
-
* If the class is missing a direct parent we inject GObject.Object
|
|
74
|
-
* as a stand-in considering it already indirectly inherits
|
|
75
|
-
* from it.
|
|
76
|
-
*
|
|
77
|
-
* @param node
|
|
78
|
-
*/
|
|
79
|
-
const fixMissingParent = (node) => {
|
|
80
|
-
const { namespace } = node;
|
|
81
|
-
if (node.superType == null) {
|
|
82
|
-
const isGObject = node.someParent(p => p.getType().is("GObject", "Object"));
|
|
83
|
-
if (isGObject) {
|
|
84
|
-
node.superType = namespace.assertInstalledImport("GObject").assertClass("Object").getType();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return node;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Fields cannot be array types, error types,
|
|
91
|
-
* or class-like types in GJS. This strips
|
|
92
|
-
* fields which have these "complex" types.
|
|
93
|
-
*
|
|
94
|
-
* @param node
|
|
95
|
-
*/
|
|
96
|
-
const removeComplexFields = (node) => {
|
|
97
|
-
const { namespace } = node;
|
|
98
|
-
node.fields = node.fields.filter(f => {
|
|
99
|
-
const type = f.type.deepUnwrap();
|
|
100
|
-
if (type instanceof NativeType) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
if (type instanceof TypeIdentifier) {
|
|
104
|
-
// Find the type for the identifier
|
|
105
|
-
const classNode = resolveTypeIdentifier(namespace, type);
|
|
106
|
-
// Don't allow private or disguised fields
|
|
107
|
-
if (classNode && classNode.isPrivate) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
// Only allow fields pointing to simple structs.
|
|
111
|
-
if (classNode && classNode instanceof IntrospectedRecord && !classNode.isSimple()) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
const en = namespace.assertInstalledImport(type.namespace).getEnum(type.name);
|
|
115
|
-
if (!(en instanceof IntrospectedError)) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
return true;
|
|
121
|
-
});
|
|
122
|
-
return node;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* TODO: Consider making this transformation optional.
|
|
126
|
-
*
|
|
127
|
-
* If we are referencing an unknown library, any-ify the type.
|
|
128
|
-
*
|
|
129
|
-
* @param node
|
|
130
|
-
*/
|
|
131
|
-
const removeReferencesToMissingLibraries = (node) => {
|
|
132
|
-
const { namespace } = node;
|
|
133
|
-
node.fields = node.fields.map(f => {
|
|
134
|
-
const type = f.type.deepUnwrap();
|
|
135
|
-
if (type instanceof TypeIdentifier) {
|
|
136
|
-
// Find the type for the identifier
|
|
137
|
-
const nsNode = namespace.getInstalledImport(type.namespace);
|
|
138
|
-
// Don't allow private or disguised fields
|
|
139
|
-
if (!nsNode) {
|
|
140
|
-
return f.copy({ type: AnyType });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return f;
|
|
144
|
-
});
|
|
145
|
-
return node;
|
|
146
|
-
};
|
|
147
|
-
const removePrivateFields = (node) => {
|
|
148
|
-
node.fields = node.fields.filter(f => {
|
|
149
|
-
return !f.isPrivate && !f.name.startsWith("_");
|
|
150
|
-
});
|
|
151
|
-
return node;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Boxed types have a specific order of preference for
|
|
155
|
-
* which constructor will be used...
|
|
156
|
-
*
|
|
157
|
-
* 1. Zero Args Constructor
|
|
158
|
-
* 2. Direct Allocation (if the type is simple)
|
|
159
|
-
* 3. The new() constructor
|
|
160
|
-
* 4. The first constructor
|
|
161
|
-
*
|
|
162
|
-
* @param node
|
|
163
|
-
*/
|
|
164
|
-
const resolveMainConstructor = (node) => {
|
|
165
|
-
const newConstructor = node.constructors.find(c => c.name === "new");
|
|
166
|
-
const zeroArgsConstructor = node.constructors.find(c => c.parameters.length === 0);
|
|
167
|
-
const firstConstructor = node.constructors?.[0];
|
|
168
|
-
if (node.isForeign()) {
|
|
169
|
-
node.mainConstructor = null;
|
|
170
|
-
return node;
|
|
171
|
-
}
|
|
172
|
-
if (zeroArgsConstructor || node.isSimpleWithoutPointers()) {
|
|
173
|
-
node.mainConstructor = IntrospectedDirectAllocationConstructor.fromFields(node.fields, node);
|
|
174
|
-
return node;
|
|
175
|
-
}
|
|
176
|
-
const resolvedConstructor = newConstructor ?? firstConstructor;
|
|
177
|
-
if (resolvedConstructor) {
|
|
178
|
-
node.mainConstructor = resolvedConstructor.copy();
|
|
179
|
-
}
|
|
180
|
-
if (node.isSimple()) {
|
|
181
|
-
node.mainConstructor = IntrospectedDirectAllocationConstructor.fromFields(node.fields, node);
|
|
182
|
-
return node;
|
|
183
|
-
}
|
|
184
|
-
return node;
|
|
185
|
-
};
|
|
186
|
-
const mergeStaticDefinitions = (node) => {
|
|
187
|
-
if (!node.staticDefinition) {
|
|
188
|
-
return node;
|
|
189
|
-
}
|
|
190
|
-
const { namespace } = node;
|
|
191
|
-
const staticDefinition = namespace.getClass(node.staticDefinition);
|
|
192
|
-
if (!(staticDefinition instanceof IntrospectedRecord)) {
|
|
193
|
-
return node;
|
|
194
|
-
}
|
|
195
|
-
const staticMethods = staticDefinition.members
|
|
196
|
-
.filter(m => m instanceof IntrospectedClassFunction)
|
|
197
|
-
.map(m => m.asStaticClassFunction(node));
|
|
198
|
-
for (const staticMethod of staticMethods) {
|
|
199
|
-
if (!node.members.some(member => member.name === staticMethod.name && member instanceof IntrospectedStaticClassFunction)) {
|
|
200
|
-
node.members.push(staticMethod);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return node;
|
|
204
|
-
};
|
|
205
|
-
function chainVisitors(node, ...args) {
|
|
206
|
-
let currentNode = node;
|
|
207
|
-
for (const visitor of args) {
|
|
208
|
-
currentNode = visitor(currentNode);
|
|
209
|
-
}
|
|
210
|
-
return currentNode;
|
|
211
|
-
}
|
|
212
|
-
export class ClassVisitor extends GirVisitor {
|
|
213
|
-
visitClass = (node) => chainVisitors(node, removeReferencesToMissingLibraries, fixMissingParent, fixParamSpecSubtypes, removeComplexFields, removePrivateFields, mergeStaticDefinitions, filterConflictingNamedClassMembers, filterIntrospectableClassMembers, filterProtectedFields, filterReservedProperties);
|
|
214
|
-
visitInterface = (node) => chainVisitors(node, filterIntrospectableClassMembers, filterReservedProperties);
|
|
215
|
-
visitRecord = (node) => chainVisitors(node, fixMissingParent, fixParamSpecSubtypes, resolveMainConstructor, removeComplexFields, removePrivateFields, filterConflictingNamedClassMembers, filterIntrospectableClassMembers, filterProtectedFields, filterReservedProperties);
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/validators/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAmE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACH,yBAAyB,EACzB,uCAAuC,EACvC,+BAA+B,EAClC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,gCAAgC,GAAG,CAAkC,IAAO,EAAK,EAAE;IACrF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC9D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACtE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB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AAED,MAAM,OAAO,YAAa,SAAQ,UAAU;IACxC,UAAU,GAAG,CAAC,IAAuB,EAAE,EAAE,CACrC,aAAa,CACT,IAAI,EACJ,kCAAkC,EAClC,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,EAClC,gCAAgC,EAChC,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;IAEN,cAAc,GAAG,CAAC,IAA2B,EAAE,EAAE,CAC7C,aAAa,CAAC,IAAI,EAAE,gCAAgC,EAAE,wBAAwB,CAAC,CAAC;IAEpF,WAAW,GAAG,CAAC,IAAwB,EAAE,EAAE,CACvC,aAAa,CACT,IAAI,EACJ,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,kCAAkC,EAClC,gCAAgC,EAChC,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;CACT"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IntrospectedFunction, IntrospectedClassFunction } from "../gir/function.js";
|
|
2
|
-
import { IntrospectedBaseClass } from "../gir/class.js";
|
|
3
|
-
import { IntrospectedEnum } from "../gir/enum.js";
|
|
4
|
-
import { GirVisitor } from "../visitor.js";
|
|
5
|
-
export declare class FunctionParametersVisitor extends GirVisitor {
|
|
6
|
-
/**
|
|
7
|
-
* Marks all enum parameters of a function as nullable,
|
|
8
|
-
* because GJS allows null values for enum parameters and treats them as a 0 value.
|
|
9
|
-
* See issue [#207](https://github.com/gjsify/ts-for-gir/issues/207).
|
|
10
|
-
*/
|
|
11
|
-
private makeEnumParamsNullable;
|
|
12
|
-
visitFunction: (node: IntrospectedFunction) => IntrospectedFunction;
|
|
13
|
-
visitClassFunction: <T_1 extends IntrospectedBaseClass | IntrospectedEnum>(node: IntrospectedClassFunction<T_1>) => IntrospectedClassFunction<T_1>;
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { TypeIdentifier, NullableType } from "../gir.js";
|
|
2
|
-
import { GirVisitor } from "../visitor.js";
|
|
3
|
-
export class FunctionParametersVisitor extends GirVisitor {
|
|
4
|
-
makeEnumParamsNullable(node) {
|
|
5
|
-
return node.copy({
|
|
6
|
-
parameters: node.parameters.map(param => {
|
|
7
|
-
const type = param.type.deepUnwrap();
|
|
8
|
-
if (type instanceof TypeIdentifier) {
|
|
9
|
-
// Get the namespace where this type should be defined
|
|
10
|
-
const ns = node.namespace.assertInstalledImport(type.namespace);
|
|
11
|
-
// Check if the type is an enum
|
|
12
|
-
const isEnumType = !!ns.getEnum(type.name);
|
|
13
|
-
// If it is, make the parameter nullable
|
|
14
|
-
if (isEnumType) {
|
|
15
|
-
return param.copy({
|
|
16
|
-
type: new NullableType(param.type)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return param;
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
visitFunction = (node) => {
|
|
25
|
-
return this.makeEnumParamsNullable(node);
|
|
26
|
-
};
|
|
27
|
-
visitClassFunction = (node) => {
|
|
28
|
-
return this.makeEnumParamsNullable(node);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=function-parameters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-parameters.js","sourceRoot":"","sources":["../../src/validators/function-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,yBAA0B,SAAQ,UAAU;IAU7C,sBAAsB,CAC1B,IAAsD;QAEtD,OAAO,IAAI,CAAC,IAAI,CAAC;YACb,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;oBACjC,sDAAsD;oBACtD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBAEhE,+BAA+B;oBAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAE3C,wCAAwC;oBACxC,IAAI,UAAU,EAAE,CAAC;wBACb,OAAO,KAAK,CAAC,IAAI,CAAC;4BACd,IAAI,EAAE,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;yBACrC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;gBACD,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED,aAAa,GAAG,CAAC,IAA0B,EAAwB,EAAE;QACjE,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;IAEF,kBAAkB,GAAG,CACjB,IAAkC,EACN,EAAE;QAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;CACL"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { GirVisitor } from "../visitor.js";
|
|
2
|
-
export class InterfaceVisitor extends GirVisitor {
|
|
3
|
-
visitInterface = (node) => {
|
|
4
|
-
// If an interface does not list a prerequisite type, we fill it with GObject.Object
|
|
5
|
-
if (!node.noParent && node.superType == null) {
|
|
6
|
-
const gobject = node.namespace.assertInstalledImport("GObject");
|
|
7
|
-
const GObject = gobject.assertClass("Object");
|
|
8
|
-
if (!GObject) {
|
|
9
|
-
throw new Error(`GObject.Object could not be found while generating ${node.namespace.namespace}.${node.name}`);
|
|
10
|
-
}
|
|
11
|
-
node.superType = GObject.getType();
|
|
12
|
-
}
|
|
13
|
-
return node;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/validators/interface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC5C,cAAc,GAAG,CAAC,IAA2B,EAAyB,EAAE;QACpE,oFAAoF;QACpF,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;YAChE,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CACX,sDAAsD,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAChG,CAAC;YACN,CAAC;YAED,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;CACL"}
|
package/lib/visitor.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { TypeExpression } from './gir.js';
|
|
2
|
-
import { IntrospectedAlias } from './gir/alias.js';
|
|
3
|
-
import { IntrospectedRecord, IntrospectedInterface, IntrospectedClass, IntrospectedBaseClass } from './gir/class.js';
|
|
4
|
-
import { IntrospectedConstant } from './gir/const.js';
|
|
5
|
-
import { GirEnumMember, IntrospectedError, IntrospectedEnum } from './gir/enum.js';
|
|
6
|
-
import { IntrospectedCallback, IntrospectedConstructor, IntrospectedFunctionParameter, IntrospectedFunction, IntrospectedClassFunction, IntrospectedStaticClassFunction, IntrospectedVirtualClassFunction, IntrospectedDirectAllocationConstructor, IntrospectedClassCallback } from './gir/function.js';
|
|
7
|
-
import { IntrospectedNamespace } from './gir/namespace.js';
|
|
8
|
-
import { IntrospectedProperty, IntrospectedField } from './gir/property.js';
|
|
9
|
-
import { IntrospectedSignal, IntrospectedSignalType } from './gir/signal.js';
|
|
10
|
-
export declare abstract class GirVisitor {
|
|
11
|
-
visitType?: (node: TypeExpression) => TypeExpression;
|
|
12
|
-
visitCallback?: (node: IntrospectedCallback) => IntrospectedCallback;
|
|
13
|
-
visitClassCallback?: (node: IntrospectedClassCallback) => IntrospectedClassCallback;
|
|
14
|
-
visitAlias?: (node: IntrospectedAlias) => IntrospectedAlias;
|
|
15
|
-
visitConstructor?: (node: IntrospectedConstructor) => IntrospectedConstructor;
|
|
16
|
-
visitDirectAllocationConstructor?: (node: IntrospectedDirectAllocationConstructor) => IntrospectedDirectAllocationConstructor;
|
|
17
|
-
visitConstructorFunction?: (node: IntrospectedConstructor) => IntrospectedConstructor;
|
|
18
|
-
visitRecord?: (node: IntrospectedRecord) => IntrospectedRecord;
|
|
19
|
-
visitInterface?: (node: IntrospectedInterface) => IntrospectedInterface;
|
|
20
|
-
visitEnumMember?: (node: GirEnumMember) => GirEnumMember;
|
|
21
|
-
visitError?: (node: IntrospectedError) => IntrospectedError;
|
|
22
|
-
visitEnum?: (node: IntrospectedEnum) => IntrospectedEnum;
|
|
23
|
-
visitConst?: (node: IntrospectedConstant) => IntrospectedConstant;
|
|
24
|
-
visitClass?: (node: IntrospectedClass) => IntrospectedClass;
|
|
25
|
-
visitParameter?: (node: IntrospectedFunctionParameter) => IntrospectedFunctionParameter;
|
|
26
|
-
visitProperty?: (node: IntrospectedProperty) => IntrospectedProperty;
|
|
27
|
-
visitField?: (node: IntrospectedField) => IntrospectedField;
|
|
28
|
-
visitSignal?: (node: IntrospectedSignal, type?: IntrospectedSignalType) => IntrospectedSignal;
|
|
29
|
-
visitFunction?: (node: IntrospectedFunction) => IntrospectedFunction;
|
|
30
|
-
visitClassFunction?: <T extends IntrospectedBaseClass | IntrospectedEnum>(node: IntrospectedClassFunction<T>) => IntrospectedClassFunction<T>;
|
|
31
|
-
visitStaticClassFunction?: (node: IntrospectedStaticClassFunction) => IntrospectedStaticClassFunction;
|
|
32
|
-
visitVirtualClassFunction?: (node: IntrospectedVirtualClassFunction) => IntrospectedVirtualClassFunction;
|
|
33
|
-
visitNamespace?: (node: IntrospectedNamespace) => IntrospectedNamespace;
|
|
34
|
-
}
|
|
35
|
-
export declare function visit(namespace: IntrospectedNamespace, visitor: GirVisitor): void;
|
package/lib/visitor.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export class GirVisitor {
|
|
2
|
-
visitType;
|
|
3
|
-
visitCallback;
|
|
4
|
-
visitClassCallback;
|
|
5
|
-
visitAlias;
|
|
6
|
-
visitConstructor;
|
|
7
|
-
visitDirectAllocationConstructor;
|
|
8
|
-
visitConstructorFunction;
|
|
9
|
-
visitRecord;
|
|
10
|
-
visitInterface;
|
|
11
|
-
visitEnumMember;
|
|
12
|
-
visitError;
|
|
13
|
-
visitEnum;
|
|
14
|
-
visitConst;
|
|
15
|
-
visitClass;
|
|
16
|
-
visitParameter;
|
|
17
|
-
visitProperty;
|
|
18
|
-
visitField;
|
|
19
|
-
visitSignal;
|
|
20
|
-
visitFunction;
|
|
21
|
-
visitClassFunction;
|
|
22
|
-
visitStaticClassFunction;
|
|
23
|
-
visitVirtualClassFunction;
|
|
24
|
-
visitNamespace;
|
|
25
|
-
}
|
|
26
|
-
export function visit(namespace, visitor) {
|
|
27
|
-
namespace.accept(visitor);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=visitor.js.map
|
package/lib/visitor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitor.js","sourceRoot":"","sources":["../src/visitor.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAgB,UAAU;IAC5B,SAAS,CAA2C;IACpD,aAAa,CAAuD;IACpE,kBAAkB,CAAiE;IACnF,UAAU,CAAiD;IAC3D,gBAAgB,CAA6D;IAC7E,gCAAgC,CAEY;IAC5C,wBAAwB,CAA6D;IACrF,WAAW,CAAmD;IAC9D,cAAc,CAAyD;IACvE,eAAe,CAAyC;IACxD,UAAU,CAAiD;IAC3D,SAAS,CAA+C;IACxD,UAAU,CAAuD;IACjE,UAAU,CAAiD;IAC3D,cAAc,CAAyE;IACvF,aAAa,CAAuD;IACpE,UAAU,CAAiD;IAC3D,WAAW,CAAkF;IAC7F,aAAa,CAAuD;IACpE,kBAAkB,CAEe;IACjC,wBAAwB,CAA6E;IACrG,yBAAyB,CAA+E;IACxG,cAAc,CAAyD;CAC1E;AAED,MAAM,UAAU,KAAK,CAAC,SAAgC,EAAE,OAAmB;IACvE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC"}
|