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

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 +44 -19
  2. package/package.json +12 -12
package/bin/ts-for-gir CHANGED
@@ -7270,7 +7270,7 @@ import { dirname, join } from "node:path";
7270
7270
  import { fileURLToPath } from "node:url";
7271
7271
  function getPackageVersion() {
7272
7272
  if (true) {
7273
- return "4.0.0-beta.42";
7273
+ return "4.0.0-beta.43";
7274
7274
  }
7275
7275
  const currentModulePath = fileURLToPath(import.meta.url);
7276
7276
  const currentDir = dirname(currentModulePath);
@@ -8166,7 +8166,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8166
8166
  var NEW_LINE_REG_EXP = /[\n\r]+/g;
8167
8167
  function getPackageVersion2() {
8168
8168
  if (true) {
8169
- return "4.0.0-beta.42";
8169
+ return "4.0.0-beta.43";
8170
8170
  }
8171
8171
  const currentModulePath = fileURLToPath2(import.meta.url);
8172
8172
  const currentDir = dirname2(currentModulePath);
@@ -8198,7 +8198,7 @@ __export(parser_exports, {
8198
8198
  parseGir: () => parseGir
8199
8199
  });
8200
8200
 
8201
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/util.js
8201
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/util.js
8202
8202
  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
8203
  var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
8204
8204
  var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
@@ -8239,7 +8239,7 @@ var DANGEROUS_PROPERTY_NAMES = [
8239
8239
  ];
8240
8240
  var criticalProperties = ["__proto__", "constructor", "prototype"];
8241
8241
 
8242
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/validator.js
8242
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/validator.js
8243
8243
  var defaultOptions = {
8244
8244
  allowBooleanAttributes: false,
8245
8245
  //A tag can have attributes without any value
@@ -8545,7 +8545,7 @@ function getPositionFromMatch(match) {
8545
8545
  return match.startIndex + match[1].length;
8546
8546
  }
8547
8547
 
8548
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
8548
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
8549
8549
  var defaultOnDangerousProperty = (name) => {
8550
8550
  if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
8551
8551
  return "__" + name;
@@ -8675,7 +8675,7 @@ var buildOptions = function(options2) {
8675
8675
  return built;
8676
8676
  };
8677
8677
 
8678
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
8678
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
8679
8679
  var METADATA_SYMBOL;
8680
8680
  if (typeof Symbol !== "function") {
8681
8681
  METADATA_SYMBOL = "@@xmlMetadata";
@@ -8709,7 +8709,7 @@ var XmlNode = class {
8709
8709
  }
8710
8710
  };
8711
8711
 
8712
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
8712
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
8713
8713
  var DocTypeReader = class {
8714
8714
  constructor(options2) {
8715
8715
  this.suppressValidationErr = !options2;
@@ -8989,7 +8989,7 @@ function validateEntityName(name) {
8989
8989
  throw new Error(`Invalid entity name ${name}`);
8990
8990
  }
8991
8991
 
8992
- // ../../.yarn/cache/strnum-npm-2.2.1-b3a08c1c56-c553d83e1a.zip/node_modules/strnum/strnum.js
8992
+ // ../../.yarn/cache/strnum-npm-2.2.2-816fd1e52f-c55813cfde.zip/node_modules/strnum/strnum.js
8993
8993
  var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
8994
8994
  var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
8995
8995
  var consider = {
@@ -9006,8 +9006,9 @@ function toNumber(str, options2 = {}) {
9006
9006
  options2 = Object.assign({}, consider, options2);
9007
9007
  if (!str || typeof str !== "string") return str;
9008
9008
  let trimmedStr = str.trim();
9009
- if (options2.skipLike !== void 0 && options2.skipLike.test(trimmedStr)) return str;
9010
- else if (str === "0") return 0;
9009
+ if (trimmedStr.length === 0) return str;
9010
+ else if (options2.skipLike !== void 0 && options2.skipLike.test(trimmedStr)) return str;
9011
+ else if (trimmedStr === "0") return 0;
9011
9012
  else if (options2.hex && hexRegex.test(trimmedStr)) {
9012
9013
  return parse_int(trimmedStr, 16);
9013
9014
  } else if (!isFinite(trimmedStr)) {
@@ -9110,7 +9111,7 @@ function handleInfinity(str, num, options2) {
9110
9111
  }
9111
9112
  }
9112
9113
 
9113
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
9114
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
9114
9115
  function getIgnoreAttributesFn(ignoreAttributes) {
9115
9116
  if (typeof ignoreAttributes === "function") {
9116
9117
  return ignoreAttributes;
@@ -9664,7 +9665,7 @@ var Matcher = class {
9664
9665
  }
9665
9666
  };
9666
9667
 
9667
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
9668
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
9668
9669
  function extractRawAttributes(prefixedAttrs, options2) {
9669
9670
  if (!prefixedAttrs) return {};
9670
9671
  const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
@@ -10317,7 +10318,7 @@ function sanitizeName(name, options2) {
10317
10318
  return name;
10318
10319
  }
10319
10320
 
10320
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
10321
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
10321
10322
  var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
10322
10323
  function stripAttributePrefix(attrs, prefix) {
10323
10324
  if (!attrs || typeof attrs !== "object") return {};
@@ -10426,7 +10427,7 @@ function isLeafTag(obj, options2) {
10426
10427
  return false;
10427
10428
  }
10428
10429
 
10429
- // ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
10430
+ // ../../.yarn/cache/fast-xml-parser-npm-5.5.9-0801b67a48-5f1a1a8b52.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
10430
10431
  var XMLParser = class {
10431
10432
  constructor(options2) {
10432
10433
  this.externalEntities = {};
@@ -13404,11 +13405,22 @@ var IntrospectedClass = class _IntrospectedClass extends IntrospectedBaseClass {
13404
13405
  returnType: "void"
13405
13406
  });
13406
13407
  });
13408
+ if (this.isGObjectObject()) {
13409
+ allSignals.push({
13410
+ name: `notify::\${string}`,
13411
+ isNotifySignal: true,
13412
+ isDetailSignal: false,
13413
+ isTemplateLiteral: true,
13414
+ parameterTypes: ["GObject.ParamSpec"],
13415
+ returnType: "void"
13416
+ });
13417
+ }
13407
13418
  }
13408
13419
  addDetailedSignals(allSignals) {
13409
13420
  const propertyNames = this.getUniquePropertyNames();
13410
13421
  this.signals.forEach((signal) => {
13411
13422
  if (signal.detailed) {
13423
+ if (signal.name === "notify") return;
13412
13424
  propertyNames.forEach((propertyName) => {
13413
13425
  allSignals.push({
13414
13426
  name: `${signal.name}::${propertyName}`,
@@ -13419,6 +13431,15 @@ var IntrospectedClass = class _IntrospectedClass extends IntrospectedBaseClass {
13419
13431
  returnType: this.getPropertyTypeString(signal.return_type)
13420
13432
  });
13421
13433
  });
13434
+ allSignals.push({
13435
+ name: `${signal.name}::\${string}`,
13436
+ signal,
13437
+ isNotifySignal: false,
13438
+ isDetailSignal: true,
13439
+ isTemplateLiteral: true,
13440
+ parameterTypes: signal.parameters.map((p) => this.getPropertyTypeString(p.type)),
13441
+ returnType: this.getPropertyTypeString(signal.return_type)
13442
+ });
13422
13443
  }
13423
13444
  });
13424
13445
  }
@@ -17766,7 +17787,7 @@ See https://gjs.guide/guides/gobject/basics.html#properties for more details.`;
17766
17787
  const override3 = new IntrospectedClassFunction({
17767
17788
  parent: ParamSpec,
17768
17789
  name: "override",
17769
- return_type: VoidType,
17790
+ return_type: ParamSpec.getType(),
17770
17791
  parameters: [
17771
17792
  new IntrospectedFunctionParameter({
17772
17793
  direction: "in" /* In */,
@@ -21024,7 +21045,6 @@ var SignalGenerator = class {
21024
21045
  }
21025
21046
  const allSignals = girClass.getAllSignals();
21026
21047
  allSignals.forEach((signalInfo) => {
21027
- const signalKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(signalInfo.name) ? signalInfo.name : `"${signalInfo.name}"`;
21028
21048
  let cbType;
21029
21049
  if (signalInfo.isNotifySignal) {
21030
21050
  const gobjectRef = this.namespace.namespace === "GObject" ? "" : "GObject.";
@@ -21042,6 +21062,11 @@ var SignalGenerator = class {
21042
21062
  const returnTypeStr = signalInfo.returnType || "void";
21043
21063
  cbType = `(${paramTypes.join(", ")}) => ${returnTypeStr}`;
21044
21064
  }
21065
+ if (signalInfo.isTemplateLiteral) {
21066
+ def.push(`${indent} [key: \`${signalInfo.name}\`]: ${cbType};`);
21067
+ return;
21068
+ }
21069
+ const signalKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(signalInfo.name) ? signalInfo.name : `"${signalInfo.name}"`;
21045
21070
  if (!signalInfo.isNotifySignal && signalInfo.signal) {
21046
21071
  const signalTags = [
21047
21072
  { tagName: "signal", paramName: "", text: "" },
@@ -21459,7 +21484,7 @@ export const ${node.name}: ${node.name}Namespace & {
21459
21484
  parameters: [
21460
21485
  new IntrospectedFunctionParameter({
21461
21486
  name: "options",
21462
- type: NativeType.of("{ message: string, code: number}"),
21487
+ type: NativeType.of("{ message: string, code: number }"),
21463
21488
  direction: "in" /* In */
21464
21489
  })
21465
21490
  ],
@@ -22083,7 +22108,7 @@ export const ${node.name}: ${node.name}Namespace & {
22083
22108
  def.push(...this.generateDirectAllocationConstructor(girClass.mainConstructor));
22084
22109
  else if (girClass.mainConstructor instanceof IntrospectedConstructor)
22085
22110
  def.push(...this.generateConstructor(girClass.mainConstructor));
22086
- else if (girClass.someParent((p) => p.namespace.namespace === "GObject" && p.name === "Object"))
22111
+ else if (girClass.namespace.namespace === "GObject" && girClass.name === "Object" || girClass.someParent((p) => p.namespace.namespace === "GObject" && p.name === "Object"))
22087
22112
  def.push(`
22088
22113
  constructor(properties?: Partial<${girClass.name}.ConstructorProps>, ...args: any[]);
22089
22114
  `);
@@ -24889,7 +24914,7 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
24889
24914
  import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
24890
24915
  function getTsForGirVersion() {
24891
24916
  if (true) {
24892
- return "4.0.0-beta.42";
24917
+ return "4.0.0-beta.43";
24893
24918
  }
24894
24919
  const __dirname3 = dirname7(fileURLToPath4(import.meta.url));
24895
24920
  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.43",
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.43",
56
+ "@ts-for-gir/generator-base": "^4.0.0-beta.43",
57
+ "@ts-for-gir/generator-html-doc": "^4.0.0-beta.43",
58
+ "@ts-for-gir/generator-json": "^4.0.0-beta.43",
59
+ "@ts-for-gir/generator-typescript": "^4.0.0-beta.43",
60
+ "@ts-for-gir/lib": "^4.0.0-beta.43",
61
+ "@ts-for-gir/reporter": "^4.0.0-beta.43",
62
+ "@ts-for-gir/tsconfig": "^4.0.0-beta.43",
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.43",
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
  }