@hanzo/docs-core 16.4.3 → 16.5.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/README.md +3 -3
- package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
- package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
- package/dist/breadcrumb.d.ts +2 -3
- package/dist/breadcrumb.js +3 -4
- package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
- package/dist/content/github.d.ts +1 -2
- package/dist/content/github.js +1 -2
- package/dist/content/index.d.ts +3 -4
- package/dist/content/index.js +1 -2
- package/dist/content/mdx/preset-bundler.d.ts +9 -10
- package/dist/content/mdx/preset-bundler.js +2 -3
- package/dist/content/mdx/preset-runtime.d.ts +9 -10
- package/dist/content/mdx/preset-runtime.js +2 -3
- package/dist/content/toc.d.ts +1 -3
- package/dist/content/toc.js +4 -5
- package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
- package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
- package/dist/dynamic-link.d.ts +3 -4
- package/dist/dynamic-link.js +1 -3
- package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
- package/dist/framework/index.d.ts +5 -6
- package/dist/framework/index.js +18 -19
- package/dist/framework/next.d.ts +3 -4
- package/dist/framework/next.js +1 -2
- package/dist/framework/react-router.d.ts +1 -2
- package/dist/framework/react-router.js +1 -2
- package/dist/framework/tanstack.d.ts +4 -5
- package/dist/framework/tanstack.js +2 -3
- package/dist/framework/waku.d.ts +1 -2
- package/dist/framework/waku.js +1 -2
- package/dist/hast-utils-BmGqqmvo.js +15 -0
- package/dist/highlight/client.d.ts +2 -4
- package/dist/highlight/client.js +7 -13
- package/dist/highlight/config.d.ts +15 -0
- package/dist/highlight/config.js +18 -0
- package/dist/highlight/core/client.d.ts +31 -0
- package/dist/highlight/core/client.js +68 -0
- package/dist/highlight/core/index.d.ts +27 -0
- package/dist/highlight/core/index.js +69 -0
- package/dist/highlight/index.d.ts +34 -2
- package/dist/highlight/index.js +57 -2
- package/dist/i18n/index.d.ts +39 -1
- package/dist/i18n/index.js +1 -2
- package/dist/i18n/middleware.d.ts +2 -3
- package/dist/i18n/middleware.js +1 -2
- package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
- package/dist/link.d.ts +3 -4
- package/dist/link.js +1 -2
- package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
- package/dist/mdx-plugins/codeblock-utils.js +2 -3
- package/dist/mdx-plugins/index.d.ts +18 -15
- package/dist/mdx-plugins/index.js +7 -5
- package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
- package/dist/mdx-plugins/rehype-code.core.js +104 -0
- package/dist/mdx-plugins/rehype-code.d.ts +18 -2
- package/dist/mdx-plugins/rehype-code.js +24 -3
- package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
- package/dist/mdx-plugins/rehype-toc.js +127 -1
- package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
- package/dist/mdx-plugins/remark-admonition.js +2 -3
- package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
- package/dist/mdx-plugins/remark-code-tab.js +4 -5
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
- package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
- package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
- package/dist/mdx-plugins/remark-feedback-block.js +47 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +35 -1
- package/dist/mdx-plugins/remark-heading.js +2 -3
- package/dist/mdx-plugins/remark-image.d.ts +63 -1
- package/dist/mdx-plugins/remark-image.js +1 -2
- package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
- package/dist/mdx-plugins/remark-mdx-files.js +103 -13
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
- package/dist/mdx-plugins/remark-npm.d.ts +34 -1
- package/dist/mdx-plugins/remark-npm.js +1 -2
- package/dist/mdx-plugins/remark-steps.d.ts +26 -1
- package/dist/mdx-plugins/remark-steps.js +1 -2
- package/dist/mdx-plugins/remark-structure.d.ts +75 -1
- package/dist/mdx-plugins/remark-structure.js +7 -8
- package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
- package/dist/negotiation/index.d.ts +1 -2
- package/dist/negotiation/index.js +1 -2
- package/dist/{normalize-url-DP9-1I-S.js → normalize-url-DUHbcuVM.js} +2 -3
- package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
- package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
- package/dist/page-tree/index.d.ts +3 -45
- package/dist/page-tree/index.js +1 -1
- package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
- package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
- package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
- package/dist/search/algolia.d.ts +66 -2
- package/dist/search/algolia.js +1 -2
- package/dist/search/client.d.ts +31 -8
- package/dist/search/client.js +27 -22
- package/dist/search/index.d.ts +1 -2
- package/dist/search/index.js +41 -1
- package/dist/search/orama-cloud-legacy.d.ts +77 -0
- package/dist/search/orama-cloud-legacy.js +49 -0
- package/dist/search/orama-cloud.d.ts +5 -9
- package/dist/search/orama-cloud.js +1 -2
- package/dist/search/server.d.ts +87 -4
- package/dist/search/server.js +7 -8
- package/dist/source/client/index.d.ts +13 -11
- package/dist/source/client/index.js +22 -13
- package/dist/source/index.d.ts +5 -3
- package/dist/source/index.js +428 -333
- package/dist/source/plugins/lucide-icons.d.ts +5 -4
- package/dist/source/plugins/lucide-icons.js +2 -3
- package/dist/source/plugins/slugs.d.ts +24 -2
- package/dist/source/plugins/slugs.js +2 -3
- package/dist/source/plugins/status-badges.d.ts +52 -0
- package/dist/source/plugins/status-badges.js +54 -0
- package/dist/source/schema.d.ts +1 -3
- package/dist/source/schema.js +1 -2
- package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
- package/dist/toc.d.ts +5 -6
- package/dist/toc.js +1 -2
- package/dist/{rehype-code-CdiZ1Y6P.js → transformer-icon-BYedaeE8.js} +1 -96
- package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
- package/dist/types-BSnJn7kF.d.ts +6 -0
- package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
- package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
- package/dist/utils/use-media-query.d.ts +1 -2
- package/dist/utils/use-media-query.js +1 -2
- package/dist/utils/use-on-change.d.ts +1 -2
- package/dist/utils/use-on-change.js +1 -2
- package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
- package/dist/utils-IgHyYnrz.d.ts +45 -0
- package/package.json +58 -28
- package/dist/advanced-BRT5Ij43.js.map +0 -1
- package/dist/algolia-CBBN8R6-.d.ts +0 -68
- package/dist/algolia-CBBN8R6-.d.ts.map +0 -1
- package/dist/algolia-CQPXCnjV.js.map +0 -1
- package/dist/breadcrumb.d.ts.map +0 -1
- package/dist/breadcrumb.js.map +0 -1
- package/dist/codeblock-utils-lld8UiQo.d.ts +0 -37
- package/dist/codeblock-utils-lld8UiQo.d.ts.map +0 -1
- package/dist/content/github.d.ts.map +0 -1
- package/dist/content/github.js.map +0 -1
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js.map +0 -1
- package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
- package/dist/content/mdx/preset-bundler.js.map +0 -1
- package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
- package/dist/content/mdx/preset-runtime.js.map +0 -1
- package/dist/content/toc.d.ts.map +0 -1
- package/dist/content/toc.js.map +0 -1
- package/dist/definitions-DuxDer_c.d.ts.map +0 -1
- package/dist/dynamic-link.d.ts.map +0 -1
- package/dist/dynamic-link.js.map +0 -1
- package/dist/fetch-B5e9CFfN.js.map +0 -1
- package/dist/framework/index.d.ts.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/framework/next.d.ts.map +0 -1
- package/dist/framework/next.js.map +0 -1
- package/dist/framework/react-router.d.ts.map +0 -1
- package/dist/framework/react-router.js.map +0 -1
- package/dist/framework/tanstack.d.ts.map +0 -1
- package/dist/framework/tanstack.js.map +0 -1
- package/dist/framework/waku.d.ts.map +0 -1
- package/dist/framework/waku.js.map +0 -1
- package/dist/highlight/client.d.ts.map +0 -1
- package/dist/highlight/client.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/i18n/middleware.js.map +0 -1
- package/dist/icon-BWwSDabM.js.map +0 -1
- package/dist/index-2U6Tl4--.d.ts.map +0 -1
- package/dist/index-Bw-DCOra.d.ts +0 -41
- package/dist/index-Bw-DCOra.d.ts.map +0 -1
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
- package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
- package/dist/mdx-plugins/remark-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
- package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-heading.js.map +0 -1
- package/dist/mdx-plugins/remark-image.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
- package/dist/mdx-plugins/remark-npm.js.map +0 -1
- package/dist/mdx-plugins/remark-steps.js.map +0 -1
- package/dist/mdx-plugins/remark-structure.js.map +0 -1
- package/dist/mixedbread-DlByNYSd.js.map +0 -1
- package/dist/negotiation/index.d.ts.map +0 -1
- package/dist/negotiation/index.js.map +0 -1
- package/dist/normalize-url-DP9-1I-S.js.map +0 -1
- package/dist/orama-cloud-DH3g37zc.js.map +0 -1
- package/dist/page-tree/index.d.ts.map +0 -1
- package/dist/path-DHIjrDBP.js.map +0 -1
- package/dist/rehype-code-CdiZ1Y6P.js.map +0 -1
- package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
- package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
- package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
- package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
- package/dist/rehype-toc-DVwJcwvA.js +0 -143
- package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
- package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
- package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
- package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
- package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
- package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
- package/dist/remark-heading-CXvCY0go.d.ts +0 -37
- package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
- package/dist/remark-image-CvUis4R1.d.ts +0 -65
- package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
- package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
- package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
- package/dist/remark-npm-BIvIEKT2.d.ts +0 -36
- package/dist/remark-npm-BIvIEKT2.d.ts.map +0 -1
- package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
- package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
- package/dist/remark-structure-RZD2gGKp.d.ts +0 -77
- package/dist/remark-structure-RZD2gGKp.d.ts.map +0 -1
- package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
- package/dist/search/algolia.js.map +0 -1
- package/dist/search/client.d.ts.map +0 -1
- package/dist/search/client.js.map +0 -1
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/orama-cloud.d.ts.map +0 -1
- package/dist/search/orama-cloud.js.map +0 -1
- package/dist/search/server.js.map +0 -1
- package/dist/search-D6ChCLhY.js +0 -44
- package/dist/search-D6ChCLhY.js.map +0 -1
- package/dist/server-CPR_fgkH.d.ts +0 -133
- package/dist/server-CPR_fgkH.d.ts.map +0 -1
- package/dist/shiki-4oMYwHED.js +0 -80
- package/dist/shiki-4oMYwHED.js.map +0 -1
- package/dist/shiki-CIBQys54.d.ts +0 -33
- package/dist/shiki-CIBQys54.d.ts.map +0 -1
- package/dist/source/client/index.d.ts.map +0 -1
- package/dist/source/client/index.js.map +0 -1
- package/dist/source/index.js.map +0 -1
- package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
- package/dist/source/plugins/lucide-icons.js.map +0 -1
- package/dist/source/plugins/slugs.js.map +0 -1
- package/dist/source/schema.d.ts.map +0 -1
- package/dist/source/schema.js.map +0 -1
- package/dist/static-Dq8pA8Ay.js.map +0 -1
- package/dist/toc.d.ts.map +0 -1
- package/dist/toc.js.map +0 -1
- package/dist/util-CK2ykiif.d.ts.map +0 -1
- package/dist/util-s9piKHsk.js.map +0 -1
- package/dist/utils/use-effect-event.d.ts +0 -11
- package/dist/utils/use-effect-event.d.ts.map +0 -1
- package/dist/utils/use-effect-event.js +0 -19
- package/dist/utils/use-effect-event.js.map +0 -1
- package/dist/utils/use-media-query.d.ts.map +0 -1
- package/dist/utils/use-media-query.js.map +0 -1
- package/dist/utils/use-on-change.d.ts.map +0 -1
- package/dist/utils/use-on-change.js.map +0 -1
- package/dist/utils-DUvi2WkD.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import "../transformer-icon-D7-6aFzt.js";
|
|
2
|
+
import { StructuredData } from "../mdx-plugins/remark-structure.js";
|
|
3
|
+
import "../mdx-plugins/index.js";
|
|
4
|
+
import { CloudManager } from "@oramacloud/client";
|
|
5
|
+
|
|
6
|
+
//#region src/search/orama-cloud-legacy.d.ts
|
|
7
|
+
interface SyncOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Index name to sync
|
|
10
|
+
*/
|
|
11
|
+
index: string;
|
|
12
|
+
documents: OramaDocument[];
|
|
13
|
+
/**
|
|
14
|
+
* Deploy changes
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue true
|
|
17
|
+
*/
|
|
18
|
+
autoDeploy?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface I18nSyncOptions extends Omit<SyncOptions, 'index' | 'documents'> {
|
|
21
|
+
/**
|
|
22
|
+
* Indexes to sync.
|
|
23
|
+
*
|
|
24
|
+
* Pairs of `locale`-`index`.
|
|
25
|
+
**/
|
|
26
|
+
indexes: Record<string, string>;
|
|
27
|
+
documents: {
|
|
28
|
+
locale: string;
|
|
29
|
+
items: OramaDocument[];
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
interface OramaDocument {
|
|
33
|
+
/**
|
|
34
|
+
* The ID of document, must be unique
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* URL to the page
|
|
41
|
+
*/
|
|
42
|
+
url: string;
|
|
43
|
+
structured: StructuredData;
|
|
44
|
+
/**
|
|
45
|
+
* Tag to filter results
|
|
46
|
+
*/
|
|
47
|
+
tag?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Data to be added to each section index
|
|
50
|
+
*/
|
|
51
|
+
extra_data?: object;
|
|
52
|
+
breadcrumbs?: string[];
|
|
53
|
+
}
|
|
54
|
+
interface OramaIndex {
|
|
55
|
+
id: string;
|
|
56
|
+
title: string;
|
|
57
|
+
url: string;
|
|
58
|
+
tag?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The id of page, used for `group by`
|
|
61
|
+
*/
|
|
62
|
+
page_id: string;
|
|
63
|
+
/**
|
|
64
|
+
* Heading content
|
|
65
|
+
*/
|
|
66
|
+
section?: string;
|
|
67
|
+
breadcrumbs?: string[];
|
|
68
|
+
/**
|
|
69
|
+
* Heading (anchor) id
|
|
70
|
+
*/
|
|
71
|
+
section_id?: string;
|
|
72
|
+
content: string;
|
|
73
|
+
}
|
|
74
|
+
declare function sync(cloudManager: CloudManager, options: SyncOptions): Promise<void>;
|
|
75
|
+
declare function syncI18n(cloudManager: CloudManager, options: I18nSyncOptions): Promise<void>;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/search/orama-cloud-legacy.ts
|
|
2
|
+
async function sync(cloudManager, options) {
|
|
3
|
+
const { autoDeploy = true } = options;
|
|
4
|
+
const index = cloudManager.index(options.index);
|
|
5
|
+
await index.snapshot(options.documents.flatMap(toIndex));
|
|
6
|
+
if (autoDeploy) await index.deploy();
|
|
7
|
+
}
|
|
8
|
+
async function syncI18n(cloudManager, options) {
|
|
9
|
+
const { autoDeploy = true } = options;
|
|
10
|
+
const tasks = options.documents.map(async (document) => {
|
|
11
|
+
const index = cloudManager.index(options.indexes[document.locale]);
|
|
12
|
+
await index.snapshot(document.items.flatMap(toIndex));
|
|
13
|
+
if (autoDeploy) await index.deploy();
|
|
14
|
+
});
|
|
15
|
+
await Promise.all(tasks);
|
|
16
|
+
}
|
|
17
|
+
function toIndex(page) {
|
|
18
|
+
let id = 0;
|
|
19
|
+
const indexes = [];
|
|
20
|
+
const scannedHeadings = /* @__PURE__ */ new Set();
|
|
21
|
+
function createIndex(section, sectionId, content) {
|
|
22
|
+
return {
|
|
23
|
+
id: `${page.id}-${(id++).toString()}`,
|
|
24
|
+
title: page.title,
|
|
25
|
+
url: page.url,
|
|
26
|
+
page_id: page.id,
|
|
27
|
+
tag: page.tag,
|
|
28
|
+
section,
|
|
29
|
+
section_id: sectionId,
|
|
30
|
+
content,
|
|
31
|
+
breadcrumbs: page.breadcrumbs,
|
|
32
|
+
...page.extra_data
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (page.description) indexes.push(createIndex(void 0, void 0, page.description));
|
|
36
|
+
page.structured.contents.forEach((p) => {
|
|
37
|
+
const heading = p.heading ? page.structured.headings.find((h) => p.heading === h.id) : null;
|
|
38
|
+
const index = createIndex(heading?.content, heading?.id, p.content);
|
|
39
|
+
if (heading && !scannedHeadings.has(heading.id)) {
|
|
40
|
+
scannedHeadings.add(heading.id);
|
|
41
|
+
indexes.push(createIndex(heading.content, heading.id, heading.content));
|
|
42
|
+
}
|
|
43
|
+
indexes.push(index);
|
|
44
|
+
});
|
|
45
|
+
return indexes;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { sync, syncI18n };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import { n as StructuredData } from "../remark-structure-RZD2gGKp.js";
|
|
4
|
-
import "../remark-heading-CXvCY0go.js";
|
|
5
|
-
import "../remark-code-tab-CXsYlims.js";
|
|
1
|
+
import "../transformer-icon-D7-6aFzt.js";
|
|
2
|
+
import { StructuredData } from "../mdx-plugins/remark-structure.js";
|
|
6
3
|
import "../mdx-plugins/index.js";
|
|
7
4
|
import { OramaCloud } from "@orama/core";
|
|
8
5
|
|
|
@@ -20,7 +17,7 @@ interface SyncOptions {
|
|
|
20
17
|
*/
|
|
21
18
|
autoDeploy?: boolean;
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
interface I18nSyncOptions extends Omit<SyncOptions, 'index' | 'documents'> {
|
|
24
21
|
/**
|
|
25
22
|
* Indexes to sync.
|
|
26
23
|
*
|
|
@@ -31,7 +28,7 @@ type I18nSyncOptions = Omit<SyncOptions, 'index' | 'documents'> & {
|
|
|
31
28
|
locale: string;
|
|
32
29
|
items: OramaDocument[];
|
|
33
30
|
}[];
|
|
34
|
-
}
|
|
31
|
+
}
|
|
35
32
|
interface OramaDocument {
|
|
36
33
|
/**
|
|
37
34
|
* The ID of document, must be unique
|
|
@@ -77,5 +74,4 @@ interface OramaIndex {
|
|
|
77
74
|
declare function sync(orama: OramaCloud, options: SyncOptions): Promise<void>;
|
|
78
75
|
declare function syncI18n(orama: OramaCloud, options: I18nSyncOptions): Promise<void>;
|
|
79
76
|
//#endregion
|
|
80
|
-
export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
|
|
81
|
-
//# sourceMappingURL=orama-cloud.d.ts.map
|
|
77
|
+
export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,6 +1,89 @@
|
|
|
1
|
-
import "../definitions-
|
|
2
|
-
import "../remark-structure
|
|
1
|
+
import "../definitions-DSNTbAwC.js";
|
|
2
|
+
import { StructuredData } from "../mdx-plugins/remark-structure.js";
|
|
3
|
+
import "../utils-IgHyYnrz.js";
|
|
3
4
|
import { HighlightedText, ReactSortedResult, SortedResult, createContentHighlighter } from "./index.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import "../
|
|
5
|
+
import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-Cv3Cocbs.js";
|
|
6
|
+
import "../path-B77y3W0_.js";
|
|
7
|
+
import { Orama, RawData, SearchParams, create } from "@orama/orama";
|
|
8
|
+
|
|
9
|
+
//#region src/search/server.d.ts
|
|
10
|
+
type SearchType = 'simple' | 'advanced';
|
|
11
|
+
type ExportedData = (RawData & {
|
|
12
|
+
type: SearchType;
|
|
13
|
+
}) | {
|
|
14
|
+
type: 'i18n';
|
|
15
|
+
data: Record<string, RawData & {
|
|
16
|
+
type: SearchType;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
interface SearchServer {
|
|
20
|
+
search: (query: string, options?: {
|
|
21
|
+
locale?: string;
|
|
22
|
+
tag?: string | string[];
|
|
23
|
+
mode?: 'vector' | 'full';
|
|
24
|
+
}) => Promise<SortedResult[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Export the database
|
|
27
|
+
*
|
|
28
|
+
* You can reference the exported database to implement client-side search
|
|
29
|
+
*/
|
|
30
|
+
export: () => Promise<ExportedData>;
|
|
31
|
+
}
|
|
32
|
+
interface SearchAPI extends SearchServer {
|
|
33
|
+
GET: (request: Request) => Promise<Response>;
|
|
34
|
+
/**
|
|
35
|
+
* `GET` route handler that exports search indexes for static search.
|
|
36
|
+
*/
|
|
37
|
+
staticGET: () => Promise<Response>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve indexes dynamically
|
|
41
|
+
*/
|
|
42
|
+
type Dynamic<T> = () => T[] | Promise<T[]>;
|
|
43
|
+
type OramaInput = Parameters<typeof create>[0];
|
|
44
|
+
type SharedOptions = Pick<OramaInput, 'sort' | 'components' | 'plugins'> & {
|
|
45
|
+
language?: string;
|
|
46
|
+
tokenizer?: Required<OramaInput>['components']['tokenizer'];
|
|
47
|
+
};
|
|
48
|
+
interface SimpleOptions extends SharedOptions {
|
|
49
|
+
indexes: Index[] | Dynamic<Index>;
|
|
50
|
+
/**
|
|
51
|
+
* Customise search options on server
|
|
52
|
+
*/
|
|
53
|
+
search?: Partial<SearchParams<Orama<typeof simpleSchema>, SimpleDocument>>;
|
|
54
|
+
}
|
|
55
|
+
interface AdvancedOptions extends SharedOptions {
|
|
56
|
+
indexes: AdvancedIndex[] | Dynamic<AdvancedIndex>;
|
|
57
|
+
/**
|
|
58
|
+
* Customise search options on server
|
|
59
|
+
*/
|
|
60
|
+
search?: Partial<SearchParams<Orama<typeof advancedSchema>, AdvancedDocument>>;
|
|
61
|
+
}
|
|
62
|
+
declare function createSearchAPI<T extends SearchType>(type: T, options: T extends 'simple' ? SimpleOptions : AdvancedOptions): SearchAPI;
|
|
63
|
+
interface Index {
|
|
64
|
+
title: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
breadcrumbs?: string[];
|
|
67
|
+
content: string;
|
|
68
|
+
url: string;
|
|
69
|
+
keywords?: string;
|
|
70
|
+
}
|
|
71
|
+
declare function initSimpleSearch(options: SimpleOptions): SearchServer;
|
|
72
|
+
interface AdvancedIndex {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
breadcrumbs?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Required if tag filter is enabled
|
|
79
|
+
*/
|
|
80
|
+
tag?: string | string[];
|
|
81
|
+
/**
|
|
82
|
+
* preprocess mdx content with `structure`
|
|
83
|
+
*/
|
|
84
|
+
structuredData: StructuredData;
|
|
85
|
+
url: string;
|
|
86
|
+
}
|
|
87
|
+
declare function initAdvancedSearch(options: AdvancedOptions): SearchServer;
|
|
88
|
+
//#endregion
|
|
6
89
|
export { AdvancedIndex, AdvancedOptions, Dynamic, ExportedData, HighlightedText, Index, ReactSortedResult, SearchAPI, SearchServer, SimpleOptions, SortedResult, createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as findPath } from "../utils-
|
|
2
|
-
import {
|
|
3
|
-
import { n as searchSimple, t as searchAdvanced } from "../advanced-
|
|
4
|
-
import { r as extname, t as basename } from "../path-
|
|
1
|
+
import { r as findPath } from "../utils-Bc53B3CJ.js";
|
|
2
|
+
import { createContentHighlighter } from "./index.js";
|
|
3
|
+
import { n as searchSimple, t as searchAdvanced } from "../advanced-BH0syJ-M.js";
|
|
4
|
+
import { r as extname, t as basename } from "../path-D0Bwm6Fs.js";
|
|
5
5
|
import { create, insertMultiple, save } from "@orama/orama";
|
|
6
6
|
|
|
7
7
|
//#region src/search/orama/create-endpoint.ts
|
|
8
8
|
function createEndpoint(server) {
|
|
9
|
-
const { search
|
|
9
|
+
const { search } = server;
|
|
10
10
|
return {
|
|
11
11
|
...server,
|
|
12
12
|
async staticGET() {
|
|
@@ -16,7 +16,7 @@ function createEndpoint(server) {
|
|
|
16
16
|
const url = new URL(request.url);
|
|
17
17
|
const query = url.searchParams.get("query");
|
|
18
18
|
if (!query) return Response.json([]);
|
|
19
|
-
return Response.json(await search
|
|
19
|
+
return Response.json(await search(query, {
|
|
20
20
|
tag: url.searchParams.get("tag")?.split(",") ?? void 0,
|
|
21
21
|
locale: url.searchParams.get("locale") ?? void 0,
|
|
22
22
|
mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
|
|
@@ -319,5 +319,4 @@ function initAdvancedSearch(options) {
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
//#endregion
|
|
322
|
-
export { createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
323
|
-
//# sourceMappingURL=server.js.map
|
|
322
|
+
export { createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { i as Root } from "../../definitions-
|
|
1
|
+
import { i as Root } from "../../definitions-DSNTbAwC.js";
|
|
2
|
+
import "../../utils-IgHyYnrz.js";
|
|
2
3
|
import "../../page-tree/index.js";
|
|
3
4
|
|
|
4
5
|
//#region src/source/client/index.d.ts
|
|
5
|
-
|
|
6
|
+
interface SerializedPageTree {
|
|
7
|
+
$hanzo_docs_loader: 'page-tree';
|
|
8
|
+
data: object;
|
|
9
|
+
}
|
|
10
|
+
type Serialized<Data> = { [K in keyof Data]: Data[K] extends SerializedPageTree ? Root : Data[K] };
|
|
11
|
+
declare function deserializePageTree(serialized: SerializedPageTree): Root;
|
|
6
12
|
/**
|
|
7
|
-
* Deserialize data
|
|
13
|
+
* Deserialize loader data that is serialized by the server-side Hanzo Docs `loader()`, supported:
|
|
14
|
+
* - Page Tree
|
|
8
15
|
*
|
|
9
|
-
*
|
|
16
|
+
* other unrelated properties are kept in the output.
|
|
10
17
|
*/
|
|
11
|
-
declare function
|
|
12
|
-
pageTree?: object;
|
|
13
|
-
}>(serialized: V): {
|
|
14
|
-
pageTree: V["pageTree"] extends object ? Root : undefined;
|
|
15
|
-
};
|
|
18
|
+
declare function useHanzoDocsLoader<V>(serialized: V): Serialized<V>;
|
|
16
19
|
//#endregion
|
|
17
|
-
export { deserializePageTree,
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
20
|
+
export { Serialized, SerializedPageTree, deserializePageTree, useHanzoDocsLoader };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { c as visit } from "../../utils-
|
|
1
|
+
import { c as visit } from "../../utils-Bc53B3CJ.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/source/client/index.tsx
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function deserializeHTML(html) {
|
|
7
|
+
return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: html } });
|
|
8
|
+
}
|
|
9
|
+
function deserializePageTree(serialized) {
|
|
10
|
+
const root = serialized.data;
|
|
10
11
|
visit(root, (item) => {
|
|
11
12
|
if ("icon" in item && typeof item.icon === "string") item.icon = deserializeHTML(item.icon);
|
|
12
13
|
if (typeof item.name === "string") item.name = deserializeHTML(item.name);
|
|
@@ -14,17 +15,25 @@ function deserializePageTree(root) {
|
|
|
14
15
|
return root;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
* Deserialize data
|
|
18
|
+
* Deserialize loader data that is serialized by the server-side Hanzo Docs `loader()`, supported:
|
|
19
|
+
* - Page Tree
|
|
18
20
|
*
|
|
19
|
-
*
|
|
21
|
+
* other unrelated properties are kept in the output.
|
|
20
22
|
*/
|
|
21
|
-
function
|
|
22
|
-
const { pageTree } = serialized;
|
|
23
|
+
function useHanzoDocsLoader(serialized) {
|
|
23
24
|
return useMemo(() => {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const out = {};
|
|
26
|
+
for (const k in serialized) {
|
|
27
|
+
const v = serialized[k];
|
|
28
|
+
if (isSerializedPageTree(v)) out[k] = deserializePageTree(v);
|
|
29
|
+
else out[k] = v;
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}, [serialized]);
|
|
33
|
+
}
|
|
34
|
+
function isSerializedPageTree(v) {
|
|
35
|
+
return typeof v === "object" && v !== null && "$hanzo_docs_loader" in v && v.$hanzo_docs_loader === "page-tree";
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
//#endregion
|
|
29
|
-
export { deserializePageTree,
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
39
|
+
export { deserializePageTree, useHanzoDocsLoader };
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import "../definitions-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import "../definitions-DSNTbAwC.js";
|
|
2
|
+
import "../utils-IgHyYnrz.js";
|
|
3
|
+
import { A as _SourceUpdate_, C as FileSystem, D as SourceConfig, E as Source, M as source, N as update, O as VirtualFile, S as createContentStorageBuilder, T as PageData, _ as PageTreeTransformer, a as LoaderOptions, b as ContentStorageMetaFile, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeOptions, h as PageTreeBuilderContext, i as LoaderConfig, j as multiple, k as _ConfigUnion_, l as Meta, m as PageTreeBuilder, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as ContentStorage, w as MetaData, x as ContentStoragePageFile, y as ContentStorageFile } from "../path-B77y3W0_.js";
|
|
4
|
+
import { getSlugs } from "./plugins/slugs.js";
|
|
5
|
+
export { ContentStorage, ContentStorageFile, ContentStorageMetaFile, ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, _SourceUpdate_, createContentStorageBuilder, createGetUrl, getSlugs, loader, multiple, source, update };
|