@@ -3,6 +3,7 @@ import { createHash } from 'node:crypto';
3
3
import { mkdir , readFile , readdir , stat , writeFile } from 'node:fs/promises' ;
4
4
import path from 'node:path' ;
5
5
import ts from 'typescript' ;
6
+ import * as prettier from 'prettier' ;
6
7
import { SHIKI_LANGUAGE_MAP , escape , normalizeSlugify , smart_quotes , transform } from './utils' ;
7
8
import type { Declaration , TypeElement , Modules } from './index' ;
8
9
@@ -33,7 +34,6 @@ const METADATA_REGEX =
33
34
const CACHE_MAP = new Map < string , string > ( ) ;
34
35
35
36
let twoslash_module : typeof import ( 'shiki-twoslash' ) ;
36
- let prettier_module : typeof import ( 'prettier' ) ;
37
37
38
38
/**
39
39
* A super markdown renderer function. Renders svelte and kit docs specific specific markdown code to html.
@@ -129,7 +129,6 @@ export async function render_content_markdown(
129
129
} : RenderContentOptions = { }
130
130
) {
131
131
twoslash_module ??= await import ( 'shiki-twoslash' ) ;
132
- prettier_module ??= await import ( 'prettier' ) ;
133
132
134
133
const highlighter = await twoslash_module . createShikiHighlighter ( { theme : 'css-variables' } ) ;
135
134
@@ -478,7 +477,7 @@ export async function convert_to_ts(js_code: string, indent = '', offset = '') {
478
477
code . appendLeft ( insertion_point , offset + import_statements + '\n' ) ;
479
478
}
480
479
481
- let transformed = await prettier_module . format ( code . toString ( ) , {
480
+ let transformed = await prettier . format ( code . toString ( ) , {
482
481
printWidth : 100 ,
483
482
parser : 'typescript' ,
484
483
useTabs : true ,
@@ -500,7 +499,7 @@ export async function convert_to_ts(js_code: string, indent = '', offset = '') {
500
499
let name = type_text ?. slice ( 1 , - 1 ) ; // remove { }
501
500
502
501
const single_line_name = (
503
- await prettier_module . format ( name ?? '' , {
502
+ await prettier . format ( name ?? '' , {
504
503
printWidth : 1000 ,
505
504
parser : 'typescript' ,
506
505
semi : false ,
0 commit comments