@farming-labs/svelte 0.1.45 → 0.1.47
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/server.d.ts +1 -0
- package/dist/server.js +6 -1
- package/package.json +2 -2
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import fs from "node:fs";
|
|
31
31
|
import path from "node:path";
|
|
32
32
|
import matter from "gray-matter";
|
|
33
|
-
import { buildDocsAgentDiscoverySpec, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsSkillRequest, normalizeDocsRelated, performDocsSearch, renderDocsMarkdownDocument, renderDocsSkillDocument, resolveDocsAgentMdxContent, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveDocsSkillFormat, } from "@farming-labs/docs";
|
|
33
|
+
import { buildDocsAgentDiscoverySpec, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsSkillRequest, normalizeDocsRelated, performDocsSearch, renderDocsMarkdownDocument, renderDocsSkillDocument, resolveDocsAgentMdxContent, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveReadingTimeFromContent, resolveReadingTimeOptions, resolveDocsSkillFormat, } from "@farming-labs/docs";
|
|
34
34
|
import { createDocsMcpHttpHandler, resolveDocsMcpConfig } from "@farming-labs/docs/server";
|
|
35
35
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree } from "./content.js";
|
|
36
36
|
import { renderMarkdown } from "./markdown.js";
|
|
@@ -346,6 +346,7 @@ export function createDocsServer(config = {}) {
|
|
|
346
346
|
const githubRepo = github?.url;
|
|
347
347
|
const githubBranch = github?.branch ?? "main";
|
|
348
348
|
const githubContentPath = github?.directory;
|
|
349
|
+
const readingTimeOptions = resolveReadingTimeOptions(config.readingTime);
|
|
349
350
|
const rawPreloaded = config._preloadedContent;
|
|
350
351
|
// Normalize keys: Vite's import.meta.glob may return paths without leading slash (e.g. "docs/...")
|
|
351
352
|
const preloaded = rawPreloaded
|
|
@@ -478,6 +479,9 @@ export function createDocsServer(config = {}) {
|
|
|
478
479
|
}
|
|
479
480
|
const { data, content } = matter(raw);
|
|
480
481
|
const humanRawContent = resolveDocsAgentMdxContent(content, "human");
|
|
482
|
+
const readingTime = readingTimeOptions.enabled
|
|
483
|
+
? resolveReadingTimeFromContent(data, humanRawContent, readingTimeOptions.wordsPerMinute)
|
|
484
|
+
: null;
|
|
481
485
|
const html = await renderMarkdown(humanRawContent, { theme: config.theme });
|
|
482
486
|
const currentUrl = isIndex ? `/${entry}` : `/${entry}/${slug}`;
|
|
483
487
|
const currentIndex = flatPages.findIndex((p) => p.url === currentUrl);
|
|
@@ -498,6 +502,7 @@ export function createDocsServer(config = {}) {
|
|
|
498
502
|
title: data.title ?? fallbackTitle,
|
|
499
503
|
description: data.description,
|
|
500
504
|
html,
|
|
505
|
+
readingTime,
|
|
501
506
|
entry,
|
|
502
507
|
locale: ctx.locale,
|
|
503
508
|
...(isIndex ? {} : { slug }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.10.0",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"@farming-labs/docs": "0.1.
|
|
59
|
+
"@farming-labs/docs": "0.1.47"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@farming-labs/docs": "*"
|