|
|
@ -31,14 +31,14 @@ export interface MarkdownCompileResult {
|
|
|
|
includes: string[]
|
|
|
|
includes: string[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function clearCache(file?: string) {
|
|
|
|
export function clearCache(id?: string) {
|
|
|
|
if (!file) {
|
|
|
|
if (!id) {
|
|
|
|
cache.clear()
|
|
|
|
cache.clear()
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
file = JSON.stringify({ file }).slice(1)
|
|
|
|
id = JSON.stringify({ id }).slice(1)
|
|
|
|
cache.find((_, key) => key.endsWith(file!) && cache.delete(key))
|
|
|
|
cache.find((_, key) => key.endsWith(id!) && cache.delete(key))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export async function createMarkdownToVueRenderFn(
|
|
|
|
export async function createMarkdownToVueRenderFn(
|
|
|
@ -83,7 +83,7 @@ export async function createMarkdownToVueRenderFn(
|
|
|
|
file = rewrites.get(file) || file
|
|
|
|
file = rewrites.get(file) || file
|
|
|
|
const relativePath = slash(path.relative(srcDir, file))
|
|
|
|
const relativePath = slash(path.relative(srcDir, file))
|
|
|
|
|
|
|
|
|
|
|
|
const cacheKey = JSON.stringify({ src, file: relativePath })
|
|
|
|
const cacheKey = JSON.stringify({ src, file: relativePath, id: fileOrig })
|
|
|
|
if (isBuild || options.cache !== false) {
|
|
|
|
if (isBuild || options.cache !== false) {
|
|
|
|
const cached = cache.get(cacheKey)
|
|
|
|
const cached = cache.get(cacheKey)
|
|
|
|
if (cached) {
|
|
|
|
if (cached) {
|
|
|
|