mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 10:55:57 +00:00
Core: fix internal types
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
fix internal types
|
||||
@@ -11,7 +11,7 @@ export function transformerFallback(): PageTreeTransformer {
|
||||
return {
|
||||
root(root) {
|
||||
if (shouldIgnore(this)) return root;
|
||||
const isolatedStorage: ContentStorage = new FileSystem();
|
||||
const isolatedStorage = new FileSystem() as ContentStorage;
|
||||
if (addedFiles.size === this.storage.files.size) return root;
|
||||
|
||||
for (const file of this.storage.getFiles()) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import type { LoaderPlugin } from '../loader';
|
||||
/**
|
||||
* a function to generate slugs, return `undefined` to fallback to default generation.
|
||||
*/
|
||||
export type SlugFn<S = ContentStorage> = (
|
||||
file: S extends ContentStorage<infer P, unknown> ? P : never,
|
||||
export type SlugFn<S extends ContentStorage = ContentStorage> = (
|
||||
file: S['$inferPage'],
|
||||
) => string[] | undefined;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,9 +3,15 @@ import { slash, splitPath } from '@/source/path';
|
||||
import type { ResolvedLoaderConfig } from '../loader';
|
||||
import { isStaticSource, MetaData, PageData, type StaticSource } from '../source';
|
||||
|
||||
export type ContentStorage<P = ContentStoragePageFile, M = ContentStorageMetaFile> = FileSystem<
|
||||
P | M
|
||||
>;
|
||||
export type ContentStorage<
|
||||
P extends ContentStoragePageFile = ContentStoragePageFile,
|
||||
M extends ContentStorageMetaFile = ContentStorageMetaFile,
|
||||
> = FileSystem<P | M> & {
|
||||
/** always `undefined`, for inferring types only */
|
||||
$inferPage: P;
|
||||
/** always `undefined`, for inferring types only */
|
||||
$inferMeta: M;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export interface ContentStorageMetaFile<
|
||||
@@ -126,7 +132,7 @@ export function createContentStorageBuilder(loaderConfig: ResolvedLoaderConfig)
|
||||
}
|
||||
|
||||
function makeStorage(locale: string | typeof EmptyLang, inherit?: ContentStorage) {
|
||||
const storage = new FileSystem(inherit);
|
||||
const storage = new FileSystem(inherit) as ContentStorage;
|
||||
for (const [storageKey, file] of fileMap.get(locale) ?? []) {
|
||||
storage.write(storageKey, file);
|
||||
}
|
||||
|
||||
@@ -75,13 +75,9 @@ export async function crawlFrameworkPkgs(
|
||||
_parentIsFrameworkPkg = false,
|
||||
hasFrameworkAncestor = false,
|
||||
) {
|
||||
const isRoot = parentDepNames.length === 0;
|
||||
const crawlDevDependencies = isRoot;
|
||||
|
||||
const deps = [
|
||||
...Object.keys(currentPkgJson.dependencies ?? {}),
|
||||
...(crawlDevDependencies ? Object.keys(currentPkgJson.devDependencies ?? {}) : []),
|
||||
].filter((dep) => !parentDepNames.includes(dep));
|
||||
const deps = Object.keys(currentPkgJson.dependencies ?? {}).filter(
|
||||
(dep) => !parentDepNames.includes(dep),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
deps.map(async (dep) => {
|
||||
|
||||
Generated
-3
@@ -3471,9 +3471,6 @@ importers:
|
||||
'@fumadocs/story':
|
||||
specifier: workspace:*
|
||||
version: link:../story
|
||||
'@types/node':
|
||||
specifier: ^25.6.2
|
||||
version: 25.6.2
|
||||
fumadocs-core:
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
|
||||
Reference in New Issue
Block a user