fumadocs-core 16.19.1 → 16.19.3
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/{algolia-CQ_t21WZ.d.ts → algolia-Dge_7SWa.d.ts} +1 -1
- package/dist/{client-Ca0pBjkk.d.ts → client--MDSaH5X.d.ts} +2 -2
- package/dist/content/mdx/preset-bundler.d.ts +2 -2
- package/dist/content/mdx/preset-runtime.d.ts +2 -2
- package/dist/framework/plugin.d.ts +1 -1
- package/dist/framework/tanstack.js +2 -11
- package/dist/{index-DKOSCE6a.d.ts → index-DuwVLhPl.d.ts} +1 -1
- package/dist/{index-DqVvRMMI.d.ts → index-Dyo_baWl.d.ts} +14 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/mdx-plugins/index.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +1 -1
- package/dist/mdx-plugins/remark-heading.js +6 -0
- package/dist/mdx-plugins/remark-heading.runtime.d.ts +3 -3
- package/dist/mdx-plugins/remark-heading.runtime.js +3 -3
- package/dist/mdx-plugins/remark-include.js +3 -1
- package/dist/{meilisearch-BngEnZgG.d.ts → meilisearch-B_1NqhPM.d.ts} +1 -1
- package/dist/{mixedbread-d8e8wgqx.d.ts → mixedbread-TsMvtWf7.d.ts} +2 -2
- package/dist/{remark-heading-BfD2dpns.d.ts → remark-heading-Bvi2ERAo.d.ts} +4 -1
- package/dist/search/algolia.d.ts +1 -1
- package/dist/search/client/algolia.d.ts +1 -1
- package/dist/search/client/docs-search.d.ts +1 -1
- package/dist/search/client/fetch.d.ts +1 -1
- package/dist/search/client/flexsearch-static.d.ts +1 -1
- package/dist/search/client/meilisearch.d.ts +1 -1
- package/dist/search/client/mixedbread.d.ts +2 -2
- package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/client/orama-cloud.d.ts +1 -1
- package/dist/search/client/orama-static.d.ts +1 -1
- package/dist/search/client.d.ts +1 -1
- package/dist/search/flexsearch.d.ts +2 -2
- package/dist/search/flexsearch.js +35 -38
- package/dist/search/meilisearch.d.ts +1 -1
- package/dist/search/mixedbread.d.ts +2 -2
- package/dist/search/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/orama-cloud.d.ts +2 -2
- package/dist/search/server.d.ts +1 -1
- package/dist/{server-BJlZvi0B.d.ts → server-CGBYXzEo.d.ts} +1 -1
- package/dist/source/dynamic.d.ts +1 -1
- package/dist/source/index.d.ts +1 -1
- package/dist/source/llms.d.ts +1 -1
- package/dist/source/llms.js +83 -47
- package/dist/source/plugins/lucide-icons.d.ts +1 -1
- package/dist/source/plugins/slugs.d.ts +1 -1
- package/dist/source/plugins/status-badges.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
|
|
2
|
-
import { D as LoaderOutput, T as LoaderConfig } from "./index-
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig } from "./index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
4
4
|
import { Algoliasearch } from "algoliasearch";
|
|
5
5
|
interface DocumentRecord {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as SortedResult } from "./index-BlFx9iJj.js";
|
|
2
2
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
3
|
-
import { t as BaseIndex } from "./algolia-
|
|
4
|
-
import "./mixedbread-
|
|
3
|
+
import { t as BaseIndex } from "./algolia-Dge_7SWa.js";
|
|
4
|
+
import "./mixedbread-TsMvtWf7.js";
|
|
5
5
|
import { DependencyList } from "react";
|
|
6
6
|
import { AnyZBSearch, SearchParams } from "zbsearch";
|
|
7
7
|
import { Root } from "hast";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as RehypeCodeOptions } from "../../rehype-code-Czh_8L5z.js";
|
|
2
2
|
import { t as RemarkImageOptions } from "../../remark-image-BwyGdFld.js";
|
|
3
3
|
import { t as StructureOptions } from "../../remark-structure-CV606E7e.js";
|
|
4
|
-
import { t as RemarkHeadingOptions } from "../../remark-heading-
|
|
4
|
+
import { t as RemarkHeadingOptions } from "../../remark-heading-Bvi2ERAo.js";
|
|
5
5
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bp3EItqr.js";
|
|
6
6
|
import { t as RemarkNpmOptions } from "../../remark-npm-IH35Vls_.js";
|
|
7
|
-
import "../../index-
|
|
7
|
+
import "../../index-DuwVLhPl.js";
|
|
8
8
|
import { t as ResolvePlugins } from "../../util-YfkucgkA.js";
|
|
9
9
|
import { Pluggable } from "unified";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as RehypeCodeOptions } from "../../rehype-code-Czh_8L5z.js";
|
|
2
2
|
import { t as RemarkImageOptions } from "../../remark-image-BwyGdFld.js";
|
|
3
3
|
import { t as StructureOptions } from "../../remark-structure-CV606E7e.js";
|
|
4
|
-
import { t as RemarkHeadingOptions } from "../../remark-heading-
|
|
4
|
+
import { t as RemarkHeadingOptions } from "../../remark-heading-Bvi2ERAo.js";
|
|
5
5
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bp3EItqr.js";
|
|
6
6
|
import { t as RemarkNpmOptions } from "../../remark-npm-IH35Vls_.js";
|
|
7
|
-
import "../../index-
|
|
7
|
+
import "../../index-DuwVLhPl.js";
|
|
8
8
|
import { t as ResolvePlugins } from "../../util-YfkucgkA.js";
|
|
9
9
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
10
10
|
export type MDXRuntimePresetOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins'> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as TranslationExtension } from "../index-DFrWGSeW.js";
|
|
2
2
|
import { n as StructuredData } from "../remark-structure-CV606E7e.js";
|
|
3
|
-
import { D as LoaderOutput, E as LoaderOptions, T as LoaderConfig, k as LoaderPluginOption } from "../index-
|
|
3
|
+
import { D as LoaderOutput, E as LoaderOptions, T as LoaderConfig, k as LoaderPluginOption } from "../index-Dyo_baWl.js";
|
|
4
4
|
import { c as TOCItemType } from "../toc-BuHOTlzj.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FrameworkProvider } from "./index.js";
|
|
2
|
-
import { useMemo
|
|
2
|
+
import { useMemo } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Link, useParams, useRouter, useRouterState } from "@tanstack/react-router";
|
|
5
5
|
// src/framework/tanstack.tsx
|
|
@@ -23,16 +23,7 @@ const framework = {
|
|
|
23
23
|
});
|
|
24
24
|
},
|
|
25
25
|
usePathname() {
|
|
26
|
-
|
|
27
|
-
isLoading: state.isLoading,
|
|
28
|
-
pathname: state.location.pathname
|
|
29
|
-
}) });
|
|
30
|
-
const activePathname = useRef(pathname);
|
|
31
|
-
return useMemo(() => {
|
|
32
|
-
if (isLoading) return activePathname.current;
|
|
33
|
-
activePathname.current = pathname;
|
|
34
|
-
return pathname;
|
|
35
|
-
}, [isLoading, pathname]);
|
|
26
|
+
return useRouterState({ select: (state) => (state.isLoading && state.resolvedLocation || state.location).pathname });
|
|
36
27
|
},
|
|
37
28
|
useRouter() {
|
|
38
29
|
const router = useRouter();
|
|
@@ -3,7 +3,7 @@ import "./rehype-code-Czh_8L5z.js";
|
|
|
3
3
|
import "./remark-image-BwyGdFld.js";
|
|
4
4
|
import "./remark-include-D_FmDdtI.js";
|
|
5
5
|
import "./remark-structure-CV606E7e.js";
|
|
6
|
-
import "./remark-heading-
|
|
6
|
+
import "./remark-heading-Bvi2ERAo.js";
|
|
7
7
|
import "./remark-admonition-BxacgP6i.js";
|
|
8
8
|
import "./remark-directive-admonition-BT_PH6hL.js";
|
|
9
9
|
import "./rehype-toc-B0HyD0yu.js";
|
|
@@ -3,7 +3,7 @@ import { n as I18nConfig } from "./index-DFrWGSeW.js";
|
|
|
3
3
|
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
|
|
4
4
|
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-BQVehOBz.js";
|
|
5
5
|
import { n as SerializedPageTree } from "./index-B2EN5xn0.js";
|
|
6
|
-
import "./index-
|
|
6
|
+
import "./index-DuwVLhPl.js";
|
|
7
7
|
import "./index-DMxrC6WS.js";
|
|
8
8
|
import { ReactNode } from "react";
|
|
9
9
|
/**
|
|
@@ -561,6 +561,16 @@ interface LLMsConfig<Page = unknown> {
|
|
|
561
561
|
* The pages in `full()` and the files, every page by default.
|
|
562
562
|
*/
|
|
563
563
|
filter?: (page: Page) => boolean;
|
|
564
|
+
/**
|
|
565
|
+
* Whether a folder is a section: a folder with its own `llms-full.txt`. Root folders are sections by default.
|
|
566
|
+
*
|
|
567
|
+
* - `collapse`: list the section in `llms.txt` as one link to its own `llms.txt`, which lists its pages.
|
|
568
|
+
* - `asPath`: the path to serve its files under, instead of the URL of the folder's index page.
|
|
569
|
+
*/
|
|
570
|
+
section?: (folder: Folder, ctx: Context) => boolean | {
|
|
571
|
+
asPath?: string;
|
|
572
|
+
collapse?: boolean;
|
|
573
|
+
};
|
|
564
574
|
}
|
|
565
575
|
interface LLMs<IndexOutput extends Awaitable<string> = Awaitable<string>> {
|
|
566
576
|
/**
|
|
@@ -586,9 +596,10 @@ interface LLMsWithPages<Page, IndexOutput extends Awaitable<string> = Awaitable<
|
|
|
586
596
|
/**
|
|
587
597
|
* The paths of the files for agents, for static output:
|
|
588
598
|
*
|
|
589
|
-
* - `/llms.txt
|
|
590
|
-
* -
|
|
599
|
+
* - `/llms.txt`: the index, with a link to the `.md` file of each page.
|
|
600
|
+
* - `/llms-full.txt`: every page.
|
|
591
601
|
* - `<page>.md`: a page, `/index.md` for `/`.
|
|
602
|
+
* - `<section>/llms-full.txt`: the pages of a section, and `<section>/llms.txt` when it's collapsed, see `section`.
|
|
592
603
|
*
|
|
593
604
|
* @param lang - only the pages of a language, required when URLs don't have the locale (`hideLocale: 'always'`)
|
|
594
605
|
*/
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as SearchServer } from "./server-
|
|
2
|
-
import { D as LoaderOutput, T as LoaderConfig, r as LLMsWithPages } from "./index-
|
|
1
|
+
import { r as SearchServer } from "./server-CGBYXzEo.js";
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig, r as LLMsWithPages } from "./index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
5
5
|
/**
|
|
@@ -5,7 +5,7 @@ import { n as rehypeCode, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions
|
|
|
5
5
|
import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-BwyGdFld.js";
|
|
6
6
|
import { n as extractCodeRegion, r as remarkInclude, t as RemarkIncludeOptions } from "../remark-include-D_FmDdtI.js";
|
|
7
7
|
import { a as remarkStructureDefaultOptions, i as remarkStructure, n as StructuredData, o as structure, r as StructuredDataContent, t as StructureOptions } from "../remark-structure-CV606E7e.js";
|
|
8
|
-
import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-
|
|
8
|
+
import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Bvi2ERAo.js";
|
|
9
9
|
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-BxacgP6i.js";
|
|
10
10
|
import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BT_PH6hL.js";
|
|
11
11
|
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-B0HyD0yu.js";
|
|
@@ -18,5 +18,5 @@ import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-m
|
|
|
18
18
|
import { n as RemarkFeedbackBlockOptions, r as remarkFeedbackBlock, t as FeedbackBlockProps } from "../remark-feedback-block-2Ei4IDr4.js";
|
|
19
19
|
import { t as remarkShow } from "../remark-show-uR9rtiVe.js";
|
|
20
20
|
import { t as LLMsOptions } from "../remark-llms-BCyfmS02.js";
|
|
21
|
-
import "../index-
|
|
21
|
+
import "../index-DuwVLhPl.js";
|
|
22
22
|
export { CodeBlockAttributes, type CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, type LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, type RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, RemarkIncludeOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, StructuredDataContent, extractCodeRegion, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeHeading, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkInclude, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkShow, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-
|
|
1
|
+
import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Bvi2ERAo.js";
|
|
2
2
|
export { RemarkHeadingOptions, rehypeHeading, remarkHeading };
|
|
@@ -39,6 +39,12 @@ function remarkHeading({ slug, slugImportSource, customId = true, generateToc =
|
|
|
39
39
|
props.id = slug(root, heading, text);
|
|
40
40
|
const code = fromCode && ids.next(heading.children, when);
|
|
41
41
|
if (code) (file.data._headingIds ??= {})[props.id] = code;
|
|
42
|
+
} else {
|
|
43
|
+
slug(root, heading, props.id);
|
|
44
|
+
if (fromCode) ids.next([{
|
|
45
|
+
type: "text",
|
|
46
|
+
value: props.id
|
|
47
|
+
}], when);
|
|
42
48
|
}
|
|
43
49
|
if (generateToc) toc.push({
|
|
44
50
|
title: text ?? flattenNode(heading),
|
|
@@ -3,9 +3,9 @@ declare function createSlugger(): (text: string) => string;
|
|
|
3
3
|
* The IDs of the headings of a page for its props.
|
|
4
4
|
*
|
|
5
5
|
* @param ids - list the ID of each heading in document order: `slug` takes the parts of the text of a heading that
|
|
6
|
-
* shows, a hidden heading has an empty ID
|
|
7
|
-
* @param slugger - create the slug function of a page, called with the text of each heading that shows in
|
|
8
|
-
* order, so it can count duplicates
|
|
6
|
+
* shows, or its custom ID, a hidden heading has an empty ID
|
|
7
|
+
* @param slugger - create the slug function of a page, called with the text or custom ID of each heading that shows in
|
|
8
|
+
* document order, so it can count duplicates
|
|
9
9
|
*/
|
|
10
10
|
export declare function createHeadingIds(ids: (props: object, slug: (parts: unknown[]) => string) => string[], slugger?: typeof createSlugger): (props: object) => string[];
|
|
11
11
|
export {};
|
|
@@ -8,9 +8,9 @@ function createSlugger() {
|
|
|
8
8
|
* The IDs of the headings of a page for its props.
|
|
9
9
|
*
|
|
10
10
|
* @param ids - list the ID of each heading in document order: `slug` takes the parts of the text of a heading that
|
|
11
|
-
* shows, a hidden heading has an empty ID
|
|
12
|
-
* @param slugger - create the slug function of a page, called with the text of each heading that shows in
|
|
13
|
-
* order, so it can count duplicates
|
|
11
|
+
* shows, or its custom ID, a hidden heading has an empty ID
|
|
12
|
+
* @param slugger - create the slug function of a page, called with the text or custom ID of each heading that shows in
|
|
13
|
+
* document order, so it can count duplicates
|
|
14
14
|
*/
|
|
15
15
|
function createHeadingIds(ids, slugger = createSlugger) {
|
|
16
16
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -138,7 +138,9 @@ function extractSection(tree, section) {
|
|
|
138
138
|
/** the ID `remark-heading` gives a heading */
|
|
139
139
|
function headingId(heading, slugger) {
|
|
140
140
|
const last = heading.children.at(-1);
|
|
141
|
-
|
|
141
|
+
const custom = last?.type === "text" ? headingIdRegex.exec(last.value)?.[1] : void 0;
|
|
142
|
+
const id = slugger.slug(custom ?? flattenNode(heading));
|
|
143
|
+
return custom ?? id;
|
|
142
144
|
}
|
|
143
145
|
const regionMarkers = [
|
|
144
146
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
|
|
2
|
-
import { D as LoaderOutput, T as LoaderConfig } from "./index-
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig } from "./index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
4
4
|
import { Meilisearch } from "meilisearch";
|
|
5
5
|
interface DocumentRecord {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as SortedResult } from "./index-BlFx9iJj.js";
|
|
2
|
-
import { n as SearchAPI } from "./server-
|
|
3
|
-
import { t as DocumentRecord } from "./meilisearch-
|
|
2
|
+
import { n as SearchAPI } from "./server-CGBYXzEo.js";
|
|
3
|
+
import { t as DocumentRecord } from "./meilisearch-B_1NqhPM.js";
|
|
4
4
|
import Mixedbread from "@mixedbread/sdk";
|
|
5
5
|
import { ScoredTextInputChunk } from "@mixedbread/sdk/resources/stores";
|
|
6
6
|
/**
|
|
@@ -3,7 +3,10 @@ import * as Hast from "hast";
|
|
|
3
3
|
import { Transformer } from "unified";
|
|
4
4
|
import { Heading, Root as Root$1 } from "mdast";
|
|
5
5
|
interface RemarkHeadingOptions {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* slug the IDs of headings, the IDs slugged when rendering come from `slugImportSource`. Custom IDs are slugged too,
|
|
8
|
+
* so a slugger can count them as duplicates.
|
|
9
|
+
*/
|
|
7
10
|
slug?: (root: Root$1, heading: Heading, text: string) => string;
|
|
8
11
|
/**
|
|
9
12
|
* The module that slugs IDs when rendering, compiled pages import `createHeadingIds()` from it like the JSX runtime
|
package/dist/search/algolia.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as sync, i as setIndexSettings, n as DocumentRecord, o as toDocuments, r as SyncOptions, s as updateDocuments, t as BaseIndex } from "../algolia-
|
|
1
|
+
import { a as sync, i as setIndexSettings, n as DocumentRecord, o as toDocuments, r as SyncOptions, s as updateDocuments, t as BaseIndex } from "../algolia-Dge_7SWa.js";
|
|
2
2
|
export { BaseIndex, DocumentRecord, SyncOptions, setIndexSettings, sync, toDocuments, updateDocuments };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client
|
|
1
|
+
import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { AlgoliaOptions, algoliaClient, useAlgoliaSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client
|
|
1
|
+
import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { ClientPreset, SearchClient, useDocsSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client
|
|
1
|
+
import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { FetchOptions, fetchClient, useFetchSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client
|
|
1
|
+
import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { FlexsearchStaticOptions, flexsearchStaticClient, useFlexsearchStatic };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client
|
|
1
|
+
import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { MeilisearchOptions, meilisearchClient, useMeilisearch };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client
|
|
2
|
-
import { n as SearchMetadata } from "../../mixedbread-
|
|
1
|
+
import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client--MDSaH5X.js";
|
|
2
|
+
import { n as SearchMetadata } from "../../mixedbread-TsMvtWf7.js";
|
|
3
3
|
export { MixedbreadOptions, type SearchMetadata, mixedbreadClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as useOramaCloudLegacySearch, l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client
|
|
1
|
+
import { d as useOramaCloudLegacySearch, l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { OramaCloudLegacyOptions, oramaCloudLegacyClient, useOramaCloudLegacySearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client
|
|
1
|
+
import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { OramaCloudOptions, oramaCloudClient, useOramaCloudSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as staticClient, S as oramaStaticClient, w as useStaticSearch, x as StaticOptions } from "../../client
|
|
1
|
+
import { C as staticClient, S as oramaStaticClient, w as useStaticSearch, x as StaticOptions } from "../../client--MDSaH5X.js";
|
|
2
2
|
export { StaticOptions, oramaStaticClient, staticClient, useStaticSearch };
|
package/dist/search/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SearchResultRecord, D as useFetchSearch, F as useSearch, M as UseSearchOptions, N as UseSearchReturn, O as SearchResult, P as useHighlightQuery, T as FetchOptions, _ as useOramaCloudSearch, b as useAlgoliaSearch, f as MeilisearchOptions, h as OramaCloudOptions, j as SearchResultTable, k as SearchResultItem, m as useMeilisearch, n as SearchClient, r as useDocsSearch, t as ClientPreset, v as AlgoliaOptions, w as useStaticSearch, x as StaticOptions } from "../client
|
|
1
|
+
import { A as SearchResultRecord, D as useFetchSearch, F as useSearch, M as UseSearchOptions, N as UseSearchReturn, O as SearchResult, P as useHighlightQuery, T as FetchOptions, _ as useOramaCloudSearch, b as useAlgoliaSearch, f as MeilisearchOptions, h as OramaCloudOptions, j as SearchResultTable, k as SearchResultItem, m as useMeilisearch, n as SearchClient, r as useDocsSearch, t as ClientPreset, v as AlgoliaOptions, w as useStaticSearch, x as StaticOptions } from "../client--MDSaH5X.js";
|
|
2
2
|
export { type AlgoliaOptions, type ClientPreset, type FetchOptions, type MeilisearchOptions, type OramaCloudOptions, type SearchClient, type SearchResult, type SearchResultItem, type SearchResultRecord, type SearchResultTable, type StaticOptions, type UseSearchOptions, type UseSearchReturn, useSearch as experimental_useSearch, useAlgoliaSearch, useDocsSearch, useFetchSearch, useHighlightQuery, useMeilisearch, useOramaCloudSearch, useStaticSearch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-
|
|
2
|
-
import { D as LoaderOutput, T as LoaderConfig } from "../index-
|
|
1
|
+
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-CGBYXzEo.js";
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "../types-Dvkw0Kd0.js";
|
|
4
4
|
import { n as I18nConfig } from "../index-DFrWGSeW.js";
|
|
5
5
|
import "../index-BlFx9iJj.js";
|
|
@@ -29,41 +29,31 @@ function server(options) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
for (const index of indexes) {
|
|
39
|
-
let list = indexMap.get(index.locale);
|
|
40
|
-
if (!list) {
|
|
41
|
-
list = [];
|
|
42
|
-
indexMap.set(index.locale, list);
|
|
43
|
-
}
|
|
44
|
-
list.push(index);
|
|
45
|
-
}
|
|
46
|
-
for (const [locale, list] of indexMap) {
|
|
32
|
+
/** a server for each locale, built on its first use */
|
|
33
|
+
function localeServers(i18n, getIndexes, { localeMap, document }) {
|
|
34
|
+
const servers = /* @__PURE__ */ new Map();
|
|
35
|
+
function get(locale) {
|
|
36
|
+
let localeServer = servers.get(locale);
|
|
37
|
+
if (!localeServer) {
|
|
47
38
|
const override = localeMap?.[locale];
|
|
48
|
-
|
|
49
|
-
indexes:
|
|
39
|
+
localeServer = server({
|
|
40
|
+
indexes: () => getIndexes(locale),
|
|
50
41
|
document: override === "cjk" ? {
|
|
51
|
-
...
|
|
42
|
+
...document,
|
|
52
43
|
encoder: Search.Charset.CJK
|
|
53
44
|
} : {
|
|
54
|
-
...
|
|
45
|
+
...document,
|
|
55
46
|
...override
|
|
56
47
|
}
|
|
57
|
-
})
|
|
48
|
+
});
|
|
49
|
+
servers.set(locale, localeServer);
|
|
58
50
|
}
|
|
59
|
-
return
|
|
51
|
+
return localeServer;
|
|
60
52
|
}
|
|
61
|
-
const get = initSearchServers();
|
|
62
53
|
return {
|
|
63
54
|
async export() {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
return [k, (await v.export()).raw];
|
|
55
|
+
const entries = i18n.languages.map(async (locale) => {
|
|
56
|
+
return [locale, (await get(locale).export()).raw];
|
|
67
57
|
});
|
|
68
58
|
return {
|
|
69
59
|
type: "i18n",
|
|
@@ -71,12 +61,24 @@ function serverI18n(options) {
|
|
|
71
61
|
};
|
|
72
62
|
},
|
|
73
63
|
async search(query, searchOptions) {
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
64
|
+
const locale = searchOptions?.locale ?? i18n.defaultLanguage;
|
|
65
|
+
if (!i18n.languages.includes(locale)) return [];
|
|
66
|
+
return get(locale).search(query, searchOptions);
|
|
77
67
|
}
|
|
78
68
|
};
|
|
79
69
|
}
|
|
70
|
+
function serverI18n({ i18n, indexes, ...options }) {
|
|
71
|
+
const indexMap = Promise.resolve(typeof indexes === "function" ? indexes() : indexes).then((list) => {
|
|
72
|
+
const map = /* @__PURE__ */ new Map();
|
|
73
|
+
for (const index of list) {
|
|
74
|
+
const items = map.get(index.locale);
|
|
75
|
+
if (items) items.push(index);
|
|
76
|
+
else map.set(index.locale, [index]);
|
|
77
|
+
}
|
|
78
|
+
return map;
|
|
79
|
+
});
|
|
80
|
+
return localeServers(i18n, async (locale) => (await indexMap).get(locale) ?? [], options);
|
|
81
|
+
}
|
|
80
82
|
function flexsearch(options) {
|
|
81
83
|
return createEndpoint(server(options));
|
|
82
84
|
}
|
|
@@ -89,23 +91,18 @@ function flexsearchI18n(options) {
|
|
|
89
91
|
function flexsearchFromSource(loader, options = {}) {
|
|
90
92
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
91
93
|
const { buildIndex = buildIndexDefault, ...rest } = options;
|
|
92
|
-
|
|
94
|
+
function initServer(loader) {
|
|
93
95
|
const getBreadcrumbs = createBreadcrumbs(loader);
|
|
94
|
-
const
|
|
96
|
+
const getIndexes = (locale) => Promise.all(loader.getPages(locale).map(async (page) => {
|
|
95
97
|
const index = await buildIndex(page);
|
|
96
98
|
return {
|
|
97
99
|
...index,
|
|
98
|
-
locale: page.locale,
|
|
99
100
|
breadcrumbs: index.breadcrumbs ?? getBreadcrumbs(page)
|
|
100
101
|
};
|
|
101
102
|
}));
|
|
102
|
-
if (loader._i18n) return
|
|
103
|
-
indexes,
|
|
104
|
-
i18n: loader._i18n,
|
|
105
|
-
...rest
|
|
106
|
-
});
|
|
103
|
+
if (loader._i18n) return localeServers(loader._i18n, getIndexes, rest);
|
|
107
104
|
return server({
|
|
108
|
-
indexes,
|
|
105
|
+
indexes: () => getIndexes(),
|
|
109
106
|
...rest
|
|
110
107
|
});
|
|
111
108
|
}
|
|
@@ -116,7 +113,7 @@ function flexsearchFromSource(loader, options = {}) {
|
|
|
116
113
|
server = initServer(l);
|
|
117
114
|
cache.set(l, server);
|
|
118
115
|
}
|
|
119
|
-
return
|
|
116
|
+
return server;
|
|
120
117
|
}
|
|
121
118
|
return createEndpoint({
|
|
122
119
|
async export() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as toDocuments, i as sync, n as MeilisearchDocument, r as SyncOptions, t as DocumentRecord } from "../meilisearch-
|
|
1
|
+
import { a as toDocuments, i as sync, n as MeilisearchDocument, r as SyncOptions, t as DocumentRecord } from "../meilisearch-B_1NqhPM.js";
|
|
2
2
|
export { DocumentRecord, MeilisearchDocument, SyncOptions, sync, toDocuments };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as toDocuments, t as DocumentRecord } from "../meilisearch-
|
|
2
|
-
import { a as sync, i as createMixedbreadSearchAPI, n as SearchMetadata, r as SyncOptions, t as MixedbreadSearchOptions } from "../mixedbread-
|
|
1
|
+
import { a as toDocuments, t as DocumentRecord } from "../meilisearch-B_1NqhPM.js";
|
|
2
|
+
import { a as sync, i as createMixedbreadSearchAPI, n as SearchMetadata, r as SyncOptions, t as MixedbreadSearchOptions } from "../mixedbread-TsMvtWf7.js";
|
|
3
3
|
export { type DocumentRecord, MixedbreadSearchOptions, SearchMetadata, SyncOptions, createMixedbreadSearchAPI, sync, toDocuments };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-DuwVLhPl.js";
|
|
2
2
|
import { n as StructuredData } from "../remark-structure-CV606E7e.js";
|
|
3
|
-
import { D as LoaderOutput, T as LoaderConfig } from "../index-
|
|
3
|
+
import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
|
|
4
4
|
import { t as Awaitable } from "../types-Dvkw0Kd0.js";
|
|
5
5
|
import { OramaCloud } from "@orama/core";
|
|
6
6
|
export interface SyncOptions {
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-
|
|
1
|
+
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-CGBYXzEo.js";
|
|
2
2
|
export { AdvancedIndex, AdvancedOptions, ExportedData, Index, QueryOptions, SearchAPI, SearchServer, SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as I18nConfig } from "./index-DFrWGSeW.js";
|
|
2
|
-
import { D as LoaderOutput, T as LoaderConfig } from "./index-
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig } from "./index-Dyo_baWl.js";
|
|
3
3
|
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
|
|
4
4
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
5
5
|
import { r as SortedResult } from "./index-BlFx9iJj.js";
|
package/dist/source/dynamic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { b as DynamicLoaderConfig, x as dynamicLoader, y as DynamicLoader } from "../index-
|
|
1
|
+
import { b as DynamicLoaderConfig, x as dynamicLoader, y as DynamicLoader } from "../index-Dyo_baWl.js";
|
|
2
2
|
export { DynamicLoader, DynamicLoaderConfig, dynamicLoader };
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as Meta, C as InferMetaType, D as LoaderOutput, E as LoaderOptions, F as types_d_exports, G as ContentStorage, H as PageTreeBuilderContext, J as FileSystem, K as ContentStorageMetaFile, M as ResolvedLoaderConfig, N as createGetUrl, O as LoaderPlugin, P as loader, R as getSlugs, S as GetPageOptions, T as LoaderConfig, U as PageTreeOptions, V as PageTreeBuilder, W as PageTreeTransformer, _ as multiple, a as StaticParamsOptions, b as DynamicLoaderConfig, c as path_d_exports, d as PageData, f as Params, g as VirtualFile, h as StaticSource, i as llms, j as Page, k as LoaderPluginOption, l as DynamicSource, m as SourceUnion, n as LLMsConfig, o as getStaticParams, p as Source, q as ContentStoragePageFile, r as LLMsWithPages, s as isDynamicPath, t as LLMs, u as MetaData, v as update, w as InferPageType, x as dynamicLoader, y as DynamicLoader } from "../index-
|
|
1
|
+
import { A as Meta, C as InferMetaType, D as LoaderOutput, E as LoaderOptions, F as types_d_exports, G as ContentStorage, H as PageTreeBuilderContext, J as FileSystem, K as ContentStorageMetaFile, M as ResolvedLoaderConfig, N as createGetUrl, O as LoaderPlugin, P as loader, R as getSlugs, S as GetPageOptions, T as LoaderConfig, U as PageTreeOptions, V as PageTreeBuilder, W as PageTreeTransformer, _ as multiple, a as StaticParamsOptions, b as DynamicLoaderConfig, c as path_d_exports, d as PageData, f as Params, g as VirtualFile, h as StaticSource, i as llms, j as Page, k as LoaderPluginOption, l as DynamicSource, m as SourceUnion, n as LLMsConfig, o as getStaticParams, p as Source, q as ContentStoragePageFile, r as LLMsWithPages, s as isDynamicPath, t as LLMs, u as MetaData, v as update, w as InferPageType, x as dynamicLoader, y as DynamicLoader } from "../index-Dyo_baWl.js";
|
|
2
2
|
export { type ContentStorage, type ContentStorageMetaFile, type ContentStoragePageFile, type DynamicLoader, type DynamicLoaderConfig, type DynamicSource, FileSystem, GetPageOptions, InferMetaType, InferPageType, LLMs, LLMsConfig, LLMsWithPages, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, type MetaData, Page, type PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, type Params, path_d_exports as PathUtils, ResolvedLoaderConfig, type Source, type SourceUnion, type StaticParamsOptions, type StaticSource, type VirtualFile, type types_d_exports as _Internal, createGetUrl, dynamicLoader, getSlugs, getStaticParams, isDynamicPath, llms, loader, multiple, update };
|
package/dist/source/llms.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as llms, n as LLMsConfig, r as LLMsWithPages, t as LLMs } from "../index-
|
|
1
|
+
import { i as llms, n as LLMsConfig, r as LLMsWithPages, t as LLMs } from "../index-Dyo_baWl.js";
|
|
2
2
|
export { LLMs, LLMsConfig, LLMsWithPages, llms };
|
package/dist/source/llms.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/source/llms.ts
|
|
2
2
|
function llms(input, config = {}) {
|
|
3
|
-
const { TAB = " ", filter = () => true } = config;
|
|
3
|
+
const { TAB = " ", filter = () => true, section = (folder) => Boolean(folder.root) } = config;
|
|
4
4
|
function renderName(node, ctx) {
|
|
5
5
|
if (config.renderName) return config.renderName(node, ctx);
|
|
6
6
|
if (node.type === "page") {
|
|
@@ -40,8 +40,11 @@ function llms(input, config = {}) {
|
|
|
40
40
|
return formatListItem(formatMarkdownLink(renderName(node, ctx), config.renderUrl?.(node, ctx) ?? node.url), renderDescription(node, ctx), indent);
|
|
41
41
|
}
|
|
42
42
|
case "folder": {
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const scope = ctx.markdown ? sectionOf(node, ctx) : void 0;
|
|
44
|
+
let name = renderName(node, ctx);
|
|
45
|
+
if (scope) name = linkFile(name, `${scope.url}/${scope.collapse ? "llms" : "llms-full"}.txt`, ctx);
|
|
46
|
+
const out = [formatListItem(name, renderDescription(node, ctx), indent)];
|
|
47
|
+
if (scope?.collapse) return out[0];
|
|
45
48
|
if (node.index) out.push(formatNode(node.index, indent + 1, ctx));
|
|
46
49
|
for (const child of node.children) out.push(formatNode(child, indent + 1, ctx));
|
|
47
50
|
return out.join("\n");
|
|
@@ -59,14 +62,27 @@ function llms(input, config = {}) {
|
|
|
59
62
|
}));
|
|
60
63
|
return out.join("\n\n");
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
return formatTree(loader.getPageTree(lang), ctx);
|
|
66
|
+
}
|
|
67
|
+
/** the index of a page tree or a section, `full` is the path of its `llms-full.txt` */
|
|
68
|
+
function formatTree(node, ctx, full) {
|
|
69
|
+
const out = [`# ${renderName(node, ctx)}`, ""];
|
|
70
|
+
const description = renderDescription(node, ctx);
|
|
66
71
|
if (description) out.push(`> ${description}`, "");
|
|
67
|
-
|
|
72
|
+
if (full) out.push(linkFile("All pages", full, ctx), "");
|
|
73
|
+
if (node.type === "folder" && node.index) out.push(formatNode(node.index, 0, ctx));
|
|
74
|
+
for (const child of node.children) out.push(formatNode(child, 0, ctx));
|
|
68
75
|
return out.join("\n");
|
|
69
76
|
}
|
|
77
|
+
/** a link to one of the files, through `renderUrl` */
|
|
78
|
+
function linkFile(name, path, ctx) {
|
|
79
|
+
const item = {
|
|
80
|
+
type: "page",
|
|
81
|
+
name,
|
|
82
|
+
url: path
|
|
83
|
+
};
|
|
84
|
+
return formatMarkdownLink(name, config.renderUrl?.(item, ctx) ?? path);
|
|
85
|
+
}
|
|
70
86
|
function renderPage(page) {
|
|
71
87
|
if (!config.renderPage) throw new Error("`renderPage` is required by `page()` and `full()`, see llms() options.");
|
|
72
88
|
return config.renderPage(page);
|
|
@@ -75,40 +91,73 @@ function llms(input, config = {}) {
|
|
|
75
91
|
return (await Promise.all(pages.map(renderPage))).join("\n\n");
|
|
76
92
|
}
|
|
77
93
|
const getPages = (loader, lang) => loader.getPages(lang).filter(filter);
|
|
94
|
+
/** the URL, collapse and pages of a folder, when it's a section */
|
|
95
|
+
function sectionOf(folder, ctx) {
|
|
96
|
+
const options = section(folder, ctx);
|
|
97
|
+
if (!options) return;
|
|
98
|
+
const pages = [];
|
|
99
|
+
const visit = (node) => {
|
|
100
|
+
if (node.type === "page") {
|
|
101
|
+
const page = ctx.loader.getNodePage(node, ctx.lang);
|
|
102
|
+
if (page && filter(page)) pages.push(page);
|
|
103
|
+
} else if (node.type === "folder") {
|
|
104
|
+
if (node.index) visit(node.index);
|
|
105
|
+
for (const child of node.children) visit(child);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
visit(folder);
|
|
109
|
+
if (pages.length === 0) return;
|
|
110
|
+
const { asPath, collapse } = options === true ? {} : options;
|
|
111
|
+
let url = asPath ?? folder.index?.url ?? pages[0].url;
|
|
112
|
+
if (!asPath) for (const page of pages) while (url.length > 0 && !`${page.url}/`.startsWith(`${url}/`)) url = url.slice(0, url.lastIndexOf("/"));
|
|
113
|
+
return {
|
|
114
|
+
url: url.replace(/\/$/, ""),
|
|
115
|
+
collapse,
|
|
116
|
+
pages,
|
|
117
|
+
folder,
|
|
118
|
+
ctx
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** the sections of the page trees, by URL */
|
|
122
|
+
function sections(loader, lang) {
|
|
123
|
+
const out = /* @__PURE__ */ new Map();
|
|
124
|
+
const visit = (node, ctx) => {
|
|
125
|
+
if (node.type !== "folder") return;
|
|
126
|
+
const scope = sectionOf(node, ctx);
|
|
127
|
+
if (scope && !out.has(scope.url)) out.set(scope.url, scope);
|
|
128
|
+
for (const child of node.children) visit(child, ctx);
|
|
129
|
+
};
|
|
130
|
+
const languages = lang === void 0 && loader._i18n ? loader._i18n.languages : [lang];
|
|
131
|
+
for (const language of languages) for (const child of loader.getPageTree(language).children) visit(child, {
|
|
132
|
+
loader,
|
|
133
|
+
lang: language
|
|
134
|
+
});
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
78
137
|
function withLoader(render) {
|
|
79
138
|
if (typeof input === "function") return Promise.resolve(input()).then(render);
|
|
80
139
|
return render(input);
|
|
81
140
|
}
|
|
82
141
|
async function renderFile(loader, path, lang) {
|
|
83
|
-
if (path === "/llms.txt") {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
const dirs = sections(getPages(loader, lang));
|
|
90
|
-
if (dirs.size > 0) text += "\n\n## Sections\n";
|
|
91
|
-
for (const dir of dirs.keys()) {
|
|
92
|
-
const item = {
|
|
93
|
-
type: "page",
|
|
94
|
-
name: dir,
|
|
95
|
-
url: `${dir}/llms-full.txt`
|
|
96
|
-
};
|
|
97
|
-
text += `\n- ${formatMarkdownLink(dir, config.renderUrl?.(item, { lang }) ?? item.url)}`;
|
|
98
|
-
}
|
|
99
|
-
return text;
|
|
100
|
-
}
|
|
142
|
+
if (path === "/llms.txt") return formatIndex({
|
|
143
|
+
loader,
|
|
144
|
+
lang,
|
|
145
|
+
markdown: true
|
|
146
|
+
});
|
|
101
147
|
if (path === "/llms-full.txt") return renderPages(getPages(loader, lang));
|
|
102
|
-
if (path.endsWith("/llms-full.txt")) {
|
|
103
|
-
const dirPages = sections(getPages(loader, lang)).get(path.slice(0, -14));
|
|
104
|
-
return dirPages && renderPages(dirPages);
|
|
105
|
-
}
|
|
106
148
|
if (path.endsWith(".md")) {
|
|
107
149
|
let url = path.slice(0, -3).replace(/(.)\/$/, "$1");
|
|
108
150
|
if (url === "/index") url = "/";
|
|
109
151
|
const page = loader.getPageByUrl(url, lang) ?? loader.getPageByUrl(`${url}/`, lang);
|
|
110
152
|
if (page && filter(page)) return renderPage(page);
|
|
153
|
+
return;
|
|
111
154
|
}
|
|
155
|
+
const scope = sections(loader, lang).get(path.slice(0, path.lastIndexOf("/")));
|
|
156
|
+
if (scope && path.endsWith("/llms-full.txt")) return renderPages(scope.pages);
|
|
157
|
+
if (scope?.collapse && path.endsWith("/llms.txt")) return formatTree(scope.folder, {
|
|
158
|
+
...scope.ctx,
|
|
159
|
+
markdown: true
|
|
160
|
+
}, `${scope.url}/llms-full.txt`);
|
|
112
161
|
}
|
|
113
162
|
return {
|
|
114
163
|
index: (lang) => withLoader((loader) => formatIndex({
|
|
@@ -130,7 +179,10 @@ function llms(input, config = {}) {
|
|
|
130
179
|
const pages = getPages(loader, lang);
|
|
131
180
|
const out = /* @__PURE__ */ new Set(["/llms.txt", "/llms-full.txt"]);
|
|
132
181
|
for (const page of pages) out.add(markdownPath(page.url));
|
|
133
|
-
for (const
|
|
182
|
+
for (const [url, { collapse }] of sections(loader, lang)) {
|
|
183
|
+
if (collapse) out.add(`${url}/llms.txt`);
|
|
184
|
+
out.add(`${url}/llms-full.txt`);
|
|
185
|
+
}
|
|
134
186
|
return Array.from(out);
|
|
135
187
|
});
|
|
136
188
|
},
|
|
@@ -145,22 +197,6 @@ function llms(input, config = {}) {
|
|
|
145
197
|
}
|
|
146
198
|
};
|
|
147
199
|
}
|
|
148
|
-
/** the URL directories with two or more pages, and their pages */
|
|
149
|
-
function sections(pages) {
|
|
150
|
-
const dirs = /* @__PURE__ */ new Map();
|
|
151
|
-
for (const page of pages) {
|
|
152
|
-
const url = page.url.replace(/\/$/, "");
|
|
153
|
-
if (!url.startsWith("/")) continue;
|
|
154
|
-
for (let end = url.length; end > 0; end = url.lastIndexOf("/", end - 1)) {
|
|
155
|
-
const dir = url.slice(0, end);
|
|
156
|
-
const list = dirs.get(dir);
|
|
157
|
-
if (list) list.push(page);
|
|
158
|
-
else dirs.set(dir, [page]);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
for (const [dir, list] of dirs) if (list.length < 2) dirs.delete(dir);
|
|
162
|
-
return dirs;
|
|
163
|
-
}
|
|
164
200
|
/** the path of the `.md` file of a page: `<page>.md`, `/index.md` for `/` */
|
|
165
201
|
function markdownPath(url) {
|
|
166
202
|
return url === "/" ? "/index.md" : `${url.replace(/\/$/, "")}.md`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as slugsPlugin, I as SlugFn, L as SlugsPluginOptions, R as getSlugs, z as slugsFromData } from "../../index-
|
|
1
|
+
import { B as slugsPlugin, I as SlugFn, L as SlugsPluginOptions, R as getSlugs, z as slugsFromData } from "../../index-Dyo_baWl.js";
|
|
2
2
|
export { SlugFn, SlugsPluginOptions, getSlugs, slugsFromData, slugsPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as LoaderPlugin } from "../../index-
|
|
1
|
+
import { O as LoaderPlugin } from "../../index-Dyo_baWl.js";
|
|
2
2
|
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-BQVehOBz.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
export interface Item extends Item$1 {
|