@ts-for-gir/cli 4.0.0-beta.42 → 4.0.0-beta.44

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.
Files changed (2) hide show
  1. package/bin/ts-for-gir +60 -46
  2. package/package.json +12 -12
package/bin/ts-for-gir CHANGED
@@ -29,12 +29,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  mod
30
30
  ));
31
31
 
32
- // ../../.yarn/cache/lodash-npm-4.17.23-50bdb1c01a-82504c8825.zip/node_modules/lodash/lodash.js
32
+ // ../../.yarn/cache/lodash-npm-4.17.21-6382451519-c08619c038.zip/node_modules/lodash/lodash.js
33
33
  var require_lodash = __commonJS({
34
- "../../.yarn/cache/lodash-npm-4.17.23-50bdb1c01a-82504c8825.zip/node_modules/lodash/lodash.js"(exports2, module) {
34
+ "../../.yarn/cache/lodash-npm-4.17.21-6382451519-c08619c038.zip/node_modules/lodash/lodash.js"(exports2, module) {
35
35
  (function() {
36
36
  var undefined2;
37
- var VERSION = "4.17.23";
37
+ var VERSION = "4.17.21";
38
38
  var LARGE_ARRAY_SIZE = 200;
39
39
  var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
40
40
  var HASH_UNDEFINED = "__lodash_hash_undefined__";
@@ -1962,28 +1962,8 @@ var require_lodash = __commonJS({
1962
1962
  }
1963
1963
  function baseUnset(object, path) {
1964
1964
  path = castPath(path, object);
1965
- var index = -1, length = path.length;
1966
- if (!length) {
1967
- return true;
1968
- }
1969
- var isRootPrimitive = object == null || typeof object !== "object" && typeof object !== "function";
1970
- while (++index < length) {
1971
- var key = path[index];
1972
- if (typeof key !== "string") {
1973
- continue;
1974
- }
1975
- if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
1976
- return false;
1977
- }
1978
- if (key === "constructor" && index + 1 < length && typeof path[index + 1] === "string" && path[index + 1] === "prototype") {
1979
- if (isRootPrimitive && index === 0) {
1980
- continue;
1981
- }
1982
- return false;
1983
- }
1984
- }
1985
- var obj = parent(object, path);
1986
- return obj == null || delete obj[toKey(last(path))];
1965
+ object = parent(object, path);
1966
+ return object == null || delete object[toKey(last(path))];
1987
1967
  }
1988
1968
  function baseUpdate(object, path, updater, customizer) {
1989
1969
  return baseSet(object, path, updater(baseGet(object, path)), customizer);
@@ -7270,7 +7250,7 @@ import { dirname, join } from "node:path";
7270
7250
  import { fileURLToPath } from "node:url";
7271
7251
  function getPackageVersion() {
7272
7252
  if (true) {
7273
- return "4.0.0-beta.42";
7253
+ return "4.0.0-beta.44";
7274
7254
  }
7275
7255
  const currentModulePath = fileURLToPath(import.meta.url);
7276
7256
  const currentDir = dirname(currentModulePath);
@@ -8166,7 +8146,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8166
8146
  var NEW_LINE_REG_EXP = /[\n\r]+/g;
8167
8147
  function getPackageVersion2() {
8168
8148
  if (true) {
8169
- return "4.0.0-beta.42";
8149
+ return "4.0.0-beta.44";
8170
8150
  }
8171
8151
  const currentModulePath = fileURLToPath2(import.meta.url);
8172
8152
  const currentDir = dirname2(currentModulePath);
@@ -8198,7 +8178,7 @@ __export(parser_exports, {
8198
8178
  parseGir: () => parseGir
8199
8179
  });
8200
8180
 
8201
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/util.js
8181
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/util.js
8202
8182
  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";
8203
8183
  var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
8204
8184
  var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
@@ -8239,7 +8219,7 @@ var DANGEROUS_PROPERTY_NAMES = [
8239
8219
  ];
8240
8220
  var criticalProperties = ["__proto__", "constructor", "prototype"];
8241
8221
 
8242
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/validator.js
8222
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/validator.js
8243
8223
  var defaultOptions = {
8244
8224
  allowBooleanAttributes: false,
8245
8225
  //A tag can have attributes without any value
@@ -8545,7 +8525,7 @@ function getPositionFromMatch(match) {
8545
8525
  return match.startIndex + match[1].length;
8546
8526
  }
8547
8527
 
8548
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
8528
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
8549
8529
  var defaultOnDangerousProperty = (name) => {
8550
8530
  if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
8551
8531
  return "__" + name;
@@ -8675,7 +8655,7 @@ var buildOptions = function(options2) {
8675
8655
  return built;
8676
8656
  };
8677
8657
 
8678
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
8658
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
8679
8659
  var METADATA_SYMBOL;
8680
8660
  if (typeof Symbol !== "function") {
8681
8661
  METADATA_SYMBOL = "@@xmlMetadata";
@@ -8709,7 +8689,7 @@ var XmlNode = class {
8709
8689
  }
8710
8690
  };
8711
8691
 
8712
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
8692
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
8713
8693
  var DocTypeReader = class {
8714
8694
  constructor(options2) {
8715
8695
  this.suppressValidationErr = !options2;
@@ -8989,7 +8969,7 @@ function validateEntityName(name) {
8989
8969
  throw new Error(`Invalid entity name ${name}`);
8990
8970
  }
8991
8971
 
8992
- // ../../.yarn/cache/strnum-npm-2.2.1-b3a08c1c56-c553d83e1a.zip/node_modules/strnum/strnum.js
8972
+ // ../../.yarn/cache/strnum-npm-2.2.2-816fd1e52f-c55813cfde.zip/node_modules/strnum/strnum.js
8993
8973
  var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
8994
8974
  var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
8995
8975
  var consider = {
@@ -9006,8 +8986,9 @@ function toNumber(str, options2 = {}) {
9006
8986
  options2 = Object.assign({}, consider, options2);
9007
8987
  if (!str || typeof str !== "string") return str;
9008
8988
  let trimmedStr = str.trim();
9009
- if (options2.skipLike !== void 0 && options2.skipLike.test(trimmedStr)) return str;
9010
- else if (str === "0") return 0;
8989
+ if (trimmedStr.length === 0) return str;
8990
+ else if (options2.skipLike !== void 0 && options2.skipLike.test(trimmedStr)) return str;
8991
+ else if (trimmedStr === "0") return 0;
9011
8992
  else if (options2.hex && hexRegex.test(trimmedStr)) {
9012
8993
  return parse_int(trimmedStr, 16);
9013
8994
  } else if (!isFinite(trimmedStr)) {
@@ -9110,7 +9091,7 @@ function handleInfinity(str, num, options2) {
9110
9091
  }
9111
9092
  }
9112
9093
 
9113
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
9094
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
9114
9095
  function getIgnoreAttributesFn(ignoreAttributes) {
9115
9096
  if (typeof ignoreAttributes === "function") {
9116
9097
  return ignoreAttributes;
@@ -9664,7 +9645,7 @@ var Matcher = class {
9664
9645
  }
9665
9646
  };
9666
9647
 
9667
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
9648
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
9668
9649
  function extractRawAttributes(prefixedAttrs, options2) {
9669
9650
  if (!prefixedAttrs) return {};
9670
9651
  const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
@@ -10317,7 +10298,7 @@ function sanitizeName(name, options2) {
10317
10298
  return name;
10318
10299
  }
10319
10300
 
10320
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
10301
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
10321
10302
  var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
10322
10303
  function stripAttributePrefix(attrs, prefix) {
10323
10304
  if (!attrs || typeof attrs !== "object") return {};
@@ -10426,7 +10407,7 @@ function isLeafTag(obj, options2) {
10426
10407
  return false;
10427
10408
  }
10428
10409
 
10429
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
10410
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
10430
10411
  var XMLParser = class {
10431
10412
  constructor(options2) {
10432
10413
  this.externalEntities = {};
@@ -10840,7 +10821,7 @@ var printGirDocComment = (tsDoc, config) => {
10840
10821
  }
10841
10822
  return desc.join("\n");
10842
10823
  };
10843
- var isIntrospectable = (e) => !e || !e.$ || !e.$.introspectable || e.$.introspectable === "1";
10824
+ var isIntrospectable = (e) => !e?.$?.introspectable || e.$.introspectable === "1";
10844
10825
  var isDeprecated = (e) => e?.$ && e.$.deprecated === "1";
10845
10826
  var deprecatedVersion = (e) => e?.$?.["deprecated-version"];
10846
10827
  var introducedVersion = (e) => e?.$?.version;
@@ -13404,11 +13385,22 @@ var IntrospectedClass = class _IntrospectedClass extends IntrospectedBaseClass {
13404
13385
  returnType: "void"
13405
13386
  });
13406
13387
  });
13388
+ if (this.isGObjectObject()) {
13389
+ allSignals.push({
13390
+ name: `notify::\${string}`,
13391
+ isNotifySignal: true,
13392
+ isDetailSignal: false,
13393
+ isTemplateLiteral: true,
13394
+ parameterTypes: ["GObject.ParamSpec"],
13395
+ returnType: "void"
13396
+ });
13397
+ }
13407
13398
  }
13408
13399
  addDetailedSignals(allSignals) {
13409
13400
  const propertyNames = this.getUniquePropertyNames();
13410
13401
  this.signals.forEach((signal) => {
13411
13402
  if (signal.detailed) {
13403
+ if (signal.name === "notify") return;
13412
13404
  propertyNames.forEach((propertyName) => {
13413
13405
  allSignals.push({
13414
13406
  name: `${signal.name}::${propertyName}`,
@@ -13419,6 +13411,15 @@ var IntrospectedClass = class _IntrospectedClass extends IntrospectedBaseClass {
13419
13411
  returnType: this.getPropertyTypeString(signal.return_type)
13420
13412
  });
13421
13413
  });
13414
+ allSignals.push({
13415
+ name: `${signal.name}::\${string}`,
13416
+ signal,
13417
+ isNotifySignal: false,
13418
+ isDetailSignal: true,
13419
+ isTemplateLiteral: true,
13420
+ parameterTypes: signal.parameters.map((p) => this.getPropertyTypeString(p.type)),
13421
+ returnType: this.getPropertyTypeString(signal.return_type)
13422
+ });
13422
13423
  }
13423
13424
  });
13424
13425
  }
@@ -17766,7 +17767,7 @@ See https://gjs.guide/guides/gobject/basics.html#properties for more details.`;
17766
17767
  const override3 = new IntrospectedClassFunction({
17767
17768
  parent: ParamSpec,
17768
17769
  name: "override",
17769
- return_type: VoidType,
17770
+ return_type: ParamSpec.getType(),
17770
17771
  parameters: [
17771
17772
  new IntrospectedFunctionParameter({
17772
17773
  direction: "in" /* In */,
@@ -18431,12 +18432,16 @@ function inject(registry) {
18431
18432
  }
18432
18433
 
18433
18434
  // ../lib/src/validators/class.ts
18435
+ var INTROSPECTABLE_EXEMPT_METHODS = /* @__PURE__ */ new Set(["ref", "unref", "copy", "free", "destroy"]);
18434
18436
  var filterIntrospectableClassMembers = (node) => {
18435
18437
  node.fields = node.fields.filter((field) => field.isIntrospectable);
18436
18438
  node.props = node.props.filter((prop) => prop.isIntrospectable);
18437
18439
  node.callbacks = node.callbacks.filter((prop) => prop.isIntrospectable);
18438
18440
  node.constructors = node.constructors.filter((prop) => prop.isIntrospectable);
18439
- node.members = node.members.filter((prop) => prop.isIntrospectable);
18441
+ const isRecord = node instanceof IntrospectedRecord;
18442
+ node.members = node.members.filter(
18443
+ (member) => member.isIntrospectable || isRecord && INTROSPECTABLE_EXEMPT_METHODS.has(member.name)
18444
+ );
18440
18445
  return node;
18441
18446
  };
18442
18447
  var PROTECTED_FIELD_NAMES = ["parent_instance", "parent", "parent_class", "object_class"];
@@ -21024,7 +21029,6 @@ var SignalGenerator = class {
21024
21029
  }
21025
21030
  const allSignals = girClass.getAllSignals();
21026
21031
  allSignals.forEach((signalInfo) => {
21027
- const signalKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(signalInfo.name) ? signalInfo.name : `"${signalInfo.name}"`;
21028
21032
  let cbType;
21029
21033
  if (signalInfo.isNotifySignal) {
21030
21034
  const gobjectRef = this.namespace.namespace === "GObject" ? "" : "GObject.";
@@ -21042,6 +21046,11 @@ var SignalGenerator = class {
21042
21046
  const returnTypeStr = signalInfo.returnType || "void";
21043
21047
  cbType = `(${paramTypes.join(", ")}) => ${returnTypeStr}`;
21044
21048
  }
21049
+ if (signalInfo.isTemplateLiteral) {
21050
+ def.push(`${indent} [key: \`${signalInfo.name}\`]: ${cbType};`);
21051
+ return;
21052
+ }
21053
+ const signalKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(signalInfo.name) ? signalInfo.name : `"${signalInfo.name}"`;
21045
21054
  if (!signalInfo.isNotifySignal && signalInfo.signal) {
21046
21055
  const signalTags = [
21047
21056
  { tagName: "signal", paramName: "", text: "" },
@@ -21459,7 +21468,7 @@ export const ${node.name}: ${node.name}Namespace & {
21459
21468
  parameters: [
21460
21469
  new IntrospectedFunctionParameter({
21461
21470
  name: "options",
21462
- type: NativeType.of("{ message: string, code: number}"),
21471
+ type: NativeType.of("{ message: string, code: number }"),
21463
21472
  direction: "in" /* In */
21464
21473
  })
21465
21474
  ],
@@ -21543,6 +21552,11 @@ export const ${node.name}: ${node.name}Namespace & {
21543
21552
  }
21544
21553
  const Type = type.resolve(this.namespace, this.options).rootPrint(this.namespace, this.options) || "any";
21545
21554
  if (construct) {
21555
+ const unwrapped = type.deepUnwrap();
21556
+ if (unwrapped instanceof TypeIdentifier && unwrapped.is("GObject", "GType")) {
21557
+ const gtypeNamespace = this.namespace.namespace === "GObject" ? "" : "GObject.";
21558
+ return [`${name}: ${gtypeNamespace}GTypeInput;`];
21559
+ }
21546
21560
  return [`${name}: ${Type};`];
21547
21561
  }
21548
21562
  if (printAsProperty) {
@@ -22083,7 +22097,7 @@ export const ${node.name}: ${node.name}Namespace & {
22083
22097
  def.push(...this.generateDirectAllocationConstructor(girClass.mainConstructor));
22084
22098
  else if (girClass.mainConstructor instanceof IntrospectedConstructor)
22085
22099
  def.push(...this.generateConstructor(girClass.mainConstructor));
22086
- else if (girClass.someParent((p) => p.namespace.namespace === "GObject" && p.name === "Object"))
22100
+ else if (girClass.namespace.namespace === "GObject" && girClass.name === "Object" || girClass.someParent((p) => p.namespace.namespace === "GObject" && p.name === "Object"))
22087
22101
  def.push(`
22088
22102
  constructor(properties?: Partial<${girClass.name}.ConstructorProps>, ...args: any[]);
22089
22103
  `);
@@ -24889,7 +24903,7 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
24889
24903
  import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
24890
24904
  function getTsForGirVersion() {
24891
24905
  if (true) {
24892
- return "4.0.0-beta.42";
24906
+ return "4.0.0-beta.44";
24893
24907
  }
24894
24908
  const __dirname3 = dirname7(fileURLToPath4(import.meta.url));
24895
24909
  return JSON.parse(readFileSync6(join13(__dirname3, "..", "..", "package.json"), "utf8")).version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/cli",
3
- "version": "4.0.0-beta.42",
3
+ "version": "4.0.0-beta.44",
4
4
  "description": "TypeScript type definition generator for GObject introspection GIR files",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -52,31 +52,31 @@
52
52
  ".": "./src/index.ts"
53
53
  },
54
54
  "devDependencies": {
55
- "@gi.ts/parser": "^4.0.0-beta.42",
56
- "@ts-for-gir/generator-base": "^4.0.0-beta.42",
57
- "@ts-for-gir/generator-html-doc": "^4.0.0-beta.42",
58
- "@ts-for-gir/generator-json": "^4.0.0-beta.42",
59
- "@ts-for-gir/generator-typescript": "^4.0.0-beta.42",
60
- "@ts-for-gir/lib": "^4.0.0-beta.42",
61
- "@ts-for-gir/reporter": "^4.0.0-beta.42",
62
- "@ts-for-gir/tsconfig": "^4.0.0-beta.42",
55
+ "@gi.ts/parser": "^4.0.0-beta.44",
56
+ "@ts-for-gir/generator-base": "^4.0.0-beta.44",
57
+ "@ts-for-gir/generator-html-doc": "^4.0.0-beta.44",
58
+ "@ts-for-gir/generator-json": "^4.0.0-beta.44",
59
+ "@ts-for-gir/generator-typescript": "^4.0.0-beta.44",
60
+ "@ts-for-gir/lib": "^4.0.0-beta.44",
61
+ "@ts-for-gir/reporter": "^4.0.0-beta.44",
62
+ "@ts-for-gir/tsconfig": "^4.0.0-beta.44",
63
63
  "@types/ejs": "^3.1.5",
64
64
  "@types/inquirer": "^9.0.9",
65
65
  "@types/node": "^24.12.0",
66
66
  "@types/yargs": "^17.0.35",
67
67
  "esbuild": "^0.27.4",
68
- "typescript": "^5.9.3"
68
+ "typescript": "^6.0.2"
69
69
  },
70
70
  "dependencies": {
71
71
  "@inquirer/prompts": "^8.3.2",
72
- "@ts-for-gir/templates": "^4.0.0-beta.42",
72
+ "@ts-for-gir/templates": "^4.0.0-beta.44",
73
73
  "colorette": "^2.0.20",
74
74
  "cosmiconfig": "^9.0.1",
75
75
  "ejs": "^5.0.1",
76
76
  "glob": "^13.0.6",
77
77
  "inquirer": "^13.3.2",
78
78
  "prettier": "^3.8.1",
79
- "typedoc": "^0.28.17",
79
+ "typedoc": "^0.28.18",
80
80
  "yargs": "^18.0.0"
81
81
  }
82
82
  }