mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 23:49:51 +00:00
MDX: expose start function from loader
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-mdx': patch
|
||||
---
|
||||
|
||||
expose `start` function from loader
|
||||
@@ -1,11 +1,15 @@
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { type EventName } from 'chokidar/handler.js';
|
||||
import { watcher } from '@/map/watcher';
|
||||
import { getConfigHash, loadConfigCached } from '@/config/cached';
|
||||
import { generateJS, generateTypes } from '@/map/generate';
|
||||
import { writeManifest } from '@/map/manifest';
|
||||
|
||||
/**
|
||||
* Start a MDX server that builds index and manifest files.
|
||||
*
|
||||
* In development mode, it starts a file watcher to auto-update output as your input changes.
|
||||
*/
|
||||
export async function start(
|
||||
dev: boolean,
|
||||
configPath: string,
|
||||
@@ -18,6 +22,7 @@ export async function start(
|
||||
const typeOut = path.resolve(outDir, `index.d.ts`);
|
||||
|
||||
if (dev) {
|
||||
const { watcher } = await import('@/map/watcher');
|
||||
const instance = watcher(configPath, config);
|
||||
|
||||
instance.on('ready', () => {
|
||||
|
||||
@@ -15,6 +15,8 @@ export interface CreateMDXOptions {
|
||||
const outDir = path.resolve('.source');
|
||||
const defaultPageExtensions = ['mdx', 'md', 'jsx', 'js', 'tsx', 'ts'];
|
||||
|
||||
export { start };
|
||||
|
||||
export function createMDX({
|
||||
configPath = findConfigFile(),
|
||||
}: CreateMDXOptions = {}) {
|
||||
|
||||
Reference in New Issue
Block a user