@@ -3,6 +3,7 @@ import { gunzipSync } from "node:zlib";
33import { resolve , dirname } from "node:path" ;
44import { fileURLToPath } from "node:url" ;
55import { GAME_LIST , SITE_ORIGIN } from "../src/games-list.ts" ;
6+ import { parseSchemas , type SchemasJson } from "../src/data/schemas.ts" ;
67
78const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
89const schemasDir = resolve ( __dirname , "../schemas" ) ;
@@ -47,20 +48,19 @@ const indexEntries: { file: string; lastmod?: string }[] = [];
4748
4849for ( const game of GAME_LIST ) {
4950 const buf = readFileSync ( resolve ( schemasDir , `${ game . id } .json.gz` ) ) ;
50- const data = JSON . parse ( gunzipSync ( buf ) . toString ( "utf-8" ) ) ;
51+ const data : SchemasJson = JSON . parse ( gunzipSync ( buf ) . toString ( "utf-8" ) ) ;
52+ const { declarations, metadata } = parseSchemas ( data ) ;
5153
52- const isoDate = data . version_date ? toIsoDate ( data . version_date , data . version_time ) : undefined ;
54+ const isoDate = metadata . versionDate
55+ ? toIsoDate ( metadata . versionDate , metadata . versionTime )
56+ : undefined ;
5357
5458 mainUrls . push ( { loc : `${ SITE_ORIGIN } ${ basePath } /${ game . id } ` , lastmod : isoDate } ) ;
5559
5660 const byModule = new Map < string , string [ ] > ( ) ;
57- for ( const cls of data . classes ?? [ ] ) {
58- if ( ! byModule . has ( cls . module ) ) byModule . set ( cls . module , [ ] ) ;
59- byModule . get ( cls . module ) ! . push ( cls . name ) ;
60- }
61- for ( const enm of data . enums ?? [ ] ) {
62- if ( ! byModule . has ( enm . module ) ) byModule . set ( enm . module , [ ] ) ;
63- byModule . get ( enm . module ) ! . push ( enm . name ) ;
61+ for ( const d of declarations ) {
62+ if ( ! byModule . has ( d . module ) ) byModule . set ( d . module , [ ] ) ;
63+ byModule . get ( d . module ) ! . push ( d . name ) ;
6464 }
6565
6666 for ( const mod of byModule . keys ( ) ) {
@@ -70,10 +70,7 @@ for (const game of GAME_LIST) {
7070 // Per-game sitemap: all declarations
7171 const gameUrls : SitemapUrl [ ] = [ ] ;
7272 for ( const [ mod , names ] of byModule ) {
73- const seen = new Set < string > ( ) ;
7473 for ( const name of names ) {
75- if ( seen . has ( name ) ) continue ;
76- seen . add ( name ) ;
7774 gameUrls . push ( {
7875 loc : `${ SITE_ORIGIN } ${ basePath } /${ game . id } /${ mod } /${ name } ` ,
7976 } ) ;
0 commit comments