@ts-for-gir/cli 4.0.0-rc.1 → 4.0.0-rc.3
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 +106 -60
- package/package.json +10 -10
package/bin/ts-for-gir
CHANGED
|
@@ -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.
|
|
7271
|
+
return "4.0.0-rc.3";
|
|
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.
|
|
8168
|
+
return "4.0.0-rc.3";
|
|
8169
8169
|
}
|
|
8170
8170
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
8171
8171
|
const currentDir = dirname2(currentModulePath);
|
|
@@ -11977,6 +11977,7 @@ var Uint8ArrayType = new NativeType("Uint8Array");
|
|
|
11977
11977
|
var BooleanType = new NativeType("boolean");
|
|
11978
11978
|
var StringType = new NativeType("string");
|
|
11979
11979
|
var NumberType = new NativeType("number");
|
|
11980
|
+
var BigintOrNumberType = new BinaryType(new NativeType("bigint"), NumberType);
|
|
11980
11981
|
var NullType = new NativeType("null");
|
|
11981
11982
|
var VoidType = new NativeType("void");
|
|
11982
11983
|
var UnknownType = new NativeType("unknown");
|
|
@@ -12090,19 +12091,22 @@ function resolvePrimitiveType(name) {
|
|
|
12090
12091
|
case "gfloat":
|
|
12091
12092
|
case "gchar":
|
|
12092
12093
|
case "guint":
|
|
12093
|
-
case "glong":
|
|
12094
|
-
case "gulong":
|
|
12095
12094
|
case "gint":
|
|
12096
12095
|
case "guint8":
|
|
12096
|
+
case "gdouble":
|
|
12097
|
+
return NumberType;
|
|
12098
|
+
case "glong":
|
|
12099
|
+
case "gulong":
|
|
12097
12100
|
case "guint64":
|
|
12098
12101
|
case "gint64":
|
|
12099
|
-
case "gdouble":
|
|
12100
12102
|
case "gssize":
|
|
12101
12103
|
case "gsize":
|
|
12104
|
+
case "guintptr":
|
|
12105
|
+
// Integer of the same width as a pointer
|
|
12102
12106
|
case "time_t":
|
|
12103
12107
|
// C standard library time type (seconds since Unix epoch)
|
|
12104
12108
|
case "ulong":
|
|
12105
|
-
return
|
|
12109
|
+
return BigintOrNumberType;
|
|
12106
12110
|
case "gboolean":
|
|
12107
12111
|
return BooleanType;
|
|
12108
12112
|
case "gpointer":
|
|
@@ -12111,8 +12115,6 @@ function resolvePrimitiveType(name) {
|
|
|
12111
12115
|
return ObjectType;
|
|
12112
12116
|
case "va_list":
|
|
12113
12117
|
return AnyType;
|
|
12114
|
-
case "guintptr":
|
|
12115
|
-
return NeverType;
|
|
12116
12118
|
case "never":
|
|
12117
12119
|
return NeverType;
|
|
12118
12120
|
case "unknown":
|
|
@@ -12154,6 +12156,19 @@ function resolveDirectedType(type, direction) {
|
|
|
12154
12156
|
return type;
|
|
12155
12157
|
}
|
|
12156
12158
|
}
|
|
12159
|
+
} else if (type === BigintOrNumberType && direction === "out" /* Out */) {
|
|
12160
|
+
return NumberType;
|
|
12161
|
+
} else if (type instanceof PromiseType) {
|
|
12162
|
+
const resolvedInner = resolveDirectedType(type.type, direction);
|
|
12163
|
+
if (resolvedInner) return new PromiseType(resolvedInner);
|
|
12164
|
+
} else if (type instanceof BinaryType && !(type instanceof NullableType)) {
|
|
12165
|
+
const a = resolveDirectedType(type.a, direction) ?? type.a;
|
|
12166
|
+
const b = resolveDirectedType(type.b, direction) ?? type.b;
|
|
12167
|
+
if (a !== type.a || b !== type.b) return new BinaryType(a, b);
|
|
12168
|
+
} else if (type instanceof OrType && !(type instanceof BinaryType || type instanceof TupleType)) {
|
|
12169
|
+
const types = type.types.map((t) => resolveDirectedType(t, direction) ?? t);
|
|
12170
|
+
if (types.length === 1) return types[0];
|
|
12171
|
+
return new OrType(types[0], ...types.slice(1));
|
|
12157
12172
|
}
|
|
12158
12173
|
return null;
|
|
12159
12174
|
}
|
|
@@ -12306,7 +12321,7 @@ function getType(ns, param) {
|
|
|
12306
12321
|
} else if (closure != null) {
|
|
12307
12322
|
variableType = ClosureType.new({ type: variableType, user_data: closure });
|
|
12308
12323
|
}
|
|
12309
|
-
if (parameter.$ && (parameter.$.direction === "inout" /* Inout */ || parameter.$.direction === "out" /* Out */) && (nullable || allowNone) && !(variableType instanceof NativeType)) {
|
|
12324
|
+
if (parameter.$ && (parameter.$.direction === "inout" /* Inout */ || parameter.$.direction === "out" /* Out */) && (nullable || allowNone) && !(variableType instanceof NativeType) && variableType !== BigintOrNumberType) {
|
|
12310
12325
|
return new NullableType(variableType);
|
|
12311
12326
|
}
|
|
12312
12327
|
if ((!parameter.$?.direction || parameter.$.direction === "in" /* In */) && nullable) {
|
|
@@ -18647,33 +18662,6 @@ var ClassVisitor = class extends GirVisitor {
|
|
|
18647
18662
|
);
|
|
18648
18663
|
};
|
|
18649
18664
|
|
|
18650
|
-
// ../lib/src/validators/function-parameters.ts
|
|
18651
|
-
var FunctionParametersVisitor = class extends GirVisitor {
|
|
18652
|
-
makeEnumParamsNullable(node) {
|
|
18653
|
-
return node.copy({
|
|
18654
|
-
parameters: node.parameters.map((param) => {
|
|
18655
|
-
const type = param.type.deepUnwrap();
|
|
18656
|
-
if (type instanceof TypeIdentifier) {
|
|
18657
|
-
const ns = node.namespace.assertInstalledImport(type.namespace);
|
|
18658
|
-
const isEnumType = !!ns.getEnum(type.name);
|
|
18659
|
-
if (isEnumType) {
|
|
18660
|
-
return param.copy({
|
|
18661
|
-
type: new NullableType(param.type)
|
|
18662
|
-
});
|
|
18663
|
-
}
|
|
18664
|
-
}
|
|
18665
|
-
return param;
|
|
18666
|
-
})
|
|
18667
|
-
});
|
|
18668
|
-
}
|
|
18669
|
-
visitFunction = (node) => {
|
|
18670
|
-
return this.makeEnumParamsNullable(node);
|
|
18671
|
-
};
|
|
18672
|
-
visitClassFunction = (node) => {
|
|
18673
|
-
return this.makeEnumParamsNullable(node);
|
|
18674
|
-
};
|
|
18675
|
-
};
|
|
18676
|
-
|
|
18677
18665
|
// ../lib/src/validators/interface.ts
|
|
18678
18666
|
var InterfaceVisitor = class extends GirVisitor {
|
|
18679
18667
|
visitInterface = (node) => {
|
|
@@ -18768,8 +18756,6 @@ var NSRegistry = class {
|
|
|
18768
18756
|
this.registerTransformation(interfaceVisitor);
|
|
18769
18757
|
const classVisitor = new ClassVisitor();
|
|
18770
18758
|
this.registerTransformation(classVisitor);
|
|
18771
|
-
const enumParamsVisitor = new FunctionParametersVisitor();
|
|
18772
|
-
this.registerTransformation(enumParamsVisitor);
|
|
18773
18759
|
console.log("Adding generics...");
|
|
18774
18760
|
generify(this, options2.inferGenerics);
|
|
18775
18761
|
console.log("Injecting types...");
|
|
@@ -21064,12 +21050,12 @@ var SignalGenerator = class {
|
|
|
21064
21050
|
const gobjectRef = this.namespace.namespace === "GObject" ? "" : "GObject.";
|
|
21065
21051
|
cbType = `(pspec: ${gobjectRef}ParamSpec) => void`;
|
|
21066
21052
|
} else if (signalInfo.signal) {
|
|
21067
|
-
const paramTypes = signalInfo.signal.parameters.map((p, idx) => `arg${idx}: ${this.core.
|
|
21053
|
+
const paramTypes = signalInfo.signal.parameters.map((p, idx) => `arg${idx}: ${this.core.generateDirectedType(p.type, "out" /* Out */)}`).join(", ");
|
|
21068
21054
|
let returnType = signalInfo.signal.return_type;
|
|
21069
21055
|
if (signalInfo.signal.return_type.equals(BooleanType)) {
|
|
21070
21056
|
returnType = new BinaryType(BooleanType, VoidType);
|
|
21071
21057
|
}
|
|
21072
|
-
const returnTypeStr = this.core.
|
|
21058
|
+
const returnTypeStr = this.core.generateDirectedType(returnType, "in" /* In */);
|
|
21073
21059
|
cbType = `(${paramTypes}) => ${returnTypeStr}`;
|
|
21074
21060
|
} else {
|
|
21075
21061
|
const paramTypes = signalInfo.parameterTypes?.map((type, idx) => `arg${idx}: ${type}`) || [];
|
|
@@ -21581,13 +21567,15 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21581
21567
|
}
|
|
21582
21568
|
}
|
|
21583
21569
|
const Type = type.resolve(this.namespace, this.options).rootPrint(this.namespace, this.options) || "any";
|
|
21570
|
+
const GetterType = this.generateDirectedType(type, "out" /* Out */) || Type;
|
|
21571
|
+
const SetterType = this.generateDirectedType(type, "in" /* In */) || Type;
|
|
21584
21572
|
if (construct) {
|
|
21585
21573
|
const unwrapped = type.deepUnwrap();
|
|
21586
21574
|
if (unwrapped instanceof TypeIdentifier && unwrapped.is("GObject", "GType")) {
|
|
21587
21575
|
const gtypeNamespace = this.namespace.namespace === "GObject" ? "" : "GObject.";
|
|
21588
21576
|
return [`${name}: ${gtypeNamespace}GTypeInput;`];
|
|
21589
21577
|
}
|
|
21590
|
-
return [`${name}: ${
|
|
21578
|
+
return [`${name}: ${SetterType};`];
|
|
21591
21579
|
}
|
|
21592
21580
|
if (printAsProperty) {
|
|
21593
21581
|
desc.push(`${getterSetterAnnotation}${indent} ${name}: ${Type};`);
|
|
@@ -21595,13 +21583,13 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21595
21583
|
}
|
|
21596
21584
|
if (hasGetter && hasSetter) {
|
|
21597
21585
|
desc.push(
|
|
21598
|
-
`${getterAnnotation}${indent}get ${name}(): ${
|
|
21599
|
-
`${setterAnnotation}${indent}set ${name}(val: ${
|
|
21586
|
+
`${getterAnnotation}${indent}get ${name}(): ${GetterType};`,
|
|
21587
|
+
`${setterAnnotation}${indent}set ${name}(val: ${SetterType});`
|
|
21600
21588
|
);
|
|
21601
21589
|
} else if (hasGetter) {
|
|
21602
|
-
desc.push(`${getterSetterAnnotation}${indent}get ${name}(): ${
|
|
21590
|
+
desc.push(`${getterSetterAnnotation}${indent}get ${name}(): ${GetterType};`);
|
|
21603
21591
|
} else {
|
|
21604
|
-
desc.push(`${getterSetterAnnotation}${indent}set ${name}(val: ${
|
|
21592
|
+
desc.push(`${getterSetterAnnotation}${indent}set ${name}(val: ${SetterType});`);
|
|
21605
21593
|
}
|
|
21606
21594
|
return desc;
|
|
21607
21595
|
}
|
|
@@ -21627,7 +21615,7 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21627
21615
|
type = type.unwrap();
|
|
21628
21616
|
}
|
|
21629
21617
|
}
|
|
21630
|
-
const typeStr = this.
|
|
21618
|
+
const typeStr = this.generateDirectedType(type, "out" /* Out */);
|
|
21631
21619
|
desc.push(`${indent}${commentOut}${staticStr}${readonly}${name}${affix}: ${typeStr}`);
|
|
21632
21620
|
return desc;
|
|
21633
21621
|
}
|
|
@@ -21764,10 +21752,10 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21764
21752
|
}
|
|
21765
21753
|
return def;
|
|
21766
21754
|
}
|
|
21767
|
-
generateParameter(tsParam) {
|
|
21755
|
+
generateParameter(tsParam, direction = "in" /* In */) {
|
|
21768
21756
|
const types = tsParam.type;
|
|
21769
21757
|
const name = tsParam.name;
|
|
21770
|
-
const typeStr = this.generateDirectedType(types,
|
|
21758
|
+
const typeStr = this.generateDirectedType(types, direction);
|
|
21771
21759
|
const optional = tsParam.isOptional && !tsParam.isVarArgs;
|
|
21772
21760
|
const affix = optional ? "?" : "";
|
|
21773
21761
|
const prefix = tsParam.isVarArgs ? "..." : "";
|
|
@@ -21802,18 +21790,18 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21802
21790
|
}
|
|
21803
21791
|
return "";
|
|
21804
21792
|
}
|
|
21805
|
-
generateFunctionReturn(tsFunction) {
|
|
21793
|
+
generateFunctionReturn(tsFunction, direction = "out" /* Out */) {
|
|
21806
21794
|
if (tsFunction.name === "constructor") {
|
|
21807
21795
|
return "";
|
|
21808
21796
|
}
|
|
21809
|
-
const typeStr = this.generateDirectedType(tsFunction.return(),
|
|
21797
|
+
const typeStr = this.generateDirectedType(tsFunction.return(), direction);
|
|
21810
21798
|
const outputParameters = tsFunction.output_parameters;
|
|
21811
21799
|
if (outputParameters.length > 0) {
|
|
21812
21800
|
const excludeActualReturnValueFromArray = typeStr === "void" || typeStr === "";
|
|
21813
21801
|
const returns = [
|
|
21814
21802
|
...excludeActualReturnValueFromArray ? [] : [`${typeStr}`],
|
|
21815
21803
|
...outputParameters.map((op) => {
|
|
21816
|
-
return resolveDirectedType(op.type,
|
|
21804
|
+
return resolveDirectedType(op.type, direction)?.resolve(this.namespace, this.options) ?? op.type.resolve(this.namespace, this.options);
|
|
21817
21805
|
}).map((p) => p.rootPrint(this.namespace, this.options))
|
|
21818
21806
|
];
|
|
21819
21807
|
if (returns.length > 1) {
|
|
@@ -21834,6 +21822,9 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21834
21822
|
const isStatic = tsFunction instanceof IntrospectedStaticClassFunction;
|
|
21835
21823
|
const isGlobal = !(tsFunction instanceof IntrospectedClassFunction);
|
|
21836
21824
|
const isArrowType = tsFunction instanceof IntrospectedCallback || tsFunction instanceof IntrospectedClassCallback;
|
|
21825
|
+
const isReversedDirection = tsFunction instanceof IntrospectedVirtualClassFunction;
|
|
21826
|
+
const inParamDirection = isReversedDirection ? "out" /* Out */ : "in" /* In */;
|
|
21827
|
+
const returnDirection = isReversedDirection ? "in" /* In */ : "out" /* Out */;
|
|
21837
21828
|
const { parameters: inParams } = tsFunction;
|
|
21838
21829
|
def.push(
|
|
21839
21830
|
...this.addGirDocComment(
|
|
@@ -21858,7 +21849,7 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21858
21849
|
if (isGlobal) {
|
|
21859
21850
|
exportStr = !this.config.noNamespace ? "" : "export ";
|
|
21860
21851
|
}
|
|
21861
|
-
const returnType = this.generateFunctionReturn(tsFunction);
|
|
21852
|
+
const returnType = this.generateFunctionReturn(tsFunction, returnDirection);
|
|
21862
21853
|
let retSep = "";
|
|
21863
21854
|
if (returnType) {
|
|
21864
21855
|
if (isArrowType) {
|
|
@@ -21871,7 +21862,10 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21871
21862
|
if (isInvalid(name) && !isGlobal) {
|
|
21872
21863
|
name = `["${name}"]`;
|
|
21873
21864
|
}
|
|
21874
|
-
const inParamsDef =
|
|
21865
|
+
const inParamsDef = [];
|
|
21866
|
+
for (const inParam of inParams) {
|
|
21867
|
+
inParamsDef.push(...this.generateParameter(inParam, inParamDirection));
|
|
21868
|
+
}
|
|
21875
21869
|
def.push(
|
|
21876
21870
|
`${indent}${commentOut}${exportStr}${staticStr}${globalStr}${name}${genericStr}(${inParamsDef.join(
|
|
21877
21871
|
", "
|
|
@@ -21902,7 +21896,10 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21902
21896
|
name = removeNamespace(name, tsCallback.namespace.namespace);
|
|
21903
21897
|
if (classModuleName) name = removeClassModule(name, classModuleName);
|
|
21904
21898
|
const genericParameters = this.generateGenericParameters(generics);
|
|
21905
|
-
const inParamsDef =
|
|
21899
|
+
const inParamsDef = [];
|
|
21900
|
+
for (const inParam of inParams) {
|
|
21901
|
+
inParamsDef.push(...this.generateParameter(inParam, "out" /* Out */));
|
|
21902
|
+
}
|
|
21906
21903
|
const interfaceHead = `${name}${genericParameters}`;
|
|
21907
21904
|
def.push(this.generateExport("interface", `${interfaceHead}`, "{", indentCount));
|
|
21908
21905
|
def.push(`${indentBody}(${inParamsDef.join(", ")}): ${returnTypeStr}`);
|
|
@@ -21974,7 +21971,7 @@ export const ${node.name}: ${node.name}Namespace & {
|
|
|
21974
21971
|
const indent = generateIndent(indentCount);
|
|
21975
21972
|
const exp = !this.config.noNamespace ? "" : "export ";
|
|
21976
21973
|
const ComputedName = generateMemberName(tsConst);
|
|
21977
|
-
const typeStr = this.generateType(tsConst.type);
|
|
21974
|
+
const typeStr = this.generateType(resolveDirectedType(tsConst.type, "out" /* Out */) ?? tsConst.type);
|
|
21978
21975
|
desc.push(`${indent}${exp}const ${ComputedName}: ${typeStr}`);
|
|
21979
21976
|
return desc;
|
|
21980
21977
|
}
|
|
@@ -22928,6 +22925,7 @@ var MUTTER_COMMON = {
|
|
|
22928
22925
|
browseUrl: "https://gitlab.gnome.org/GNOME/mutter/",
|
|
22929
22926
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/mutter.git",
|
|
22930
22927
|
license: "GPL-2.0-or-later",
|
|
22928
|
+
iconFile: "mutter-r.svg",
|
|
22931
22929
|
category: "GNOME Shell"
|
|
22932
22930
|
};
|
|
22933
22931
|
var SHELL_COMMON = {
|
|
@@ -22936,6 +22934,7 @@ var SHELL_COMMON = {
|
|
|
22936
22934
|
browseUrl: "https://gitlab.gnome.org/GNOME/gnome-shell/",
|
|
22937
22935
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/gnome-shell.git",
|
|
22938
22936
|
license: "GPL-2.0-or-later",
|
|
22937
|
+
iconFile: "gnome-shell-r.svg",
|
|
22939
22938
|
category: "GNOME Shell"
|
|
22940
22939
|
};
|
|
22941
22940
|
var meta = {
|
|
@@ -23262,6 +23261,7 @@ var gtksource5 = {
|
|
|
23262
23261
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/gtksourceview.git",
|
|
23263
23262
|
license: "LGPL-2.1-or-later",
|
|
23264
23263
|
cDocsUrl: "https://gnome.pages.gitlab.gnome.org/gtksourceview/gtksourceview5/",
|
|
23264
|
+
iconFile: "gtksourceview-r.svg",
|
|
23265
23265
|
category: "GNOME Desktop"
|
|
23266
23266
|
};
|
|
23267
23267
|
var shumate = {
|
|
@@ -23274,6 +23274,7 @@ var shumate = {
|
|
|
23274
23274
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/libshumate.git",
|
|
23275
23275
|
license: "LGPL-2.1-or-later",
|
|
23276
23276
|
cDocsUrl: "https://gnome.pages.gitlab.gnome.org/libshumate/",
|
|
23277
|
+
iconFile: "libshumate-r.svg",
|
|
23277
23278
|
category: "GNOME Desktop"
|
|
23278
23279
|
};
|
|
23279
23280
|
var notify = {
|
|
@@ -23469,6 +23470,7 @@ var tsparql = {
|
|
|
23469
23470
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/tracker.git",
|
|
23470
23471
|
license: "LGPL-2.1-or-later",
|
|
23471
23472
|
cDocsUrl: "https://gnome.pages.gitlab.gnome.org/tracker/docs/developer/",
|
|
23473
|
+
iconFile: "tracker-r.svg",
|
|
23472
23474
|
category: "Data & Markup"
|
|
23473
23475
|
};
|
|
23474
23476
|
var template = {
|
|
@@ -23537,6 +23539,7 @@ var polkit = {
|
|
|
23537
23539
|
browseUrl: "https://gitlab.freedesktop.org/polkit/polkit/",
|
|
23538
23540
|
repositoryUrl: "https://gitlab.freedesktop.org/polkit/polkit.git",
|
|
23539
23541
|
license: "LGPL-2.0-or-later",
|
|
23542
|
+
iconFile: "polkit-r.svg",
|
|
23540
23543
|
category: "Security"
|
|
23541
23544
|
};
|
|
23542
23545
|
var polkitAgent = {
|
|
@@ -23548,6 +23551,7 @@ var polkitAgent = {
|
|
|
23548
23551
|
browseUrl: "https://gitlab.freedesktop.org/polkit/polkit/",
|
|
23549
23552
|
repositoryUrl: "https://gitlab.freedesktop.org/polkit/polkit.git",
|
|
23550
23553
|
license: "LGPL-2.0-or-later",
|
|
23554
|
+
iconFile: "polkit-r.svg",
|
|
23551
23555
|
category: "Security"
|
|
23552
23556
|
};
|
|
23553
23557
|
var nm = {
|
|
@@ -23640,6 +23644,7 @@ var xdp = {
|
|
|
23640
23644
|
browseUrl: "https://github.com/flatpak/libportal/",
|
|
23641
23645
|
repositoryUrl: "https://github.com/flatpak/libportal.git",
|
|
23642
23646
|
license: "LGPL-3.0-or-later",
|
|
23647
|
+
iconFile: "libportal-r.svg",
|
|
23643
23648
|
category: "System"
|
|
23644
23649
|
};
|
|
23645
23650
|
var xdpGtk4 = {
|
|
@@ -23651,6 +23656,7 @@ var xdpGtk4 = {
|
|
|
23651
23656
|
browseUrl: "https://github.com/flatpak/libportal/",
|
|
23652
23657
|
repositoryUrl: "https://github.com/flatpak/libportal.git",
|
|
23653
23658
|
license: "LGPL-3.0-or-later",
|
|
23659
|
+
iconFile: "libportal-r.svg",
|
|
23654
23660
|
category: "System"
|
|
23655
23661
|
};
|
|
23656
23662
|
var rsvg = {
|
|
@@ -23663,6 +23669,7 @@ var rsvg = {
|
|
|
23663
23669
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/librsvg.git",
|
|
23664
23670
|
license: "LGPL-2.1-or-later",
|
|
23665
23671
|
cDocsUrl: "https://gnome.pages.gitlab.gnome.org/librsvg/doc/rsvg/",
|
|
23672
|
+
iconFile: "librsvg-r.svg",
|
|
23666
23673
|
category: "Graphics"
|
|
23667
23674
|
};
|
|
23668
23675
|
var gl = {
|
|
@@ -23730,6 +23737,7 @@ var goa = {
|
|
|
23730
23737
|
repositoryUrl: "https://gitlab.gnome.org/GNOME/gnome-online-accounts.git",
|
|
23731
23738
|
license: "LGPL-2.0-or-later",
|
|
23732
23739
|
cDocsUrl: "https://gnome.pages.gitlab.gnome.org/gnome-online-accounts/goa/",
|
|
23740
|
+
iconFile: "goa-r.svg",
|
|
23733
23741
|
category: "Web"
|
|
23734
23742
|
};
|
|
23735
23743
|
var rest = {
|
|
@@ -24217,6 +24225,10 @@ var TypeDocPipeline = class {
|
|
|
24217
24225
|
);
|
|
24218
24226
|
result.project.packageVersion = module.libraryVersion.toString();
|
|
24219
24227
|
this.registerGirMetadata(result.app, module);
|
|
24228
|
+
const nsMeta = this.buildNamespaceMetadata(module);
|
|
24229
|
+
for (const child of result.project.children ?? []) {
|
|
24230
|
+
child.girNamespaceMetadata ??= nsMeta;
|
|
24231
|
+
}
|
|
24220
24232
|
return result;
|
|
24221
24233
|
}
|
|
24222
24234
|
/**
|
|
@@ -24294,6 +24306,7 @@ var TypeDocPipeline = class {
|
|
|
24294
24306
|
[new TSConfigReader()]
|
|
24295
24307
|
);
|
|
24296
24308
|
this.fixExportImportReferences(result.project);
|
|
24309
|
+
this.enrichModuleReflections(result.project);
|
|
24297
24310
|
return result;
|
|
24298
24311
|
}
|
|
24299
24312
|
/**
|
|
@@ -24339,7 +24352,8 @@ var TypeDocPipeline = class {
|
|
|
24339
24352
|
...existing,
|
|
24340
24353
|
displayName: existing.displayName ?? meta2.displayName,
|
|
24341
24354
|
description: existing.description ?? meta2.description,
|
|
24342
|
-
logoUrl: existing.logoUrl ?? meta2.logoUrl,
|
|
24355
|
+
logoUrl: existing.logoUrl ?? meta2.logoUrl ?? (meta2.iconFile ? `assets/library-icons/${meta2.iconFile}` : void 0),
|
|
24356
|
+
iconFile: existing.iconFile ?? meta2.iconFile,
|
|
24343
24357
|
websiteUrl: existing.websiteUrl ?? meta2.websiteUrl,
|
|
24344
24358
|
cDocsUrl: existing.cDocsUrl ?? meta2.cDocsUrl,
|
|
24345
24359
|
license: existing.license ?? meta2.license,
|
|
@@ -24347,6 +24361,27 @@ var TypeDocPipeline = class {
|
|
|
24347
24361
|
};
|
|
24348
24362
|
}
|
|
24349
24363
|
}
|
|
24364
|
+
/**
|
|
24365
|
+
* Attach metadata to module reflections by matching against known GIR modules.
|
|
24366
|
+
* Used in combined mode where modules are discovered via "packages" entry point strategy.
|
|
24367
|
+
*/
|
|
24368
|
+
enrichModuleReflections(project) {
|
|
24369
|
+
if (!project.children) return;
|
|
24370
|
+
const metaByImportName = /* @__PURE__ */ new Map();
|
|
24371
|
+
for (const module of this.modules) {
|
|
24372
|
+
metaByImportName.set(module.importName, this.buildNamespaceMetadata(module));
|
|
24373
|
+
}
|
|
24374
|
+
for (const child of project.children) {
|
|
24375
|
+
const enriched = child;
|
|
24376
|
+
if (enriched.girNamespaceMetadata?.category) continue;
|
|
24377
|
+
const scopeMatch = child.name.match(/^@[^/]+\/(.+)$/);
|
|
24378
|
+
const importName = scopeMatch ? scopeMatch[1] : child.name.toLowerCase();
|
|
24379
|
+
const nsMeta = metaByImportName.get(importName);
|
|
24380
|
+
if (nsMeta) {
|
|
24381
|
+
enriched.girNamespaceMetadata ??= nsMeta;
|
|
24382
|
+
}
|
|
24383
|
+
}
|
|
24384
|
+
}
|
|
24350
24385
|
async cleanup() {
|
|
24351
24386
|
if (this.tempDir) {
|
|
24352
24387
|
await rm(this.tempDir, { recursive: true, force: true });
|
|
@@ -24642,7 +24677,8 @@ var TypeDocPipeline = class {
|
|
|
24642
24677
|
packageVersion: pkgJson?.version,
|
|
24643
24678
|
displayName: meta2?.displayName,
|
|
24644
24679
|
description: meta2?.description ?? pkgJson?.description,
|
|
24645
|
-
logoUrl: meta2?.logoUrl,
|
|
24680
|
+
logoUrl: meta2?.logoUrl ?? (meta2?.iconFile ? `assets/library-icons/${meta2.iconFile}` : void 0),
|
|
24681
|
+
iconFile: meta2?.iconFile,
|
|
24646
24682
|
websiteUrl: meta2?.websiteUrl ?? pkgJson?.homepage,
|
|
24647
24683
|
cDocsUrl: meta2?.cDocsUrl,
|
|
24648
24684
|
license: meta2?.license ?? pkgJson?.license,
|
|
@@ -24744,7 +24780,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24744
24780
|
};
|
|
24745
24781
|
|
|
24746
24782
|
// ../typedoc-theme/src/theme.ts
|
|
24747
|
-
import { copyFileSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
24783
|
+
import { copyFileSync, existsSync as existsSync3, mkdirSync, readdirSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
24748
24784
|
import { dirname as dirname8, join as join14 } from "node:path";
|
|
24749
24785
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
24750
24786
|
import { DefaultTheme, RendererEvent } from "typedoc";
|
|
@@ -25628,7 +25664,7 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
|
25628
25664
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
|
|
25629
25665
|
function getTsForGirVersion() {
|
|
25630
25666
|
if (true) {
|
|
25631
|
-
return "4.0.0-rc.
|
|
25667
|
+
return "4.0.0-rc.3";
|
|
25632
25668
|
}
|
|
25633
25669
|
const __dirname3 = dirname7(fileURLToPath4(import.meta.url));
|
|
25634
25670
|
return JSON.parse(readFileSync6(join13(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
@@ -25707,7 +25743,7 @@ function giDocgenModuleInfo(context, mod, nsMeta) {
|
|
|
25707
25743
|
var giDocgenSidebar = (context, props) => {
|
|
25708
25744
|
const owningModule = findOwningModule(props.model);
|
|
25709
25745
|
const nsMeta = owningModule ? getGirNamespaceMetadata(props.model) : void 0;
|
|
25710
|
-
const logoUrl = nsMeta?.logoUrl || context.relativeURL("assets/logo_x4.png", true);
|
|
25746
|
+
const logoUrl = nsMeta?.logoUrl ? nsMeta.logoUrl.startsWith("http://") || nsMeta.logoUrl.startsWith("https://") ? nsMeta.logoUrl : context.relativeURL(nsMeta.logoUrl, true) : context.relativeURL("assets/logo_x4.png", true);
|
|
25711
25747
|
const logoAlt = nsMeta?.displayName || nsMeta?.namespace || "GJS TypeScript Definitions";
|
|
25712
25748
|
const logoHref = owningModule ? context.urlTo(owningModule) : context.relativeURL("index.html", true);
|
|
25713
25749
|
const subtitleTarget = nsMeta ? (nsMeta.displayName || nsMeta.packageName).toUpperCase() : "GJS";
|
|
@@ -26095,6 +26131,16 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
26095
26131
|
for (const file of FAVICON_FILES) {
|
|
26096
26132
|
copyFileSync(join14(faviconDir, file), join14(assetsDir, file));
|
|
26097
26133
|
}
|
|
26134
|
+
const iconsSourceDir = join14(__dirname2, "..", "..", "..", "refs", "library-icons", "library-icons");
|
|
26135
|
+
const iconsOutputDir = join14(assetsDir, "library-icons");
|
|
26136
|
+
if (existsSync3(iconsSourceDir)) {
|
|
26137
|
+
mkdirSync(iconsOutputDir, { recursive: true });
|
|
26138
|
+
for (const file of readdirSync(iconsSourceDir)) {
|
|
26139
|
+
if (file.endsWith("-r.svg")) {
|
|
26140
|
+
copyFileSync(join14(iconsSourceDir, file), join14(iconsOutputDir, file));
|
|
26141
|
+
}
|
|
26142
|
+
}
|
|
26143
|
+
}
|
|
26098
26144
|
const projectName = event.project.name || "TS for GIR";
|
|
26099
26145
|
const manifest = {
|
|
26100
26146
|
name: `TypeScript type definitions for ${projectName}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/cli",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.3",
|
|
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,14 +52,14 @@
|
|
|
52
52
|
".": "./src/index.ts"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@gi.ts/parser": "^4.0.0-rc.
|
|
56
|
-
"@ts-for-gir/generator-base": "^4.0.0-rc.
|
|
57
|
-
"@ts-for-gir/generator-html-doc": "^4.0.0-rc.
|
|
58
|
-
"@ts-for-gir/generator-json": "^4.0.0-rc.
|
|
59
|
-
"@ts-for-gir/generator-typescript": "^4.0.0-rc.
|
|
60
|
-
"@ts-for-gir/lib": "^4.0.0-rc.
|
|
61
|
-
"@ts-for-gir/reporter": "^4.0.0-rc.
|
|
62
|
-
"@ts-for-gir/tsconfig": "^4.0.0-rc.
|
|
55
|
+
"@gi.ts/parser": "^4.0.0-rc.3",
|
|
56
|
+
"@ts-for-gir/generator-base": "^4.0.0-rc.3",
|
|
57
|
+
"@ts-for-gir/generator-html-doc": "^4.0.0-rc.3",
|
|
58
|
+
"@ts-for-gir/generator-json": "^4.0.0-rc.3",
|
|
59
|
+
"@ts-for-gir/generator-typescript": "^4.0.0-rc.3",
|
|
60
|
+
"@ts-for-gir/lib": "^4.0.0-rc.3",
|
|
61
|
+
"@ts-for-gir/reporter": "^4.0.0-rc.3",
|
|
62
|
+
"@ts-for-gir/tsconfig": "^4.0.0-rc.3",
|
|
63
63
|
"@types/ejs": "^3.1.5",
|
|
64
64
|
"@types/inquirer": "^9.0.9",
|
|
65
65
|
"@types/node": "^24.12.2",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@inquirer/prompts": "^8.3.2",
|
|
72
|
-
"@ts-for-gir/templates": "^4.0.0-rc.
|
|
72
|
+
"@ts-for-gir/templates": "^4.0.0-rc.3",
|
|
73
73
|
"colorette": "^2.0.20",
|
|
74
74
|
"cosmiconfig": "^9.0.1",
|
|
75
75
|
"ejs": "^5.0.1",
|