@@ -3,6 +3,7 @@ import abbr from "markdown-it-abbr";
33import deflist from "markdown-it-deflist" ;
44import footnote from "markdown-it-footnote" ;
55import { jsrRef } from "markdown-it-jsr-ref" ;
6+ import { readFileSync } from "node:fs" ;
67import process from "node:process" ;
78import { ModuleKind , ModuleResolutionKind , ScriptTarget } from "typescript" ;
89import { defineConfig } from "vitepress" ;
@@ -43,6 +44,48 @@ if (process.env.PLAUSIBLE_DOMAIN) {
4344 ] ;
4445}
4546
47+ interface RootDenoConfig {
48+ workspace ?: string [ ] ;
49+ }
50+
51+ interface PackageDenoConfig {
52+ name ?: string ;
53+ publish ?: boolean | { exclude ?: string [ ] } ;
54+ }
55+
56+ function getReferenceItems ( ) : { text : string ; link : string } [ ] {
57+ const repoRootUrl = new URL ( "../../" , import . meta. url ) ;
58+ const rootDenoConfig = JSON . parse (
59+ readFileSync ( new URL ( "deno.json" , repoRootUrl ) , "utf-8" ) ,
60+ ) as RootDenoConfig ;
61+
62+ const names = new Set < string > ( ) ;
63+ for ( const workspaceEntry of rootDenoConfig . workspace ?? [ ] ) {
64+ if ( ! workspaceEntry . startsWith ( "./packages/" ) ) continue ;
65+ const packageDenoJsonUrl = new URL ( `${ workspaceEntry } /deno.json` , repoRootUrl ) ;
66+ const packageDenoConfig = JSON . parse (
67+ readFileSync ( packageDenoJsonUrl , "utf-8" ) ,
68+ ) as PackageDenoConfig ;
69+ if ( packageDenoConfig . publish === false || packageDenoConfig . name == null ) {
70+ continue ;
71+ }
72+ names . add ( packageDenoConfig . name ) ;
73+ }
74+
75+ return Array . from ( names )
76+ . sort ( ( a , b ) =>
77+ a === "@fedify/fedify"
78+ ? - 1
79+ : b === "@fedify/fedify"
80+ ? 1
81+ : a . localeCompare ( b )
82+ )
83+ . map ( ( name ) => ( {
84+ text : name ,
85+ link : `https://jsr.io/${ name } /doc` ,
86+ } ) ) ;
87+ }
88+
4689const TUTORIAL = {
4790 text : "Tutorials" ,
4891 items : [
@@ -88,30 +131,7 @@ const MANUAL = {
88131
89132const REFERENCES = {
90133 text : "References" ,
91- items : [
92- // Don't include @fedify/cli and @fedify/lint here
93- { text : "@fedify/fedify" , link : "https://jsr.io/@fedify/fedify/doc" } ,
94- { text : "@fedify/amqp" , link : "https://jsr.io/@fedify/amqp/doc" } ,
95- { text : "@fedify/astro" , link : "https://jsr.io/@fedify/astro/doc" } ,
96- { text : "@fedify/cfworkers" , link : "https://jsr.io/@fedify/cfworkers/doc" } ,
97- { text : "@fedify/debugger" , link : "https://jsr.io/@fedify/debugger/doc" } ,
98- { text : "@fedify/denokv" , link : "https://jsr.io/@fedify/denokv/doc" } ,
99- { text : "@fedify/express" , link : "https://jsr.io/@fedify/express/doc" } ,
100- { text : "@fedify/fastify" , link : "https://jsr.io/@fedify/fastify/doc" } ,
101- { text : "@fedify/fresh" , link : "https://jsr.io/@fedify/fresh/doc" } ,
102- { text : "@fedify/h3" , link : "https://jsr.io/@fedify/h3/doc" } ,
103- { text : "@fedify/hono" , link : "https://jsr.io/@fedify/hono/doc" } ,
104- { text : "@fedify/koa" , link : "https://jsr.io/@fedify/koa/doc" } ,
105- { text : "@fedify/mysql" , link : "https://jsr.io/@fedify/mysql/doc" } ,
106- { text : "@fedify/postgres" , link : "https://jsr.io/@fedify/postgres/doc" } ,
107- { text : "@fedify/redis" , link : "https://jsr.io/@fedify/redis/doc" } ,
108- { text : "@fedify/relay" , link : "https://jsr.io/@fedify/relay/doc" } ,
109- { text : "@fedify/sqlite" , link : "https://jsr.io/@fedify/sqlite/doc" } ,
110- { text : "@fedify/sveltekit" , link : "https://jsr.io/@fedify/sveltekit/doc" } ,
111- { text : "@fedify/testing" , link : "https://jsr.io/@fedify/testing/doc" } ,
112- { text : "@fedify/vocab-runtime" , link : "https://jsr.io/@fedify/vocab-runtime/doc" } ,
113- { text : "@fedify/vocab-tools" , link : "https://jsr.io/@fedify/vocab-tools/doc" } ,
114- ] ,
134+ items : getReferenceItems ( ) ,
115135} ;
116136
117137export default withMermaid ( defineConfig ( {
0 commit comments