From 79179def2f398d5a97e51c0f9979fc0f16b52cb7 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sun, 6 Oct 2024 12:52:52 -0700 Subject: [PATCH] chore(playground): upgrade prettier to v3 --- playground/bun.lockb | Bin 52802 -> 52803 bytes playground/package.json | 2 +- playground/src/TabMarkdown.svelte | 21 +++++++++++++++------ playground/src/TabTypeScript.svelte | 23 +++++++++++++---------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/playground/bun.lockb b/playground/bun.lockb index 59d3e0d37edf4142231594743b3907c032067e3e..200e4c74585c81da0c4f494d8e2a474eac51a0e3 100755 GIT binary patch delta 1633 zcmZ8heN0tl7=K?bH#&t(hTeP6y$JG=iN@u^y>Pqo$14O*RJ5{2>Jmw=gc``FI~k>| zEP)mB@Kw8#x>?OOtsOsh({O!^wvv%sH3ku}{Ms5ZU9@gy^*iTqSZjBC-rw{5e$U5! z&pFR$AONTq9_3g|LKfN$G*=iH&s615q?O$=;UvG)%=2O4__;IK%U;SvqBJC?eS7)0%H$@w$K5|&%dI` zLc#B)fKBi>Nr9cDFsy?juuo9HE_fR$us10TyMiLHFHpcC_%tc7MHGfTL=o653dn+g zLy9b(@Z5bQGVAId!xN$Y77m#jXJv zy5);awid|9I1jW=&$XnOv9&?-^*q4X7HUb)x3&Ro($Uqqm{`KtMm^RE^t6tqfvR=% z)Psyw=qLaO;cqhm+rKuyzc+LI_DkFNc>dnZ@!p=!;vfRZ(VZZ@0YXkhJTJclQiC(px!O& zU5uCJv1cd9BSlLY_@=baI+qUYnC1y;UDd&Kow!5ufH-5CO-OIgdSNmlv zub_%fnb**UE(cMk3v1?d=P)0lD_si~=ej+NnVTdjZeLADOkr6R-=EG?-V&k5ED^wnLb{-07rDcAbs=JEQ9M}l|-3)BUz!y^;bw5CzDN?qnM+g7su{?tQH zj_QT8wZht{c8iZiXuMZ;nafYPb#`P-TznBa4~EV0vCS0UC+pSi77tUXxUU>*>y!Qz zb+FHE#m&qd@fx>Ch5b(bQOMY0d;5!ZnU`m&xBC5DI=9?d>Dt7v@(t&#+Sv5BySJq2A3O7#ncvJe z`#t9BV94i#AzgCnsj7&Pfw;fF|NT~z!-~zeh|x;0R0_w6g1onv7>DVJbT+cj9mk13G88L zt&W-h|GHy{FGqY=TU%~>tH;w+*PL5d+fEafsPzMgEk&%()3U#IFJs-onunl8__tv} zo0bb3Z62Ku+S?Nid)A*C(!j-OaI{v;rT6Uh>~BT8xBWw*wy3D?6^s=iY=J9W`)D>i zlk7q`|B@DB6dp$IScShqD&)@;h*bm|7F&x9PM^iQcm=s_3O`LM73Vf!`=Zr4ZtAE@3mQBHcO`>*BAIJ6_@6kP4Yf0mw#L zfE*&Xr0|=hLP`{n6k!Vvs2F*nT0cS$EGH}rX;rS1nxJqC1rikNZtPDfJ&Ic+Tm;%= za1va68L5d1Z>B(^B3#1Wy<|j0myndim;;uT){8D)PHK{3Jpo@abtJ8^eg(8iN6V8L zE78%5Kt^^wP7#`V?~7O{uF^_EHIj464$`JJic$HKr`Dd%fF4Nyg28CoCe6ZtTG*e6Qn z?5b`^=$Jm}8wD3kjoU;I!Ma9O{UW8Ejn}hcLlGFJ%ClwoQ^&b@`s8fB{?8&s_B(@x zwUjc+9Behu?TSb{^}>?HU;`O5tF})7@HtMu|F8gPFE-s8cZH#xV r { console.log(error); }); - $: code = prettier.format(markdown, { - parser: "markdown", - plugins: [plugin], - }); + $: { + format(markdown, { + parser: "markdown", + plugins: [pluginMarkdown], + }) + .then((formatted) => { + code = formatted; + }) + .catch((error) => { + console.log(error); + }); + } diff --git a/playground/src/TabTypeScript.svelte b/playground/src/TabTypeScript.svelte index 48658dae..0cf38545 100644 --- a/playground/src/TabTypeScript.svelte +++ b/playground/src/TabTypeScript.svelte @@ -2,8 +2,9 @@ export let parsed_component = {}; export let moduleName = ""; - import plugin from "prettier/parser-typescript"; - import prettier from "prettier/standalone"; + import pluginTypeScript from "prettier/plugins/typescript"; + import pluginEstree from "prettier/plugins/estree"; + import { format } from "prettier/standalone"; import { writeTsDefinition } from "../../src/writer/writer-ts-definitions"; import CodeHighlighter from "./CodeHighlighter.svelte"; import TabContentOverlay from "./TabContentOverlay.svelte"; @@ -15,15 +16,17 @@ moduleName, }); $: { - try { - prettier_error = null; - code = prettier.format(code, { - parser: "typescript", - plugins: [plugin], + prettier_error = null; + format(code, { + parser: "typescript", + plugins: [pluginTypeScript, pluginEstree], + }) + .then((formatted) => { + code = formatted; + }) + .catch((error) => { + prettier_error = error; }); - } catch (error) { - prettier_error = error; - } }