@@ -2,6 +2,8 @@ import type { RemarkPlugin } from "@astrojs/markdown-remark";
22import { deadOrAlive } from "dead-or-alive" ;
33import { visit } from "unist-util-visit" ;
44
5+ const CI = Boolean ( process . env . CI ) ;
6+
57// replaces special Markdown links with Javadoc URLs
68// link format: jd:<javadoc name>[:<module name>][:<fully qualified class name; . as package separator, $ for inner>]
79
@@ -58,13 +60,16 @@ const parse = async (url: string, { targets }: Options): Promise<string | null>
5860 const module = match [ 3 ] ? match [ 2 ] : typeof target !== "string" ? target . module : undefined ;
5961 const parsed = `${ targetUrl } /${ module ? `${ module } /` : "" } ${ asUrl ( name ) } ` ;
6062
61- const result = await deadOrAlive ( parsed , {
62- findUrls : false ,
63- followMetaHttpEquiv : false ,
64- userAgent : "PaperMC/docs (https://docs.papermc.io)" ,
65- } ) ;
66- if ( result . status !== "alive" ) {
67- error ( new Error ( `Received dead status for Javadoc link "${ url } "` ) ) ;
63+ if ( CI ) {
64+ // only check links in CI to avoid rate limiting during local development
65+ const result = await deadOrAlive ( parsed , {
66+ findUrls : false ,
67+ followMetaHttpEquiv : false ,
68+ userAgent : "PaperMC/docs (https://docs.papermc.io)" ,
69+ } ) ;
70+ if ( result . status !== "alive" ) {
71+ error ( new Error ( `Received dead status for Javadoc link "${ url } "` ) ) ;
72+ }
6873 }
6974
7075 return parsed ;
0 commit comments