File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 11import fs from 'fs-extra'
22import path from 'path'
3- import prettier from "@prettier/sync"
3+ import { createSyncFn } from 'synckit'
44import { parse } from '@adobe/css-tools'
55import { createParser } from 'css-selector-parser'
66import { ElementOfHtml } from './elementOfHtml.js'
77
8+ const syncFormatting = createSyncFn ( path . resolve ( './formatWorker.js' ) )
89
910export class CssToHtml {
1011 static ENCODING = 'utf8'
@@ -113,7 +114,7 @@ export class CssToHtml {
113114 }
114115
115116 if ( this . format ) {
116- return prettier . format ( newContent , { parser : "html" } )
117+ return syncFormatting ( newContent )
117118 } else {
118119 return newContent
119120 }
Original file line number Diff line number Diff line change 1+ import { runAsWorker } from 'synckit'
2+ import * as prettier from "prettier"
3+
4+ runAsWorker ( async ( newContent ) => {
5+ return prettier . format ( newContent , { parser : "html" } )
6+ } )
Original file line number Diff line number Diff line change 2626 ],
2727 "dependencies" : {
2828 "@adobe/css-tools" : " ^4.4.0" ,
29- "@prettier/sync" : " ^0.5.2" ,
3029 "css-selector-parser" : " ^3.0.5" ,
3130 "fs-extra" : " ^11.2.0" ,
32- "prettier" : " ^3.3.3"
31+ "prettier" : " ^3.3.3" ,
32+ "synckit" : " ^0.9.2"
3333 },
3434 "license" : " ISC"
3535}
You can’t perform that action at this time.
0 commit comments