@@ -6,12 +6,11 @@ import { extname } from 'node:path';
66import { globSync } from 'tinyglobby' ;
77import { VFile } from 'vfile' ;
88
9+ import { STABILITY_INDEX_URL } from './constants.mjs' ;
910import getConfig from '../../utils/configuration/index.mjs' ;
10- import createQueries from '../../utils/queries/index.mjs' ;
11+ import { QUERIES } from '../../utils/queries/index.mjs' ;
1112import { getRemark } from '../../utils/remark.mjs' ;
1213
13- const { updateStabilityPrefixToLink } = createQueries ( ) ;
14-
1514const remarkProcessor = getRemark ( ) ;
1615
1716/**
@@ -26,9 +25,14 @@ export async function processChunk(inputSlice, itemIndices) {
2625 const results = [ ] ;
2726
2827 for ( const path of filePaths ) {
29- const vfile = new VFile ( { path, value : await readFile ( path , 'utf-8' ) } ) ;
30-
31- updateStabilityPrefixToLink ( vfile ) ;
28+ const content = await readFile ( path , 'utf-8' ) ;
29+ const vfile = new VFile ( {
30+ path,
31+ value : content . replace (
32+ QUERIES . stabilityIndexPrefix ,
33+ match => `[${ match } ](${ STABILITY_INDEX_URL } )`
34+ ) ,
35+ } ) ;
3236
3337 results . push ( {
3438 tree : remarkProcessor . parse ( vfile ) ,
@@ -52,7 +56,7 @@ export async function* generate(_, worker) {
5256 ) ;
5357
5458 // Parse markdown files in parallel using worker threads
55- for await ( const chunkResult of worker . stream ( files , files ) ) {
59+ for await ( const chunkResult of worker . stream ( files ) ) {
5660 yield chunkResult ;
5761 }
5862}
0 commit comments