File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ export default defineBuildConfig({
1414 hooks : {
1515 'build:done' : async ( ) => {
1616 for ( const file of await glob ( './dist/*.d.{cts,mts,ts}' ) ) {
17- const content = await fs . readFile ( file , 'utf-8' )
17+ let content = await fs . readFile ( file , 'utf-8' )
1818 // Override `options` type on dist dts only
19- const newContent = content . replace (
19+ let newContent = content . replace (
2020 'class MarkdownItAsync extends MarkdownIt {' ,
2121 'class MarkdownItAsync extends MarkdownIt {\n // @ts-ignore\n options: MarkdownItAsyncOptions' ,
2222 )
23+ if ( content === newContent )
24+ throw new Error ( `Failed to replace for ${ file } ` )
25+ content = newContent
26+ newContent = content . replace (
27+ 'import MarkdownIt' ,
28+ 'import type MarkdownIt' ,
29+ )
2330 if ( content === newContent )
2431 throw new Error ( `Failed to replace for ${ file } ` )
2532 await fs . writeFile ( file , newContent , 'utf-8' )
You can’t perform that action at this time.
0 commit comments