mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 05:23:40 +00:00
Core: Upgrade to Orama v3
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
Upgrade to Orama v3
|
||||
@@ -46,7 +46,6 @@ export default async function Page(props: {
|
||||
params: Promise<{ slug: string[] }>;
|
||||
}): Promise<ReactElement> {
|
||||
const params = await props.params;
|
||||
console.log('render', params.slug);
|
||||
const page = source.getPage(params.slug);
|
||||
|
||||
if (!page) notFound();
|
||||
@@ -135,10 +134,5 @@ export async function generateMetadata(props: {
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
console.log(
|
||||
source
|
||||
.generateParams()
|
||||
.filter((v) => v.slug[0] === 'ui' && v.slug[1] === 'mdx'),
|
||||
);
|
||||
return [...source.generateParams()];
|
||||
return source.generateParams();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"geist": "^1.3.1",
|
||||
"hast-util-to-jsx-runtime": "^2.3.5",
|
||||
"katex": "^0.16.21",
|
||||
"lucide-react": "^0.476.0",
|
||||
"lucide-react": "^0.477.0",
|
||||
"next": "15.2.0",
|
||||
"octokit": "^4.1.2",
|
||||
"oxc-transform": "^0.53.0",
|
||||
@@ -60,7 +60,7 @@
|
||||
"@tailwindcss/postcss": "^4.0.9",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
@@ -73,6 +73,6 @@
|
||||
"ts-morph": "^25.0.1",
|
||||
"tsconfig": "workspace:*",
|
||||
"tsx": "^4.19.3",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
"devDependencies": {
|
||||
"@content-collections/core": "^0.8.0",
|
||||
"@content-collections/mdx": "^0.2.0",
|
||||
"@content-collections/next": "^0.2.4",
|
||||
"@content-collections/next": "^0.2.5",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { source } from '@/lib/source';
|
||||
import { createFromSource } from 'fumadocs-core/search/server';
|
||||
// @ts-expect-error -- untyped
|
||||
import { createTokenizer } from '@orama/tokenizers/mandarin';
|
||||
|
||||
export const { GET } = createFromSource(source, undefined, {
|
||||
localeMap: {
|
||||
// you can customise search configs for specific locales, like:
|
||||
// [locale]: settings
|
||||
// [locale]: Orama options
|
||||
|
||||
// specify the tokenizer
|
||||
cn: {
|
||||
tokenizer: await createTokenizer(),
|
||||
components: {
|
||||
tokenizer: createTokenizer(),
|
||||
},
|
||||
search: {
|
||||
threshold: 0,
|
||||
tolerance: 0,
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@orama/stopwords": "^2.1.1",
|
||||
"@orama/tokenizers": "^2.1.1",
|
||||
"@orama/stopwords": "^3.1.1",
|
||||
"@orama/tokenizers": "^3.1.1",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-mdx": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
@@ -21,6 +21,6 @@
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"algoliasearch": "4.24.0",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"types:check": "fumadocs-mdx && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scalar/api-client-react": "^1.1.31",
|
||||
"@scalar/api-client-react": "^1.1.33",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-mdx": "workspace:*",
|
||||
"fumadocs-openapi": "workspace:*",
|
||||
@@ -29,6 +29,6 @@
|
||||
"postcss": "^8.5.3",
|
||||
"rimraf": "^6.0.1",
|
||||
"tailwindcss": "^4.0.9",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@
|
||||
"rimraf": "^6.0.1",
|
||||
"tsup": "8.4.0",
|
||||
"turbo": "2.4.4",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.24.1",
|
||||
"typescript": "^5.8.2",
|
||||
"typescript-eslint": "^8.25.0",
|
||||
"vitest": "^3.0.7"
|
||||
},
|
||||
"packageManager": "[email protected]",
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
"@clack/prompts": "^0.10.0",
|
||||
"commander": "^13.1.0",
|
||||
"execa": "^9.5.2",
|
||||
"package-manager-detector": "^0.2.9",
|
||||
"package-manager-detector": "^0.2.10",
|
||||
"picocolors": "^1.1.1",
|
||||
"ts-morph": "^25.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fast-glob": "^3.3.3",
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"devDependencies": {
|
||||
"@content-collections/core": "^0.8.0",
|
||||
"@content-collections/mdx": "^0.2.0",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"tsconfig": "workspace:*",
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@formatjs/intl-localematcher": "^0.6.0",
|
||||
"@orama/orama": "^2.1.1",
|
||||
"@orama/orama": "^3.1.1",
|
||||
"@shikijs/rehype": "^3.1.0",
|
||||
"@shikijs/transformers": "^3.1.0",
|
||||
"github-slugger": "^2.0.0",
|
||||
@@ -115,13 +115,13 @@
|
||||
"devDependencies": {
|
||||
"@algolia/client-search": "4.24.0",
|
||||
"@mdx-js/mdx": "^3.1.0",
|
||||
"@orama/tokenizers": "^2.1.1",
|
||||
"@orama/tokenizers": "^3.1.1",
|
||||
"@oramacloud/client": "^2.1.4",
|
||||
"@types/estree-jsx": "^1.0.5",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/negotiator": "^0.6.3",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"algoliasearch": "4.24.0",
|
||||
@@ -132,7 +132,7 @@
|
||||
"remark-mdx": "^3.1.0",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"tsconfig": "workspace:*",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "^5.8.2",
|
||||
"unified": "^11.0.5",
|
||||
"vfile": "^6.0.3"
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Cloned from Orama codebase */
|
||||
|
||||
/* Cloned from https://github.com/oramasearch/orama/blob/main/packages/orama/src/components/tokenizer/languages.ts */
|
||||
export const STEMMERS: Record<string, string> = {
|
||||
arabic: 'ar',
|
||||
armenian: 'am',
|
||||
bulgarian: 'bg',
|
||||
czech: 'cz',
|
||||
danish: 'dk',
|
||||
dutch: 'nl',
|
||||
english: 'en',
|
||||
|
||||
@@ -25,14 +25,14 @@ export async function createDB({
|
||||
}: AdvancedOptions): Promise<Orama<typeof advancedSchema>> {
|
||||
const items = typeof indexes === 'function' ? await indexes() : indexes;
|
||||
|
||||
const db = (await create({
|
||||
const db = create({
|
||||
schema: advancedSchema,
|
||||
...rest,
|
||||
components: {
|
||||
...rest.components,
|
||||
tokenizer: tokenizer ?? rest.components?.tokenizer,
|
||||
},
|
||||
})) as unknown as Orama<typeof advancedSchema>;
|
||||
}) as Orama<typeof advancedSchema>;
|
||||
|
||||
const mapTo: PartialSchemaDeep<AdvancedDocument>[] = [];
|
||||
items.forEach((page) => {
|
||||
@@ -102,14 +102,14 @@ export async function createDBSimple({
|
||||
...rest
|
||||
}: SimpleOptions): Promise<Orama<typeof simpleSchema>> {
|
||||
const items = typeof indexes === 'function' ? await indexes() : indexes;
|
||||
const db = (await create({
|
||||
const db = create({
|
||||
schema: simpleSchema,
|
||||
...rest,
|
||||
components: {
|
||||
...rest.components,
|
||||
tokenizer: tokenizer ?? rest.components?.tokenizer,
|
||||
},
|
||||
})) as unknown as Orama<typeof simpleSchema>;
|
||||
}) as Orama<typeof simpleSchema>;
|
||||
|
||||
await insertMultiple(
|
||||
db,
|
||||
|
||||
@@ -110,7 +110,7 @@ export function initSimpleSearch(options: SimpleOptions): SearchServer {
|
||||
async export() {
|
||||
return {
|
||||
type: 'simple',
|
||||
...(await save(await doc)),
|
||||
...save(await doc),
|
||||
};
|
||||
},
|
||||
async search(query) {
|
||||
@@ -146,7 +146,7 @@ export function initAdvancedSearch(options: AdvancedOptions): SearchServer {
|
||||
async export() {
|
||||
return {
|
||||
type: 'advanced',
|
||||
...(await save(await get)),
|
||||
...save(await get),
|
||||
};
|
||||
},
|
||||
async search(query, searchOptions) {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"dependencies": {
|
||||
"@content-collections/core": "^0.8.0",
|
||||
"@content-collections/mdx": "^0.2.0",
|
||||
"@content-collections/next": "^0.2.4",
|
||||
"@content-collections/next": "^0.2.5",
|
||||
"@tailwindcss/postcss": "^4.0.9",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"next": "15.2.0",
|
||||
@@ -18,6 +18,6 @@
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"tailwindcss": "^4.0.9",
|
||||
"typescript": "^5.7.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fast-glob": "^3.3.3",
|
||||
"tsconfig": "workspace:*"
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"mdast-util-mdx-jsx": "^3.2.0",
|
||||
"remark": "^15.0.0",
|
||||
"tsconfig": "workspace:*",
|
||||
"mdast-util-mdx-jsx": "^3.2.0",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "^5.8.2",
|
||||
"unified": "^11.0.5",
|
||||
"vfile": "^6.0.3"
|
||||
},
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fast-glob": "^3.3.3",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"@radix-ui/react-dialog": "^1.1.6",
|
||||
"@radix-ui/react-select": "^2.1.6",
|
||||
"@radix-ui/react-slot": "^1.1.2",
|
||||
"@scalar/openapi-parser": "0.10.8",
|
||||
"@scalar/openapi-parser": "0.10.9",
|
||||
"ajv-draft-04": "^1.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"fast-glob": "^3.3.3",
|
||||
@@ -63,7 +63,7 @@
|
||||
"github-slugger": "^2.0.0",
|
||||
"hast-util-to-jsx-runtime": "^2.3.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lucide-react": "^0.476.0",
|
||||
"lucide-react": "^0.477.0",
|
||||
"next-themes": "^0.4.4",
|
||||
"openapi-sampler": "^1.6.1",
|
||||
"react-hook-form": "^7.54.2",
|
||||
@@ -73,9 +73,9 @@
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@scalar/api-client-react": "^1.1.31",
|
||||
"@scalar/api-client-react": "^1.1.33",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/openapi-sampler": "^1.0.3",
|
||||
"@types/react": "^19.0.10",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"devDependencies": {
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "^19.0.10",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
|
||||
@@ -50,14 +50,14 @@
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/node": "22.13.8",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"tsconfig": "workspace:*",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "^5.8.2",
|
||||
"unified": "^11.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
"@radix-ui/react-tabs": "^1.1.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"lucide-react": "^0.476.0",
|
||||
"lucide-react": "^0.477.0",
|
||||
"next-themes": "^0.4.4",
|
||||
"postcss-selector-parser": "^7.1.0",
|
||||
"react-medium-image-zoom": "^5.2.14",
|
||||
|
||||
@@ -466,6 +466,7 @@ export function SidebarPageTree(props: {
|
||||
return (
|
||||
<Fragment key={root.$id}>{renderSidebarList(root.children, 1)}</Fragment>
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- root.id is enough
|
||||
}, [props.components, root.$id]);
|
||||
}
|
||||
|
||||
|
||||
Generated
+423
-411
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user