From 1c860f172f50593dcdcc4aed0c229ed7960c2567 Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Sat, 26 Sep 2026 22:36:07 +0800 Subject: [PATCH 1/2] perf(docs): read documents from the docs site mirror before GitHub --- src/features/docs-client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/docs-client.ts b/src/features/docs-client.ts index 9ad5ca4..8d84a6a 100644 --- a/src/features/docs-client.ts +++ b/src/features/docs-client.ts @@ -1,6 +1,7 @@ import { AsyncLocalStorage } from 'node:async_hooks'; import { createDocsClient, parseDoc } from '@nbtca/docs'; import type { DocItem, DocPage, DocsClient } from '@nbtca/docs'; +import { URLS } from '../config/data.js'; import { createDocsStore } from './docs-store.js'; interface DocsFetchStore { @@ -181,7 +182,8 @@ function beginDocsFetch(): { context: DocsFetchContext; finish(): void } { } const store = createDocsStore(); -const defaultClient = createDocsClient({ store }); +const options = { store, mirror: `${URLS.docs}/docs-api` }; +const defaultClient = createDocsClient(options); const clientsBySignal = new WeakMap(); const clients = new Set([defaultClient]); @@ -190,7 +192,7 @@ function clientFor(signal: AbortSignal | undefined): DocsClient { const existing = clientsBySignal.get(signal); if (existing) return existing; - const client = createDocsClient({ store }); + const client = createDocsClient(options); clientsBySignal.set(signal, client); clients.add(client); signal.addEventListener( From 5e35b1aa95a346665e1f8c440480c27b855b73f1 Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Sat, 26 Sep 2026 23:10:32 +0800 Subject: [PATCH 2/2] build(deps): require @nbtca/docs 0.3.3 for the mirror --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 074f28f..379a71e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.5.16", "license": "MIT", "dependencies": { - "@nbtca/docs": "^0.3.2", + "@nbtca/docs": "^0.3.3", "@nbtca/nbtcal": "^0.4.3", "chalk": "^5.6.2", "marked": "^15.0.12" @@ -770,9 +770,9 @@ "license": "MIT" }, "node_modules/@nbtca/docs": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@nbtca/docs/-/docs-0.3.2.tgz", - "integrity": "sha512-4yGM0fjlbZvq/B4hVmrKNpMYnEK9IYrGhTr55bAS+tg2JJdiGRb0czC3rRSBrnNJQjjP5hz9U34HkRIESp0oNQ==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@nbtca/docs/-/docs-0.3.3.tgz", + "integrity": "sha512-uXxgas3/ymvJ61bYP4R3sfnB4XYC2LyI4ARAEDRnONF+UJX2RL4nHvyCYY9O/xTNklOO/StcZtEV51VKrEMAyA==", "license": "MIT", "engines": { "node": ">=20.12.0" diff --git a/package.json b/package.json index 95a0b75..3407b91 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "interactive" ], "dependencies": { - "@nbtca/docs": "^0.3.2", + "@nbtca/docs": "^0.3.3", "@nbtca/nbtcal": "^0.4.3", "chalk": "^5.6.2", "marked": "^15.0.12"