gjs-typelib-installer
    Preparing search index...

    Function require

    • Import multiple GObject libraries and return the imported modules.

      Parameters

      • versions: Partial<Record<string, string>>

        An object with namespaces as keys and versions as values.

      Returns Partial<Record<string, any>>

      Imported modules.

      If a known library is not installed, see MissingDependencies.

      If an unknown library is requested.

      /** @import TemplateMod from '@girs/template-1.0' */

      try {
      const {Template} = /** @type {{Template: TemplateMod}} */ (require({Template: '1.0'}));

      const t = Template.Template.new(null);
      t.parse_string('2 + 2 = {{ 2 + 2 }}');
      print(t.expand_string(null));
      } catch (ex) {
      if (!(ex instanceof MissingDependencies))
      throw ex;

      if (ex.packages.size > 0)
      printerr(`Please install the packages: ${[...ex.packages].join(', ')}`);

      if (ex.files.size > 0)
      printerr(`Please install packages that contain the files: ${[...ex.files].join(', ')}`);
      }