@@ -198,11 +198,7 @@ For the complete content with full formatting, code examples, and interactive el
198198
199199 return createResponse ( pageTitle , cleanContent , `/${ pathSegments . join ( '/' ) } ` ) ;
200200 } catch ( error ) {
201- // Log error to stderr in server environments, avoid console in production
202- if ( process . env . NODE_ENV === 'development' ) {
203- // eslint-disable-next-line no-console
204- console . error ( 'Error generating llms.txt:' , error ) ;
205- }
201+ console . error ( 'Error generating llms.txt:' , error ) ;
206202 return new NextResponse ( 'Internal server error' , { status : 500 } ) ;
207203 }
208204}
@@ -313,7 +309,7 @@ async function cleanupMarkdown(
313309 ) ;
314310}
315311
316- function resolvePlatformIncludes (
312+ async function resolvePlatformIncludes (
317313 content : string ,
318314 pathSegments : string [ ]
319315) : Promise < string > {
@@ -340,8 +336,7 @@ function resolvePlatformIncludes(
340336 let result = content ;
341337 let match = includePattern . exec ( content ) ;
342338
343- // Fix assignment in while condition by using a separate variable
344- while ( match !== null ) {
339+ while ( ( match = includePattern . exec ( content ) ) !== null ) {
345340 const includePath = match [ 1 ] ;
346341 const fullMatch = match [ 0 ] ;
347342
@@ -375,11 +370,7 @@ function resolvePlatformIncludes(
375370 ) ;
376371 }
377372 } catch ( error ) {
378- // Log error conditionally to avoid console warnings in production
379- if ( process . env . NODE_ENV === 'development' ) {
380- // eslint-disable-next-line no-console
381- console . error ( `Error loading include ${ includePath } :` , error ) ;
382- }
373+ console . error ( `Error loading include ${ includePath } :` , error ) ;
383374 const sectionName = includePath . split ( '/' ) . pop ( ) || 'content' ;
384375 result = result . replace (
385376 fullMatch ,
@@ -391,5 +382,5 @@ function resolvePlatformIncludes(
391382 match = includePattern . exec ( content ) ;
392383 }
393384
394- return Promise . resolve ( result ) ;
385+ return result ;
395386}
0 commit comments