mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
Core: narrow schema types
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
Narrow schema type for private OpenAPI properties
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@fumadocs/local-md': patch
|
||||
---
|
||||
|
||||
fix `icon` & `_openapi` page data locations
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-mdx': patch
|
||||
---
|
||||
|
||||
Deprecate forwarded schemas at `fumadocs-mdx/config`, recommend `fumadocs-core/source/schema` instead.
|
||||
@@ -1,15 +1,12 @@
|
||||
import { defineCollection, defineConfig } from '@content-collections/core';
|
||||
import {
|
||||
frontmatterSchema,
|
||||
metaSchema,
|
||||
transformMDX,
|
||||
} from '@fumadocs/content-collections/configuration';
|
||||
import { transformMDX } from '@fumadocs/content-collections/configuration';
|
||||
import { metaSchema, pageSchema } from 'fumadocs-core/source/schema';
|
||||
|
||||
const docs = defineCollection({
|
||||
name: 'docs',
|
||||
directory: 'content/docs',
|
||||
include: '**/*.mdx',
|
||||
schema: frontmatterSchema,
|
||||
schema: pageSchema,
|
||||
transform: transformMDX,
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ const serverLoader = createServerFn({
|
||||
|
||||
return {
|
||||
path: page.path,
|
||||
frontmatter: { ...page.data.frontmatter, _openapi: null },
|
||||
frontmatter: page.data.frontmatter,
|
||||
render: serialize(),
|
||||
markdownUrl: getPageMarkdownUrl(page).url,
|
||||
pageTree: await source.serializePageTree(source.getPageTree()),
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
},
|
||||
"inlinedDependencies": {
|
||||
"@formatjs/fast-memoize": "3.1.2",
|
||||
"@formatjs/intl-localematcher": "0.8.3",
|
||||
"@formatjs/intl-localematcher": "0.8.4",
|
||||
"@shikijs/transformers": "4.0.2",
|
||||
"image-size": "2.0.2",
|
||||
"negotiator": "1.0.0",
|
||||
|
||||
@@ -23,5 +23,5 @@ export const pageSchema = z.object({
|
||||
full: z.boolean().optional(),
|
||||
|
||||
// Fumadocs OpenAPI generated
|
||||
_openapi: z.looseObject({}).optional(),
|
||||
_openapi: z.record(z.string(), z.json()).optional(),
|
||||
});
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import type { DynamicSource, MetaData, StaticSource, VirtualFile } from 'fumadocs-core/source';
|
||||
import type {
|
||||
DynamicSource,
|
||||
MetaData,
|
||||
PageData,
|
||||
StaticSource,
|
||||
VirtualFile,
|
||||
} from 'fumadocs-core/source';
|
||||
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import path from 'node:path';
|
||||
import { createStorage, RawPage } from './storage';
|
||||
@@ -59,6 +65,7 @@ export interface LocalMarkdownPage<
|
||||
> {
|
||||
title: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
content: string;
|
||||
frontmatter: Frontmatter;
|
||||
|
||||
@@ -90,13 +97,19 @@ export function localMd<
|
||||
}>[] = [];
|
||||
|
||||
for (const page of pages) {
|
||||
const frontmatter = page.frontmatter as PageData & { _openapi?: unknown };
|
||||
|
||||
files.push({
|
||||
type: 'page',
|
||||
path: page.path,
|
||||
absolutePath: page.absolutePath,
|
||||
data: {
|
||||
title: page.title,
|
||||
description: page.description,
|
||||
title: frontmatter.title ?? path.basename(page.path, path.extname(page.path)),
|
||||
description: frontmatter.description,
|
||||
icon: frontmatter.icon,
|
||||
// for Fumadocs OpenAPI
|
||||
['_openapi' as never]: frontmatter._openapi,
|
||||
|
||||
content: page.content,
|
||||
frontmatter: page.frontmatter,
|
||||
async load() {
|
||||
|
||||
@@ -4,16 +4,12 @@ import path from 'node:path';
|
||||
import { LocalMarkdownConfig } from '.';
|
||||
import { frontmatter as parseFrontmatter } from 'fumadocs-core/content/md/frontmatter';
|
||||
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import type { PageData } from 'fumadocs-core/source';
|
||||
import * as defaultSchemas from 'fumadocs-core/source/schema';
|
||||
import { defaultInclude } from './shared';
|
||||
|
||||
export interface RawPage<Frontmatter = Record<string, unknown>> {
|
||||
path: string;
|
||||
absolutePath: string;
|
||||
|
||||
title: string;
|
||||
description?: string;
|
||||
content: string;
|
||||
frontmatter: Frontmatter;
|
||||
}
|
||||
@@ -81,14 +77,11 @@ export function createStorage<
|
||||
throw new Error(`invalid frontmatter in "${absolutePath}": ${message}`);
|
||||
}
|
||||
|
||||
const frontmatter = frontmatterResult.value as PageData;
|
||||
return {
|
||||
path: file,
|
||||
absolutePath,
|
||||
title: frontmatter.title ?? path.basename(file, path.extname(file)),
|
||||
description: frontmatter.description,
|
||||
content: parsed.content,
|
||||
frontmatter,
|
||||
frontmatter: frontmatterResult.value,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,9 @@ export * from '@/config/preset';
|
||||
export { remarkInclude } from '@/loaders/mdx/remark-include';
|
||||
|
||||
export type { PostprocessOptions } from '@/loaders/mdx/remark-postprocess';
|
||||
export { metaSchema, pageSchema as frontmatterSchema } from 'fumadocs-core/source/schema';
|
||||
export {
|
||||
/** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
||||
metaSchema,
|
||||
/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
||||
pageSchema as frontmatterSchema,
|
||||
} from 'fumadocs-core/source/schema';
|
||||
|
||||
Generated
+11
-72
@@ -1953,7 +1953,7 @@ importers:
|
||||
version: link:../tsconfig
|
||||
tsdown:
|
||||
specifier: 0.21.10
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
unified:
|
||||
specifier: ^11.0.5
|
||||
version: 11.0.5
|
||||
@@ -1987,7 +1987,7 @@ importers:
|
||||
version: link:../tsconfig
|
||||
tsdown:
|
||||
specifier: 0.21.10
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
|
||||
packages/content:
|
||||
dependencies:
|
||||
@@ -2240,7 +2240,7 @@ importers:
|
||||
version: link:../tsconfig
|
||||
tsdown:
|
||||
specifier: 0.21.10
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
typescript:
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.3
|
||||
@@ -2583,7 +2583,7 @@ importers:
|
||||
version: link:../tsconfig
|
||||
tsdown:
|
||||
specifier: 0.21.10
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
vite:
|
||||
specifier: ^8.0.10
|
||||
version: 8.0.10(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
@@ -3135,7 +3135,7 @@ importers:
|
||||
version: link:../tsconfig
|
||||
tsdown:
|
||||
specifier: 0.21.10
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
version: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
unified:
|
||||
specifier: ^11.0.5
|
||||
version: 11.0.5
|
||||
@@ -8232,11 +8232,6 @@ packages:
|
||||
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-1AaXxEPfXT+GvTBJFuy4yXVHWJBXa4OdbIebGN/wX5DlsIkU0+wzGnd2lOzokSk51d5LUmqjgBLRLlypLUqInQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-6qruVrb5rse6WylFkU0FhBKKGuecWseqdpQfhkawn6ztyk2QlfwSRjsDxMCLJrkfmfN21qvhl9ABgaMeRkuwww==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
@@ -8314,6 +8309,7 @@ packages:
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-b9T4xZ8KqCHs4+TkHJv540LG1B8OD7noKu0Qaizusx3jFtMDHY6osNqgbaOlwW2B8RB2AKzz+sjzlGKIGxIjZw==}
|
||||
cpu: [arm64, x64]
|
||||
os: [darwin, linux, win32]
|
||||
hasBin: true
|
||||
|
||||
@@ -8357,9 +8353,6 @@ packages:
|
||||
resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-6q8HFp+lOQtcf7wBK+uEenxymVWkGKkjFpCvw5W25cmMwEDU45p1xQFBQv8JDlMMry7eNxyBaR+qxgmTUZkIRQ==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-bOoxfJPyYo+ds6W0YfptaCWbFnJYjh2Y1Eow5lRv+vI2u8ganPZqNm1JwNh0t2ELQCqIWg4B3dWEusgAmsoyOw==}
|
||||
|
||||
@@ -17278,7 +17271,7 @@ snapshots:
|
||||
lightningcss: 1.32.0
|
||||
postcss-load-config: 6.0.1([email protected])([email protected])([email protected])([email protected])
|
||||
rolldown: 1.0.0-rc.17
|
||||
tsdown: 0.21.10(@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])
|
||||
tsdown: 0.21.10(@tsdown/[email protected])([email protected])([email protected])
|
||||
optionalDependencies:
|
||||
postcss: 8.5.10
|
||||
transitivePeerDependencies:
|
||||
@@ -18151,8 +18144,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -18241,7 +18232,7 @@ snapshots:
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
baseline-browser-mapping: 2.10.20
|
||||
baseline-browser-mapping: 2.10.22
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -18300,8 +18291,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -18963,13 +18952,9 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]([email protected](@emnapi/[email protected])(@emnapi/[email protected])):
|
||||
optionalDependencies:
|
||||
oxc-resolver: 11.19.1(@emnapi/[email protected])(@emnapi/[email protected])
|
||||
|
||||
[email protected]([email protected]):
|
||||
optionalDependencies:
|
||||
oxc-resolver: 11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)
|
||||
oxc-resolver: 11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -21262,8 +21247,8 @@ snapshots:
|
||||
dependencies:
|
||||
'@next/env': 16.2.4
|
||||
'@swc/helpers': 0.5.15
|
||||
baseline-browser-mapping: 2.10.20
|
||||
caniuse-lite: 1.0.30001788
|
||||
baseline-browser-mapping: 2.10.22
|
||||
caniuse-lite: 1.0.30001790
|
||||
postcss: 8.4.31
|
||||
react: 19.2.5
|
||||
react-dom: 19.2.5([email protected])
|
||||
@@ -22515,24 +22500,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])([email protected]):
|
||||
dependencies:
|
||||
'@babel/generator': 8.0.0-rc.3
|
||||
'@babel/helper-validator-identifier': 8.0.0-rc.3
|
||||
'@babel/parser': 8.0.0-rc.3
|
||||
'@babel/types': 8.0.0-rc.3
|
||||
ast-kit: 3.0.0-beta.1
|
||||
birpc: 4.0.0
|
||||
dts-resolver: 2.1.3([email protected](@emnapi/[email protected])(@emnapi/[email protected]))
|
||||
get-tsconfig: 4.14.0
|
||||
obug: 2.1.1
|
||||
picomatch: 4.0.4
|
||||
rolldown: 1.0.0-rc.17
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- oxc-resolver
|
||||
|
||||
[email protected]([email protected])([email protected])([email protected]):
|
||||
dependencies:
|
||||
'@babel/generator': 8.0.0-rc.3
|
||||
@@ -23180,34 +23147,6 @@ snapshots:
|
||||
minimist: 1.2.8
|
||||
strip-bom: 3.0.0
|
||||
|
||||
[email protected](@tsdown/[email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected]):
|
||||
dependencies:
|
||||
ansis: 4.2.0
|
||||
cac: 7.0.0
|
||||
defu: 6.1.7
|
||||
empathic: 2.0.0
|
||||
hookable: 6.1.1
|
||||
import-without-cache: 0.3.3
|
||||
obug: 2.1.1
|
||||
picomatch: 4.0.4
|
||||
rolldown: 1.0.0-rc.17
|
||||
rolldown-plugin-dts: 0.23.2([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected])([email protected])
|
||||
semver: 7.7.4
|
||||
tinyexec: 1.1.1
|
||||
tinyglobby: 0.2.16
|
||||
tree-kill: 1.2.2
|
||||
unconfig-core: 7.5.0
|
||||
unrun: 0.2.37
|
||||
optionalDependencies:
|
||||
'@tsdown/css': 0.21.10([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@ts-macro/tsc'
|
||||
- '@typescript/native-preview'
|
||||
- oxc-resolver
|
||||
- synckit
|
||||
- vue-tsc
|
||||
|
||||
[email protected](@tsdown/[email protected])([email protected])([email protected]):
|
||||
dependencies:
|
||||
ansis: 4.2.0
|
||||
|
||||
Reference in New Issue
Block a user