@ts-for-gir/cli 4.0.0-rc.15 → 4.0.0-rc.17

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/bin/ts-for-gir CHANGED
@@ -29,9 +29,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  mod
30
30
  ));
31
31
 
32
- // ../../.yarn/cache/lodash-npm-4.18.1-a64c3070ac-306fea53df.zip/node_modules/lodash/lodash.js
32
+ // ../../node_modules/lodash/lodash.js
33
33
  var require_lodash = __commonJS({
34
- "../../.yarn/cache/lodash-npm-4.18.1-a64c3070ac-306fea53df.zip/node_modules/lodash/lodash.js"(exports2, module) {
34
+ "../../node_modules/lodash/lodash.js"(exports2, module) {
35
35
  (function() {
36
36
  var undefined2;
37
37
  var VERSION = "4.18.1";
@@ -5527,9 +5527,9 @@ var require_lodash = __commonJS({
5527
5527
  }
5528
5528
  });
5529
5529
 
5530
- // ../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js
5530
+ // ../../node_modules/lunr/lunr.js
5531
5531
  var require_lunr = __commonJS({
5532
- "../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js"(exports2, module) {
5532
+ "../../node_modules/lunr/lunr.js"(exports2, module) {
5533
5533
  (function() {
5534
5534
  var lunr2 = function(config) {
5535
5535
  var builder9 = new lunr2.Builder();
@@ -7268,7 +7268,7 @@ import { dirname, join } from "node:path";
7268
7268
  import { fileURLToPath } from "node:url";
7269
7269
  function getPackageVersion() {
7270
7270
  if (true) {
7271
- return "4.0.0-rc.15";
7271
+ return "4.0.0-rc.17";
7272
7272
  }
7273
7273
  const currentModulePath = fileURLToPath(import.meta.url);
7274
7274
  const currentDir = dirname(currentModulePath);
@@ -8165,7 +8165,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8165
8165
  var NEW_LINE_REG_EXP = /[\n\r]+/g;
8166
8166
  function getPackageVersion2() {
8167
8167
  if (true) {
8168
- return "4.0.0-rc.15";
8168
+ return "4.0.0-rc.17";
8169
8169
  }
8170
8170
  try {
8171
8171
  const currentModulePath = fileURLToPath2(import.meta.url);
@@ -8201,7 +8201,7 @@ __export(parser_exports, {
8201
8201
  parseGir: () => parseGir
8202
8202
  });
8203
8203
 
8204
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/util.js
8204
+ // ../../node_modules/fast-xml-parser/src/util.js
8205
8205
  var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
8206
8206
  var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
8207
8207
  var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
@@ -8242,7 +8242,7 @@ var DANGEROUS_PROPERTY_NAMES = [
8242
8242
  ];
8243
8243
  var criticalProperties = ["__proto__", "constructor", "prototype"];
8244
8244
 
8245
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/validator.js
8245
+ // ../../node_modules/fast-xml-parser/src/validator.js
8246
8246
  var defaultOptions = {
8247
8247
  allowBooleanAttributes: false,
8248
8248
  //A tag can have attributes without any value
@@ -8548,7 +8548,7 @@ function getPositionFromMatch(match) {
8548
8548
  return match.startIndex + match[1].length;
8549
8549
  }
8550
8550
 
8551
- // ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/entities.js
8551
+ // ../../node_modules/@nodable/entities/src/entities.js
8552
8552
  var BASIC_LATIN = {
8553
8553
  amp: "&",
8554
8554
  AMP: "&",
@@ -9648,7 +9648,7 @@ var COMMON_HTML = {
9648
9648
  frac34: "\xBE"
9649
9649
  };
9650
9650
 
9651
- // ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/EntityDecoder.js
9651
+ // ../../node_modules/@nodable/entities/src/EntityDecoder.js
9652
9652
  var SPECIAL_CHARS = new Set("!?\\\\/[]$%{}^&*()<>|+");
9653
9653
  function validateEntityName(name) {
9654
9654
  if (name[0] === "#") {
@@ -10017,7 +10017,7 @@ var EntityDecoder = class {
10017
10017
  }
10018
10018
  };
10019
10019
 
10020
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
10020
+ // ../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
10021
10021
  var defaultOnDangerousProperty = (name) => {
10022
10022
  if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
10023
10023
  return "__" + name;
@@ -10151,7 +10151,7 @@ var buildOptions = function(options2) {
10151
10151
  return built;
10152
10152
  };
10153
10153
 
10154
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
10154
+ // ../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
10155
10155
  var METADATA_SYMBOL;
10156
10156
  if (typeof Symbol !== "function") {
10157
10157
  METADATA_SYMBOL = "@@xmlMetadata";
@@ -10185,11 +10185,37 @@ var XmlNode = class {
10185
10185
  }
10186
10186
  };
10187
10187
 
10188
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
10188
+ // ../../node_modules/xml-naming/src/index.js
10189
+ var nameStartChar10 = ":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
10190
+ var nameChar10 = nameStartChar10 + "\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040";
10191
+ var nameStartChar11 = ":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";
10192
+ var nameChar11 = nameStartChar11 + "\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040";
10193
+ var buildRegexes = (startChar, char, flags = "") => {
10194
+ const ncStart = startChar.replace(":", "");
10195
+ const ncChar = char.replace(":", "");
10196
+ const ncNamePat = `[${ncStart}][${ncChar}]*`;
10197
+ return {
10198
+ name: new RegExp(`^[${startChar}][${char}]*$`, flags),
10199
+ ncName: new RegExp(`^${ncNamePat}$`, flags),
10200
+ qName: new RegExp(`^${ncNamePat}(?::${ncNamePat})?$`, flags),
10201
+ nmToken: new RegExp(`^[${char}]+$`, flags),
10202
+ nmTokens: new RegExp(`^[${char}]+(?:\\s+[${char}]+)*$`, flags)
10203
+ };
10204
+ };
10205
+ var regexes10 = buildRegexes(nameStartChar10, nameChar10);
10206
+ var regexes11 = buildRegexes(nameStartChar11, nameChar11, "u");
10207
+ var getRegexes = (xmlVersion = "1.0") => xmlVersion === "1.1" ? regexes11 : regexes10;
10208
+ var qName = (str, { xmlVersion = "1.0" } = {}) => getRegexes(xmlVersion).qName.test(str);
10209
+
10210
+ // ../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
10189
10211
  var DocTypeReader = class {
10190
- constructor(options2) {
10212
+ constructor(options2, xmlVersion) {
10191
10213
  this.suppressValidationErr = !options2;
10192
10214
  this.options = options2;
10215
+ this.xmlVersion = xmlVersion || 1;
10216
+ }
10217
+ setXmlVersion(xmlVersion = 1) {
10218
+ this.xmlVersion = xmlVersion;
10193
10219
  }
10194
10220
  readDocType(xmlData, i) {
10195
10221
  const entities = /* @__PURE__ */ Object.create(null);
@@ -10261,7 +10287,7 @@ var DocTypeReader = class {
10261
10287
  i++;
10262
10288
  }
10263
10289
  let entityName = xmlData.substring(startIndex, i);
10264
- validateEntityName2(entityName);
10290
+ validateEntityName2(entityName, { xmlVersion: this.xmlVersion });
10265
10291
  i = skipWhitespace(xmlData, i);
10266
10292
  if (!this.suppressValidationErr) {
10267
10293
  if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
@@ -10287,7 +10313,7 @@ var DocTypeReader = class {
10287
10313
  i++;
10288
10314
  }
10289
10315
  let notationName = xmlData.substring(startIndex, i);
10290
- !this.suppressValidationErr && validateEntityName2(notationName);
10316
+ !this.suppressValidationErr && validateEntityName2(notationName, { xmlVersion: this.xmlVersion });
10291
10317
  i = skipWhitespace(xmlData, i);
10292
10318
  const identifierType = xmlData.substring(i, i + 6).toUpperCase();
10293
10319
  if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
@@ -10336,7 +10362,7 @@ var DocTypeReader = class {
10336
10362
  i++;
10337
10363
  }
10338
10364
  let elementName = xmlData.substring(startIndex, i);
10339
- if (!this.suppressValidationErr && !isName(elementName)) {
10365
+ if (!this.suppressValidationErr && !qName(elementName, { xmlVersion: this.xmlVersion })) {
10340
10366
  throw new Error(`Invalid element name: "${elementName}"`);
10341
10367
  }
10342
10368
  i = skipWhitespace(xmlData, i);
@@ -10369,14 +10395,14 @@ var DocTypeReader = class {
10369
10395
  i++;
10370
10396
  }
10371
10397
  let elementName = xmlData.substring(startIndex, i);
10372
- validateEntityName2(elementName);
10398
+ validateEntityName2(elementName, { xmlVersion: this.xmlVersion });
10373
10399
  i = skipWhitespace(xmlData, i);
10374
10400
  startIndex = i;
10375
10401
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
10376
10402
  i++;
10377
10403
  }
10378
10404
  let attributeName = xmlData.substring(startIndex, i);
10379
- if (!validateEntityName2(attributeName)) {
10405
+ if (!validateEntityName2(attributeName, { xmlVersion: this.xmlVersion })) {
10380
10406
  throw new Error(`Invalid attribute name: "${attributeName}"`);
10381
10407
  }
10382
10408
  i = skipWhitespace(xmlData, i);
@@ -10397,7 +10423,7 @@ var DocTypeReader = class {
10397
10423
  }
10398
10424
  let notation = xmlData.substring(startIndex2, i);
10399
10425
  notation = notation.trim();
10400
- if (!validateEntityName2(notation)) {
10426
+ if (!validateEntityName2(notation, { xmlVersion: this.xmlVersion })) {
10401
10427
  throw new Error(`Invalid notation name: "${notation}"`);
10402
10428
  }
10403
10429
  allowedNotations.push(notation);
@@ -10454,19 +10480,22 @@ function hasSeq(data, seq, i) {
10454
10480
  }
10455
10481
  return true;
10456
10482
  }
10457
- function validateEntityName2(name) {
10458
- if (isName(name))
10483
+ function validateEntityName2(name, xmlVersion) {
10484
+ if (qName(name, { xmlVersion }))
10459
10485
  return name;
10460
10486
  else
10461
10487
  throw new Error(`Invalid entity name ${name}`);
10462
10488
  }
10463
10489
 
10464
- // ../../.yarn/cache/strnum-npm-2.2.3-3aa06fd3c4-fb70206301.zip/node_modules/strnum/strnum.js
10490
+ // ../../node_modules/strnum/strnum.js
10465
10491
  var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
10492
+ var binRegex = /^0b[01]+$/;
10493
+ var octRegex = /^0o[0-7]+$/;
10466
10494
  var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
10467
10495
  var consider = {
10468
10496
  hex: true,
10469
- // oct: false,
10497
+ binary: false,
10498
+ octal: false,
10470
10499
  leadingZeros: true,
10471
10500
  decimalPoint: ".",
10472
10501
  eNotation: true,
@@ -10483,6 +10512,10 @@ function toNumber(str, options2 = {}) {
10483
10512
  else if (trimmedStr === "0") return 0;
10484
10513
  else if (options2.hex && hexRegex.test(trimmedStr)) {
10485
10514
  return parse_int(trimmedStr, 16);
10515
+ } else if (options2.binary && binRegex.test(trimmedStr)) {
10516
+ return parse_int(trimmedStr, 2);
10517
+ } else if (options2.octal && octRegex.test(trimmedStr)) {
10518
+ return parse_int(trimmedStr, 8);
10486
10519
  } else if (!isFinite(trimmedStr)) {
10487
10520
  return handleInfinity(str, Number(trimmedStr), options2);
10488
10521
  } else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
@@ -10562,6 +10595,8 @@ function trimZeros(numStr) {
10562
10595
  return numStr;
10563
10596
  }
10564
10597
  function parse_int(numStr, base) {
10598
+ const str = numStr.trim();
10599
+ if (base === 2 || base === 8) numStr = str.substring(2);
10565
10600
  if (parseInt) return parseInt(numStr, base);
10566
10601
  else if (Number.parseInt) return Number.parseInt(numStr, base);
10567
10602
  else if (window && window.parseInt) return window.parseInt(numStr, base);
@@ -10583,7 +10618,7 @@ function handleInfinity(str, num, options2) {
10583
10618
  }
10584
10619
  }
10585
10620
 
10586
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
10621
+ // ../../node_modules/fast-xml-parser/src/ignoreAttributes.js
10587
10622
  function getIgnoreAttributesFn(ignoreAttributes) {
10588
10623
  if (typeof ignoreAttributes === "function") {
10589
10624
  return ignoreAttributes;
@@ -10603,7 +10638,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
10603
10638
  return () => false;
10604
10639
  }
10605
10640
 
10606
- // ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Expression.js
10641
+ // ../../node_modules/path-expression-matcher/src/Expression.js
10607
10642
  var Expression = class {
10608
10643
  /**
10609
10644
  * Create a new Expression
@@ -10766,7 +10801,7 @@ var Expression = class {
10766
10801
  }
10767
10802
  };
10768
10803
 
10769
- // ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/ExpressionSet.js
10804
+ // ../../node_modules/path-expression-matcher/src/ExpressionSet.js
10770
10805
  var ExpressionSet = class {
10771
10806
  constructor() {
10772
10807
  this._byDepthAndTag = /* @__PURE__ */ new Map();
@@ -10921,7 +10956,7 @@ var ExpressionSet = class {
10921
10956
  }
10922
10957
  };
10923
10958
 
10924
- // ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Matcher.js
10959
+ // ../../node_modules/path-expression-matcher/src/Matcher.js
10925
10960
  var MatcherView = class {
10926
10961
  /**
10927
10962
  * @param {Matcher} matcher - The parent Matcher instance to read from.
@@ -11371,7 +11406,7 @@ var Matcher = class {
11371
11406
  }
11372
11407
  };
11373
11408
 
11374
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
11409
+ // ../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
11375
11410
  function extractRawAttributes(prefixedAttrs, options2) {
11376
11411
  if (!prefixedAttrs) return {};
11377
11412
  const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
@@ -11602,6 +11637,7 @@ var parseXml = function(xmlData) {
11602
11637
  if (attsMap) {
11603
11638
  const ver = attsMap[this.options.attributeNamePrefix + "version"];
11604
11639
  this.entityDecoder.setXmlVersion(Number(ver) || 1);
11640
+ docTypeReader.setXmlVersion(Number(ver) || 1);
11605
11641
  }
11606
11642
  if (options2.ignoreDeclaration && tagData.tagName === "?xml" || options2.ignorePiTags) {
11607
11643
  } else {
@@ -11951,7 +11987,7 @@ function sanitizeName(name, options2) {
11951
11987
  return name;
11952
11988
  }
11953
11989
 
11954
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
11990
+ // ../../node_modules/fast-xml-parser/src/xmlparser/node2json.js
11955
11991
  var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
11956
11992
  function stripAttributePrefix(attrs, prefix) {
11957
11993
  if (!attrs || typeof attrs !== "object") return {};
@@ -12063,7 +12099,7 @@ function isLeafTag(obj, options2) {
12063
12099
  return false;
12064
12100
  }
12065
12101
 
12066
- // ../../.yarn/cache/fast-xml-parser-npm-5.7.3-ba5bbbdf2c-00a58655d0.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
12102
+ // ../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
12067
12103
  var XMLParser = class {
12068
12104
  constructor(options2) {
12069
12105
  this.externalEntities = {};
@@ -13247,9 +13283,9 @@ var NativeType = class _NativeType extends TypeExpression {
13247
13283
  };
13248
13284
  var OrType = class _OrType extends TypeExpression {
13249
13285
  types;
13250
- constructor(type, ...types) {
13286
+ constructor(...types) {
13251
13287
  super();
13252
- this.types = [type, ...types];
13288
+ this.types = [...types];
13253
13289
  }
13254
13290
  rewrap(type) {
13255
13291
  return type;
@@ -13258,14 +13294,13 @@ var OrType = class _OrType extends TypeExpression {
13258
13294
  return this;
13259
13295
  }
13260
13296
  resolve(namespace, options2) {
13261
- const [type, ...types] = this.types;
13262
- return new _OrType(type.resolve(namespace, options2), ...types.map((t) => t.resolve(namespace, options2)));
13297
+ return makeUnion(...this.types.map((t) => t.resolve(namespace, options2)));
13263
13298
  }
13264
13299
  print(namespace, options2) {
13265
- return `(${this.types.map((t) => t.print(namespace, options2)).join(" | ")})`;
13300
+ return `${this.types.map((t) => t.print(namespace, options2)).join(" | ")}`;
13266
13301
  }
13267
13302
  rootPrint(namespace, options2) {
13268
- return `${this.types.map((t) => t.print(namespace, options2)).join(" | ")}`;
13303
+ return this.print(namespace, options2);
13269
13304
  }
13270
13305
  equals(type) {
13271
13306
  if (type instanceof _OrType) {
@@ -13275,6 +13310,35 @@ var OrType = class _OrType extends TypeExpression {
13275
13310
  }
13276
13311
  }
13277
13312
  };
13313
+ function makeUnion(...inputTypes) {
13314
+ const types = /* @__PURE__ */ new Set();
13315
+ for (const type of inputTypes) {
13316
+ if (type instanceof BinaryType) {
13317
+ types.add(type.a);
13318
+ types.add(type.b);
13319
+ } else if (type instanceof OrType && !(type instanceof TupleType)) {
13320
+ for (const t of type.types) {
13321
+ types.add(t);
13322
+ }
13323
+ } else {
13324
+ types.add(type);
13325
+ }
13326
+ }
13327
+ if (types.size === 1) {
13328
+ return [...types][0];
13329
+ }
13330
+ if (types.size === 2) {
13331
+ const typesArray = [...types];
13332
+ if (typesArray[0] === NullType) {
13333
+ return new NullableType(typesArray[1]);
13334
+ }
13335
+ if (typesArray[1] === NullType) {
13336
+ return new NullableType(typesArray[0]);
13337
+ }
13338
+ return new BinaryType(...typesArray);
13339
+ }
13340
+ return new OrType(...types);
13341
+ }
13278
13342
  var TupleType = class _TupleType extends OrType {
13279
13343
  print(namespace, options2) {
13280
13344
  return `[${this.types.map((t) => t.print(namespace, options2)).join(", ")}]`;
@@ -13460,9 +13524,10 @@ var NullableType = class extends BinaryType {
13460
13524
  }
13461
13525
  };
13462
13526
  function makeNullable(type) {
13527
+ if (type instanceof NullableType) return type;
13463
13528
  if (type === RawPointerType) return NullType;
13464
13529
  if (type === AnyType) return AnyType;
13465
- return new NullableType(type);
13530
+ return makeUnion(type, NullType);
13466
13531
  }
13467
13532
  var PromiseType = class _PromiseType extends TypeExpression {
13468
13533
  type;
@@ -13607,6 +13672,8 @@ var ArrayType = class _ArrayType extends TypeExpression {
13607
13672
  } else {
13608
13673
  typeSuffix = "".padStart(2 * depth, "[]");
13609
13674
  }
13675
+ if (this.type instanceof OrType && !(this.type instanceof TupleType))
13676
+ return `(${this.type.print(namespace, options2)})${typeSuffix}`;
13610
13677
  return `${this.type.print(namespace, options2)}${typeSuffix}`;
13611
13678
  }
13612
13679
  static new({
@@ -13788,16 +13855,16 @@ function resolvePrimitiveType(name) {
13788
13855
  function resolveDirectedType(type, direction) {
13789
13856
  if (type instanceof ArrayType) {
13790
13857
  if ((direction === "in" /* In */ || direction === "inout" /* Inout */) && type.type.equals(Uint8ArrayType) && type.arrayDepth === 0) {
13791
- return new BinaryType(type, StringType);
13858
+ return makeUnion(type, StringType);
13792
13859
  } else {
13793
13860
  return type.rewrap(resolveDirectedType(type.type, direction) ?? type.type);
13794
13861
  }
13795
13862
  } else if (type instanceof TypeIdentifier) {
13796
13863
  if ((direction === "in" /* In */ || direction === "inout" /* Inout */) && type.is("GLib", "Bytes")) {
13797
- return new BinaryType(type, Uint8ArrayType);
13864
+ return makeUnion(type, Uint8ArrayType);
13798
13865
  } else if (type.is("GObject", "Value")) {
13799
13866
  if (direction === "in" /* In */ || direction === "inout" /* Inout */) {
13800
- return new BinaryType(type, AnyType);
13867
+ return makeUnion(type, AnyType);
13801
13868
  } else {
13802
13869
  return UnknownType;
13803
13870
  }
@@ -13818,11 +13885,7 @@ function resolveDirectedType(type, direction) {
13818
13885
  } else if (type instanceof BinaryType && !(type instanceof NullableType)) {
13819
13886
  const a = resolveDirectedType(type.a, direction) ?? type.a;
13820
13887
  const b = resolveDirectedType(type.b, direction) ?? type.b;
13821
- if (a !== type.a || b !== type.b) return new BinaryType(a, b);
13822
- } else if (type instanceof OrType && !(type instanceof BinaryType || type instanceof TupleType)) {
13823
- const types = type.types.map((t) => resolveDirectedType(t, direction) ?? t);
13824
- if (types.length === 1) return types[0];
13825
- return new OrType(types[0], ...types.slice(1));
13888
+ if (a !== type.a || b !== type.b) return makeUnion(a, b);
13826
13889
  }
13827
13890
  return null;
13828
13891
  }
@@ -17494,7 +17557,7 @@ function promisifyNamespaceFunctions(namespace) {
17494
17557
  parameters: sync_parameters
17495
17558
  }),
17496
17559
  node.copy({
17497
- return_type: new BinaryType(async_return, node.return())
17560
+ return_type: makeUnion(async_return, node.return())
17498
17561
  })
17499
17562
  ]);
17500
17563
  }
@@ -17514,7 +17577,7 @@ function generatePromisifyOverloadedSignatures(node, async_parameters, sync_para
17514
17577
  });
17515
17578
  const unionOverload = node.copy({
17516
17579
  parameters: [...async_parameters, sync_parameters[sync_parameters.length - 1].copy({ isOptional: true })],
17517
- returnType: new BinaryType(async_return, VoidType)
17580
+ returnType: makeUnion(async_return, VoidType)
17518
17581
  });
17519
17582
  return [promiseOverload, callbackOverload, unionOverload];
17520
17583
  }
@@ -20099,8 +20162,10 @@ var shellTemplate = (version) => ({
20099
20162
  const addGlslSnippet = GLSLEffect.members.find((m) => m.name === "add_glsl_snippet");
20100
20163
  if (addGlslSnippet) {
20101
20164
  const updatedParameter = addGlslSnippet.parameters[0].copy({
20102
- type: new NullableType(
20103
- new OrType(new TypeIdentifier("SnippetHook", "Shell"), new TypeIdentifier("SnippetHook", "Cogl"))
20165
+ type: makeUnion(
20166
+ new TypeIdentifier("SnippetHook", "Shell"),
20167
+ new TypeIdentifier("SnippetHook", "Cogl"),
20168
+ NullType
20104
20169
  )
20105
20170
  });
20106
20171
  addGlslSnippet.parameters[0] = updatedParameter;
@@ -21393,8 +21458,8 @@ var createOptions = {
21393
21458
  template: {
21394
21459
  type: "string",
21395
21460
  alias: "t",
21396
- description: "Template to scaffold (types-locally, types-npm, types-workspace)",
21397
- choices: ["types-locally", "types-npm", "types-workspace"]
21461
+ description: "Template to scaffold (types-locally, types-npm, types-workspace, types-gjsify)",
21462
+ choices: ["types-locally", "types-npm", "types-workspace", "types-gjsify"]
21398
21463
  },
21399
21464
  install: {
21400
21465
  type: "boolean",
@@ -22499,7 +22564,8 @@ import { input, select as select2 } from "@inquirer/prompts";
22499
22564
  var command3 = "create [name]";
22500
22565
  var description3 = "Scaffold a new GJS TypeScript project from a template";
22501
22566
  var examples3 = [
22502
- [`${APP_NAME} create my-app --template types-npm`, "Scaffold using the @girs/* NPM types"],
22567
+ [`${APP_NAME} create my-app --template types-gjsify`, "Scaffold a Node-free GJS app via gjsify (recommended)"],
22568
+ [`${APP_NAME} create my-app --template types-npm`, "Scaffold using the @girs/* NPM types + node/esbuild"],
22503
22569
  [`${APP_NAME} create my-app --template types-locally`, "Scaffold and generate types into ./@types/ locally"],
22504
22570
  [
22505
22571
  `${APP_NAME} create my-app --template types-workspace`,
@@ -22509,15 +22575,20 @@ var examples3 = [
22509
22575
  ];
22510
22576
  var TEMPLATE_CHOICES = [
22511
22577
  {
22512
- value: "types-locally",
22513
- name: "types-locally",
22514
- description: "Generate GIR types directly into ./@types/ (no package format, no @girs/* deps)"
22578
+ value: "types-gjsify",
22579
+ name: "types-gjsify",
22580
+ description: "Node-free: @girs/* from NPM, all dev scripts (install/build/run/format) routed through gjsify"
22515
22581
  },
22516
22582
  {
22517
22583
  value: "types-npm",
22518
22584
  name: "types-npm",
22519
22585
  description: "Use pre-generated types from the @girs/* NPM packages"
22520
22586
  },
22587
+ {
22588
+ value: "types-locally",
22589
+ name: "types-locally",
22590
+ description: "Generate GIR types directly into ./@types/ (no package format, no @girs/* deps)"
22591
+ },
22521
22592
  {
22522
22593
  value: "types-workspace",
22523
22594
  name: "types-workspace",
@@ -22656,18 +22727,26 @@ var handler3 = async (args) => {
22656
22727
  walkAndSubstitute(targetDir, projectName);
22657
22728
  log3.success(`Scaffolded ${template2} into ${targetDir}`);
22658
22729
  if (opts.install) {
22659
- log3.info("Running npm install...");
22660
- const result = spawnSync("npm", ["install", "--no-audit", "--no-fund"], {
22730
+ const installer = template2 === "types-gjsify" ? "gjsify" : "npm";
22731
+ const installerArgs = template2 === "types-gjsify" ? ["install"] : ["install", "--no-audit", "--no-fund"];
22732
+ log3.info(`Running ${installer} install...`);
22733
+ const result = spawnSync(installer, installerArgs, {
22661
22734
  cwd: targetDir,
22662
22735
  stdio: "inherit"
22663
22736
  });
22664
22737
  if (result.status !== 0) {
22665
- log3.warn("npm install failed; you can re-run it manually in the project directory.");
22738
+ log3.warn(`${installer} install failed; you can re-run it manually in the project directory.`);
22666
22739
  }
22667
22740
  }
22668
22741
  log3.info("\nNext steps:");
22669
22742
  log3.white(` cd ${projectName}`);
22670
- if (!opts.install) log3.white(" npm install");
22743
+ if (!opts.install) {
22744
+ if (template2 === "types-gjsify") {
22745
+ log3.white(" gjsify install");
22746
+ } else {
22747
+ log3.white(" npm install");
22748
+ }
22749
+ }
22671
22750
  switch (template2) {
22672
22751
  case "types-locally":
22673
22752
  log3.white(" npm run generate");
@@ -22682,6 +22761,10 @@ var handler3 = async (args) => {
22682
22761
  log3.white(" npm run build:types && npm install");
22683
22762
  log3.white(" npm run build:app && npm start");
22684
22763
  break;
22764
+ case "types-gjsify":
22765
+ log3.white(" gjsify run check");
22766
+ log3.white(" gjsify run build && gjsify run start");
22767
+ break;
22685
22768
  }
22686
22769
  };
22687
22770
  var create = {
@@ -23077,23 +23160,27 @@ var SignalGenerator = class {
23077
23160
  return interfaceTypeIdentifier ? `${interfaceTypeIdentifier}.SignalSignatures` : null;
23078
23161
  }).filter((sig) => !!sig);
23079
23162
  parentSignatures.push(...interfaceSignatures);
23080
- let signatureHead;
23163
+ let signatureDecl;
23081
23164
  if (parentSignatures.length > 0) {
23082
- signatureHead = `${indent}interface SignalSignatures extends ${parentSignatures.join(", ")} {`;
23165
+ signatureDecl = `interface SignalSignatures extends ${parentSignatures.join(", ")}`;
23083
23166
  } else {
23084
23167
  const isGObjectObject = girClass.name === "Object" && girClass.namespace.namespace === "GObject";
23085
23168
  if (isGObjectObject) {
23086
- signatureHead = `${indent}interface SignalSignatures {`;
23169
+ signatureDecl = `interface SignalSignatures`;
23087
23170
  } else {
23088
23171
  const gobjectNamespace = this.namespace.assertInstalledImport("GObject");
23089
23172
  const gobjectObjectClass = gobjectNamespace.assertClass("Object");
23090
23173
  const gobjectRef = gobjectObjectClass.getType().resolveIdentifier(this.namespace, this.config)?.print(this.namespace, this.config);
23091
23174
  const fallbackRef = gobjectRef ? `${gobjectRef}.SignalSignatures` : "GObject.Object.SignalSignatures";
23092
- signatureHead = `${indent}interface SignalSignatures extends ${fallbackRef} {`;
23175
+ signatureDecl = `interface SignalSignatures extends ${fallbackRef}`;
23093
23176
  }
23094
23177
  }
23095
- def.push(signatureHead);
23096
23178
  const allSignals = girClass.getAllSignals();
23179
+ if (allSignals.length === 0) {
23180
+ def.push(`${indent}${signatureDecl} {}`);
23181
+ return def;
23182
+ }
23183
+ def.push(`${indent}${signatureDecl} {`);
23097
23184
  allSignals.forEach((signalInfo) => {
23098
23185
  let cbType;
23099
23186
  if (signalInfo.isNotifySignal) {
@@ -23434,6 +23521,9 @@ var ModuleGenerator = class _ModuleGenerator extends FormatGenerator {
23434
23521
  }
23435
23522
  generateDirectAllocationConstructor(node, indentCount = 1) {
23436
23523
  const indent = generateIndent(indentCount);
23524
+ if (node.parameters.length === 0) {
23525
+ return [`${indent}constructor(properties?: Partial<{}>);`];
23526
+ }
23437
23527
  const fieldIndent = generateIndent(indentCount + 1);
23438
23528
  const constructorFields = node.parameters.flatMap((param) => param.asField().asString(this)).flatMap((line) => line.split("\n")).map((line) => line.replace(/^\s+/, "")).filter((line) => line.length > 0).map((line) => `${fieldIndent}${line}`).join("\n");
23439
23529
  return ["", `${indent}constructor(properties?: Partial<{`, constructorFields, `${indent}}>);`];
@@ -23542,7 +23632,7 @@ var ModuleGenerator = class _ModuleGenerator extends FormatGenerator {
23542
23632
  parameters: [
23543
23633
  new IntrospectedFunctionParameter({
23544
23634
  name: "options",
23545
- type: NativeType.of("{ message: string, code: number }"),
23635
+ type: NativeType.of("{ message: string; code: number }"),
23546
23636
  direction: "in" /* In */
23547
23637
  })
23548
23638
  ],
@@ -23610,24 +23700,24 @@ var ModuleGenerator = class _ModuleGenerator extends FormatGenerator {
23610
23700
  case 3 /* FUNCTION_NAME_CONFLICT */:
23611
23701
  case 2 /* FIELD_NAME_CONFLICT */:
23612
23702
  getterSetterAnnotation = setterAnnotation = "// This accessor conflicts with a field or function name in a parent class or interface.\n";
23613
- type = new BinaryType(type.unwrap(), AnyType);
23703
+ type = makeUnion(type.unwrap(), AnyType);
23614
23704
  printAsProperty = true;
23615
23705
  break;
23616
23706
  case 4 /* ACCESSOR_PROPERTY_CONFLICT */:
23617
23707
  getterSetterAnnotation = getterAnnotation = "// This accessor conflicts with a property or field in a parent class or interface.\n";
23618
- type = new BinaryType(type.unwrap(), AnyType);
23708
+ type = makeUnion(type.unwrap(), AnyType);
23619
23709
  printAsProperty = true;
23620
23710
  break;
23621
23711
  case 5 /* PROPERTY_ACCESSOR_CONFLICT */:
23622
- type = new BinaryType(type.unwrap(), AnyType);
23712
+ type = makeUnion(type.unwrap(), AnyType);
23623
23713
  break;
23624
23714
  case 1 /* PROPERTY_NAME_CONFLICT */:
23625
23715
  getterSetterAnnotation = setterAnnotation = getterAnnotation = "// This accessor conflicts with another accessor's type in a parent class or interface.\n";
23626
- type = new BinaryType(type.unwrap(), AnyType);
23716
+ type = makeUnion(type.unwrap(), AnyType);
23627
23717
  break;
23628
23718
  }
23629
23719
  if (construct && !(type instanceof BinaryType)) {
23630
- type = new BinaryType(type instanceof TypeConflict ? type.unwrap() : type, AnyType);
23720
+ type = makeUnion(type instanceof TypeConflict ? type.unwrap() : type, AnyType);
23631
23721
  }
23632
23722
  }
23633
23723
  const Type = type.resolve(this.namespace, this.options).rootPrint(this.namespace, this.options) || "any";
@@ -23674,7 +23764,7 @@ var ModuleGenerator = class _ModuleGenerator extends FormatGenerator {
23674
23764
  type = type.unwrap();
23675
23765
  } else if (type.conflictType === 3 /* FUNCTION_NAME_CONFLICT */) {
23676
23766
  commentOut = "\n// This field conflicts with a function in a parent class or interface.\n";
23677
- type = new BinaryType(type.unwrap(), AnyType);
23767
+ type = makeUnion(type.unwrap(), AnyType);
23678
23768
  } else {
23679
23769
  type = type.unwrap();
23680
23770
  }
@@ -24101,6 +24191,10 @@ var ModuleGenerator = class _ModuleGenerator extends FormatGenerator {
24101
24191
  const { props } = girClass;
24102
24192
  const memberIndent = generateIndent(indentCount + 1);
24103
24193
  const constructorPropMembers = filterConflicts(girClass.namespace, girClass, props, 1 /* PRESERVE */).flatMap((v) => v.asString(this, true)).map((m) => `${memberIndent}${m}`).join("\n");
24194
+ if (constructorPropMembers.length === 0) {
24195
+ def.push(`${indent}${exp}interface ${constructPropInterfaceName}${genericTypes} ${ext} {}`);
24196
+ return def;
24197
+ }
24104
24198
  def.push(`${indent}${exp}interface ${constructPropInterfaceName}${genericTypes} ${ext} {`);
24105
24199
  def.push(constructorPropMembers);
24106
24200
  def.push(`${indent}}`);
@@ -27795,7 +27889,7 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
27795
27889
  import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind5 } from "typedoc";
27796
27890
  function getTsForGirVersion() {
27797
27891
  if (true) {
27798
- return "4.0.0-rc.15";
27892
+ return "4.0.0-rc.17";
27799
27893
  }
27800
27894
  try {
27801
27895
  const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
@@ -28789,7 +28883,8 @@ var selfUpdate = {
28789
28883
 
28790
28884
  // src/start.ts
28791
28885
  try {
28792
- await yargs(hideBin(process.argv)).scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).exitProcess(false).fail(false).command(analyze).command(create).command(generate).command(json2).command(list).command(copy).command(doc).command(selfUpdate).demandCommand(1).help().parseAsync();
28886
+ const cli = yargs(hideBin(process.argv));
28887
+ await cli.scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).wrap(cli.terminalWidth()).exitProcess(false).fail(false).command(analyze).command(create).command(generate).command(json2).command(list).command(copy).command(doc).command(selfUpdate).demandCommand(1).help().parseAsync();
28793
28888
  process.exit(0);
28794
28889
  } catch (err) {
28795
28890
  const message = err instanceof Error ? err.message : String(err);