@farming-labs/theme 0.1.131 → 0.1.132
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/dist/docs-api.mjs +8 -2
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -1121,6 +1121,7 @@ function resolvePublicMarkdownRequest(entry, docsPath, url, request) {
|
|
|
1121
1121
|
function renderMarkdownDocument(page, options = {}) {
|
|
1122
1122
|
return renderDocsMarkdownDocument(page, {
|
|
1123
1123
|
llms: options.llmsEnabled !== false,
|
|
1124
|
+
origin: options.origin,
|
|
1124
1125
|
sitemap: options.sitemap
|
|
1125
1126
|
});
|
|
1126
1127
|
}
|
|
@@ -2015,7 +2016,7 @@ function createDocsAPI(options) {
|
|
|
2015
2016
|
markdownSourcesByLocale.set(key, sources);
|
|
2016
2017
|
return sources;
|
|
2017
2018
|
}
|
|
2018
|
-
async function getMarkdownDocument(ctx, requestedPath) {
|
|
2019
|
+
async function getMarkdownDocument(ctx, requestedPath, origin) {
|
|
2019
2020
|
const normalizedRequest = normalizeRequestedMarkdownPath(ctx.entryPath, requestedPath);
|
|
2020
2021
|
const normalizedPublicRequest = normalizePublicRequestedMarkdownPath(ctx, requestedPath);
|
|
2021
2022
|
const normalizedEntry = `/${normalizePathSegment(ctx.entryPath)}`;
|
|
@@ -2025,6 +2026,7 @@ function createDocsAPI(options) {
|
|
|
2025
2026
|
const page = findDocsMcpPage(ctx.entryPath, await source.getPages(), requestedPath);
|
|
2026
2027
|
if (page) return renderMarkdownDocument(withPublicDocsUrl(page, ctx), {
|
|
2027
2028
|
llmsEnabled: llmsConfig.enabled,
|
|
2029
|
+
origin,
|
|
2028
2030
|
sitemap: sitemapConfig
|
|
2029
2031
|
});
|
|
2030
2032
|
}
|
|
@@ -2034,11 +2036,13 @@ function createDocsAPI(options) {
|
|
|
2034
2036
|
});
|
|
2035
2037
|
if (fallbackPage) return renderMarkdownDocument(withPublicDocsUrl(fallbackPage, ctx), {
|
|
2036
2038
|
llmsEnabled: llmsConfig.enabled,
|
|
2039
|
+
origin,
|
|
2037
2040
|
sitemap: sitemapConfig
|
|
2038
2041
|
});
|
|
2039
2042
|
const requestedSlug = normalizePublicDocsSlug(ctx, normalizedPublicRequest);
|
|
2040
2043
|
for (const page of getIndexes(ctx)) if (normalizePublicDocsSlug(ctx, page.url) === requestedSlug) return renderMarkdownDocument(withPublicDocsUrl(page, ctx), {
|
|
2041
2044
|
llmsEnabled: llmsConfig.enabled,
|
|
2045
|
+
origin,
|
|
2042
2046
|
sitemap: sitemapConfig
|
|
2043
2047
|
});
|
|
2044
2048
|
return null;
|
|
@@ -2197,7 +2201,8 @@ function createDocsAPI(options) {
|
|
|
2197
2201
|
if (sitemapResponse) return sitemapResponse;
|
|
2198
2202
|
const markdownRequest = resolveMarkdownRequest(entry, url, request) ?? resolvePublicMarkdownRequest(entry, docsPath, url, request);
|
|
2199
2203
|
if (markdownRequest) {
|
|
2200
|
-
const
|
|
2204
|
+
const markdownOrigin = llmsConfig.baseUrl || url.origin;
|
|
2205
|
+
const document = await getMarkdownDocument(ctx, markdownRequest.requestedPath, markdownOrigin);
|
|
2201
2206
|
const varyHeader = getDocsMarkdownVaryHeader(request);
|
|
2202
2207
|
const canonicalLinkHeader = getPublicMarkdownCanonicalLinkHeader({
|
|
2203
2208
|
origin: url.origin,
|
|
@@ -2247,6 +2252,7 @@ function createDocsAPI(options) {
|
|
|
2247
2252
|
return new Response(renderDocsMarkdownNotFound({
|
|
2248
2253
|
entry,
|
|
2249
2254
|
requestedPath: markdownRequest.requestedPath,
|
|
2255
|
+
origin: markdownOrigin,
|
|
2250
2256
|
pages: recoveryPages,
|
|
2251
2257
|
sitemap: sitemapConfig
|
|
2252
2258
|
}), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.132",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsdown": "^0.20.3",
|
|
140
140
|
"typescript": "^5.9.3",
|
|
141
141
|
"vitest": "^3.2.4",
|
|
142
|
-
"@farming-labs/docs": "0.1.
|
|
142
|
+
"@farming-labs/docs": "0.1.132"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"@farming-labs/docs": ">=0.0.1",
|