From c6c705f793830ccfdc895651c1fc46fd2bd9a0ac Mon Sep 17 00:00:00 2001 From: rorycai Date: Wed, 5 Jun 2024 19:05:08 +0800 Subject: [PATCH] fix: add Nitro hooks types declarations --- src/module.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index c30b2f724..292ab0ab2 100644 --- a/src/module.ts +++ b/src/module.ts @@ -22,7 +22,7 @@ import type { BuiltinLanguage as ShikiLang, BuiltinTheme as ShikiTheme, Language import { joinURL, withLeadingSlash, withTrailingSlash } from 'ufo' import { createStorage, type WatchEvent } from 'unstorage' import { name, version } from '../package.json' -import type { MarkdownPlugin, QueryBuilderParams, QueryBuilderWhere } from './runtime/types' +import type { MarkdownPlugin, ParsedContent, QueryBuilderParams, QueryBuilderWhere } from './runtime/types' import { makeIgnored } from './runtime/utils/config' import { CACHE_VERSION, @@ -1053,3 +1053,11 @@ declare module '@nuxt/schema' { content: ModulePrivateRuntimeConfig & ContentContext; } } + +// Keep sync with src/runtime/server/storage.ts +declare module 'nitropack' { + interface NitroRuntimeHooks { + 'content:file:beforeParse': (file: { _id: string; body: string }) => void; + 'content:file:afterParse': (file: ParsedContent) => void; + } +} \ No newline at end of file