@kirchdev/duxt 0.6.0 → 0.7.0
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/app/components/DuxtOpenApiClient.vue +42 -79
- package/app/components/DuxtSearch.vue +9 -3
- package/app/components/DuxtVersion.vue +7 -7
- package/app/components/content/Mermaid.vue +41 -27
- package/app/composables/useDuxtRequest.ts +167 -0
- package/app/composables/useDuxtVersion.ts +4 -12
- package/app/utils/mermaid-render.ts +31 -0
- package/app/utils/request-samples.ts +68 -24
- package/build/bruno/bruno-parse.ts +13 -1
- package/build/cli/report.ts +0 -0
- package/build/openapi/openapi-parse.ts +24 -4
- package/build/sections/section-input.ts +41 -3
- package/build/sections/sections.ts +1 -1
- package/build/sources/sources-cache.ts +9 -11
- package/build/sources/sources.ts +45 -2
- package/i18n/locales/de/duxt/openapi.json +5 -1
- package/i18n/locales/en/duxt/openapi.json +5 -1
- package/i18n/locales/es/duxt/openapi.json +5 -1
- package/i18n/locales/fr/duxt/openapi.json +5 -1
- package/i18n/locales/pt/duxt/openapi.json +5 -1
- package/modules/redirects.ts +27 -1
- package/package.json +30 -28
- package/server/devtools/entry-path.ts +48 -3
- package/server/devtools/handler.ts +22 -2
- package/server/mcp/tools/list-pages.ts +8 -4
- package/server/mcp/tools/read-page.ts +4 -26
- package/server/mcp/tools/search-docs.ts +11 -18
- package/server/middleware/raw-markdown.ts +7 -41
- package/server/routes/llms-full.txt.get.ts +2 -1
- package/server/routes/llms.txt.get.ts +2 -1
- package/server/routes/rss.xml.get.ts +2 -1
- package/server/utils/doc-page.ts +43 -0
- package/server/utils/mcp-docs.ts +94 -35
- package/server/utils/public-origin.ts +25 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The origin absolute links in a text export are written against.
|
|
5
|
+
*
|
|
6
|
+
* The site's configured URL — the one the canonicals and the sitemap use — and
|
|
7
|
+
* the request's own origin only where none is configured, or in development,
|
|
8
|
+
* where links have to point at the server the developer is looking at. Taken
|
|
9
|
+
* from the request alone, a `Host` header decided every link in `llms.txt`,
|
|
10
|
+
* `llms-full.txt` and the feed, which is harmless until anything caches the
|
|
11
|
+
* response for the next reader.
|
|
12
|
+
*/
|
|
13
|
+
export function duxtPublicOrigin(event: H3Event): string {
|
|
14
|
+
const request = getRequestURL(event).origin;
|
|
15
|
+
if (import.meta.dev) return request;
|
|
16
|
+
|
|
17
|
+
const configured = getSiteConfig(event).url;
|
|
18
|
+
if (!configured) return request;
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
return new URL(configured).origin;
|
|
22
|
+
} catch {
|
|
23
|
+
return request;
|
|
24
|
+
}
|
|
25
|
+
}
|