@@ -83,7 +83,6 @@ function getResolutionCache(siteConfig: SiteConfig) {
8383export async function createMarkdownToVueRenderFn (
8484 srcDir : string ,
8585 options : MarkdownOptions = { } ,
86- isBuild = false ,
8786 base = '/' ,
8887 includeLastUpdatedData = false ,
8988 cleanUrls = false ,
@@ -115,7 +114,7 @@ export async function createMarkdownToVueRenderFn(
115114 const relativePath = slash ( path . relative ( srcDir , file ) )
116115
117116 const cacheKey = JSON . stringify ( { src, ts, relativePath } )
118- if ( isBuild || options . cache !== false ) {
117+ if ( options . cache !== false ) {
119118 const cached = cache . get ( cacheKey )
120119 if ( cached ) {
121120 debug ( `[cache hit] ${ relativePath } ` )
@@ -177,15 +176,9 @@ export async function createMarkdownToVueRenderFn(
177176 }
178177
179178 return siteConfig . ignoreDeadLinks . some ( ( ignore ) => {
180- if ( typeof ignore === 'string' ) {
181- return url === ignore
182- }
183- if ( ignore instanceof RegExp ) {
184- return ignore . test ( url )
185- }
186- if ( typeof ignore === 'function' ) {
187- return ignore ( url , fileOrig )
188- }
179+ if ( typeof ignore === 'string' ) return url === ignore
180+ if ( ignore instanceof RegExp ) return ignore . test ( url )
181+ if ( typeof ignore === 'function' ) return ignore ( url , fileOrig )
189182 return false
190183 } )
191184 }
@@ -198,6 +191,7 @@ export async function createMarkdownToVueRenderFn(
198191
199192 url = url . replace ( / [ ? # ] .* $ / , '' ) . replace ( / \. ( h t m l | m d ) $ / , '' )
200193 if ( url . endsWith ( '/' ) ) url += `index`
194+
201195 let resolved = decodeURIComponent (
202196 slash (
203197 url . startsWith ( '/' )
@@ -207,6 +201,7 @@ export async function createMarkdownToVueRenderFn(
207201 )
208202 resolved =
209203 siteConfig ?. rewrites . inv [ resolved + '.md' ] ?. slice ( 0 , - 3 ) || resolved
204+
210205 if (
211206 ! pages . includes ( resolved ) &&
212207 ! fs . existsSync ( path . resolve ( dir , publicDir , `${ resolved } .html` ) ) &&
@@ -239,12 +234,7 @@ export async function createMarkdownToVueRenderFn(
239234 for ( const fn of transformPageData ) {
240235 if ( fn ) {
241236 const dataToMerge = await fn ( pageData , { siteConfig } )
242- if ( dataToMerge ) {
243- pageData = {
244- ...pageData ,
245- ...dataToMerge
246- }
247- }
237+ if ( dataToMerge ) pageData = { ...pageData , ...dataToMerge }
248238 }
249239 }
250240
@@ -260,15 +250,8 @@ export async function createMarkdownToVueRenderFn(
260250
261251 debug ( `[render] ${ file } in ${ Date . now ( ) - start } ms.` )
262252
263- const result = {
264- vueSrc,
265- pageData,
266- deadLinks,
267- includes
268- }
269- if ( isBuild || options . cache !== false ) {
270- cache . set ( cacheKey , result )
271- }
253+ const result = { vueSrc, pageData, deadLinks, includes }
254+ if ( options . cache !== false ) cache . set ( cacheKey , result )
272255 return result
273256 }
274257}
0 commit comments