@ts-for-gir/generator-json 4.0.0-beta.44 → 4.0.0-rc.1
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/package.json +9 -9
- package/src/typedoc-pipeline.ts +37 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/generator-json",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.1",
|
|
4
4
|
"description": "JSON generator for ts-for-gir",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"json"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@ts-for-gir/tsconfig": "^4.0.0-
|
|
40
|
-
"@types/node": "^24.12.
|
|
39
|
+
"@ts-for-gir/tsconfig": "^4.0.0-rc.1",
|
|
40
|
+
"@types/node": "^24.12.2",
|
|
41
41
|
"typescript": "^6.0.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@gi.ts/parser": "^4.0.0-
|
|
45
|
-
"@ts-for-gir/generator-base": "^4.0.0-
|
|
46
|
-
"@ts-for-gir/generator-typescript": "^4.0.0-
|
|
47
|
-
"@ts-for-gir/gir-module-metadata": "^4.0.0-
|
|
48
|
-
"@ts-for-gir/lib": "^4.0.0-
|
|
49
|
-
"@ts-for-gir/reporter": "^4.0.0-
|
|
44
|
+
"@gi.ts/parser": "^4.0.0-rc.1",
|
|
45
|
+
"@ts-for-gir/generator-base": "^4.0.0-rc.1",
|
|
46
|
+
"@ts-for-gir/generator-typescript": "^4.0.0-rc.1",
|
|
47
|
+
"@ts-for-gir/gir-module-metadata": "^4.0.0-rc.1",
|
|
48
|
+
"@ts-for-gir/lib": "^4.0.0-rc.1",
|
|
49
|
+
"@ts-for-gir/reporter": "^4.0.0-rc.1",
|
|
50
50
|
"typedoc": "^0.28.18"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/typedoc-pipeline.ts
CHANGED
|
@@ -240,9 +240,46 @@ export class TypeDocPipeline {
|
|
|
240
240
|
|
|
241
241
|
const result = await this.convertApp(app, "merged documentation");
|
|
242
242
|
this.fixExportImportReferences(result.project);
|
|
243
|
+
this.enrichMergedModuleMetadata(result.project);
|
|
243
244
|
return result;
|
|
244
245
|
}
|
|
245
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Enrich module reflections with curated metadata after merge.
|
|
249
|
+
*
|
|
250
|
+
* In merge mode, girNamespaceMetadata lives at the project-root level of
|
|
251
|
+
* each individual JSON file. When TypeDoc merges these files, the metadata
|
|
252
|
+
* may not be transferred to the resulting module reflections. This method
|
|
253
|
+
* fills in missing metadata from the curated registry so that the theme
|
|
254
|
+
* can always categorise and describe every module.
|
|
255
|
+
*/
|
|
256
|
+
private enrichMergedModuleMetadata(project: ProjectReflection): void {
|
|
257
|
+
if (!project.children) return;
|
|
258
|
+
for (const child of project.children) {
|
|
259
|
+
const enriched = child as DeclarationReflection & { girNamespaceMetadata?: GirNamespaceMetadata };
|
|
260
|
+
// Skip modules that already have a category from the JSON deserializer
|
|
261
|
+
if (enriched.girNamespaceMetadata?.category) continue;
|
|
262
|
+
|
|
263
|
+
// Try to find curated metadata by matching the module name to a GIR ID.
|
|
264
|
+
// Module names in the merged project follow the pattern "Namespace-Version"
|
|
265
|
+
// (e.g. "Gtk-4.0") which matches the girId used in the metadata registry.
|
|
266
|
+
const meta = getModuleMetadata(child.name);
|
|
267
|
+
if (!meta) continue;
|
|
268
|
+
|
|
269
|
+
const existing = enriched.girNamespaceMetadata ?? ({} as GirNamespaceMetadata);
|
|
270
|
+
enriched.girNamespaceMetadata = {
|
|
271
|
+
...existing,
|
|
272
|
+
displayName: existing.displayName ?? meta.displayName,
|
|
273
|
+
description: existing.description ?? meta.description,
|
|
274
|
+
logoUrl: existing.logoUrl ?? meta.logoUrl,
|
|
275
|
+
websiteUrl: existing.websiteUrl ?? meta.websiteUrl,
|
|
276
|
+
cDocsUrl: existing.cDocsUrl ?? meta.cDocsUrl,
|
|
277
|
+
license: existing.license ?? meta.license,
|
|
278
|
+
category: existing.category ?? meta.category,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
246
283
|
async cleanup(): Promise<void> {
|
|
247
284
|
if (this.tempDir) {
|
|
248
285
|
await rm(this.tempDir, { recursive: true, force: true });
|