diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c727af0d4777..dfa741ee030a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,6 +78,12 @@ importers: specifier: ^0.22.0 version: 0.22.0 + packages/@biomejs/wasm-bundler: {} + + packages/@biomejs/wasm-nodejs: {} + + packages/@biomejs/wasm-web: {} + website: dependencies: '@astrojs/starlight': @@ -135,9 +141,6 @@ importers: '@types/node': specifier: ^18.16.3 version: 18.16.3 - '@types/prettier': - specifier: ^2.7.1 - version: 2.7.1 '@types/react': specifier: ^18.2.20 version: 18.2.20 @@ -146,7 +149,7 @@ importers: version: 18.2.7 '@uiw/react-codemirror': specifier: ^4.20.2 - version: 4.20.2(@babel/runtime@7.22.10)(@codemirror/autocomplete@6.9.0)(@codemirror/language@6.8.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.1)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.12.0)(codemirror@6.0.1)(react-dom@17.0.2)(react@17.0.2) + version: 4.20.2(@babel/runtime@7.22.15)(@codemirror/autocomplete@6.9.1)(@codemirror/language@6.9.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.3)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.12.0)(codemirror@6.0.1)(react-dom@17.0.2)(react@17.0.2) '@vitejs/plugin-react': specifier: ^2.1.0 version: 2.1.0(vite@3.1.8) @@ -184,8 +187,8 @@ importers: specifier: ^8.4.23 version: 8.4.23 prettier: - specifier: ^2.8.8 - version: 2.8.8 + specifier: ^3.0.3 + version: 3.0.3 react: specifier: ^17.0.2 version: 17.0.2 @@ -761,6 +764,13 @@ packages: regenerator-runtime: 0.14.0 dev: true + /@babel/runtime@7.22.15: + resolution: {integrity: sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.0 + dev: true + /@babel/template@7.22.5: resolution: {integrity: sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==} engines: {node: '>=6.9.0'} @@ -996,6 +1006,20 @@ packages: '@lezer/common': 1.0.3 dev: true + /@codemirror/autocomplete@6.9.1(@codemirror/language@6.9.0)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0)(@lezer/common@1.0.3): + resolution: {integrity: sha512-yma56tqD7khIZK4gy4X5lX3/k5ArMiCGat7HEWRF/8L2kqOjVdp2qKZqpcJjwTIjSj6fqKAHqi7IjtH3QFE+Bw==} + peerDependencies: + '@codemirror/language': ^6.0.0 + '@codemirror/state': ^6.0.0 + '@codemirror/view': ^6.0.0 + '@lezer/common': ^1.0.0 + dependencies: + '@codemirror/language': 6.9.0 + '@codemirror/state': 6.2.1 + '@codemirror/view': 6.12.0 + '@lezer/common': 1.0.3 + dev: true + /@codemirror/commands@6.2.4: resolution: {integrity: sha512-42lmDqVH0ttfilLShReLXsDfASKLXzfyC36bzwcqzox9PlHulMcsUOfHXNo2X2aFMVNUoQ7j+d4q5bnfseYoOA==} dependencies: @@ -1005,6 +1029,15 @@ packages: '@lezer/common': 1.0.3 dev: true + /@codemirror/commands@6.2.5: + resolution: {integrity: sha512-dSi7ow2P2YgPBZflR9AJoaTHvqmeGIgkhignYMd5zK5y6DANTvxKxp6eMEpIDUJkRAaOY/TFZ4jP1ADIO/GLVA==} + dependencies: + '@codemirror/language': 6.9.0 + '@codemirror/state': 6.2.1 + '@codemirror/view': 6.12.0 + '@lezer/common': 1.0.4 + dev: true + /@codemirror/lang-javascript@6.1.8: resolution: {integrity: sha512-5cIA6IOkslTu1DtldcYnj7hsBm3p+cD37qSaKvW1kV16M6q9ysKvKrveCOWgbrj4+ilSWRL2JtSLudbeB158xg==} dependencies: @@ -1035,6 +1068,17 @@ packages: style-mod: 4.0.3 dev: true + /@codemirror/language@6.9.0: + resolution: {integrity: sha512-nFu311/0ne/qGuGCL3oKuktBgzVOaxCHZPZv1tLSZkNjPYxxvkjSbzno3MlErG2tgw1Yw1yF8BxMCegeMXqpiw==} + dependencies: + '@codemirror/state': 6.2.1 + '@codemirror/view': 6.12.0 + '@lezer/common': 1.0.4 + '@lezer/highlight': 1.1.6 + '@lezer/lr': 1.3.10 + style-mod: 4.1.0 + dev: true + /@codemirror/lint@6.2.1: resolution: {integrity: sha512-y1muai5U/uUPAGRyHMx9mHuHLypPcHWxzlZGknp/U5Mdb5Ol8Q5ZLp67UqyTbNFJJ3unVxZ8iX3g1fMN79S1JQ==} dependencies: @@ -1043,8 +1087,16 @@ packages: crelt: 1.0.6 dev: true - /@codemirror/search@6.5.1: - resolution: {integrity: sha512-4jupk4JwkeVbrN2pStY74q6OJEYqwosB4koA66nyLeVedadtX9MHI38j2vbYmnfDGurDApP3OZO46MrWalcjiQ==} + /@codemirror/lint@6.4.2: + resolution: {integrity: sha512-wzRkluWb1ptPKdzlsrbwwjYCPLgzU6N88YBAmlZi8WFyuiEduSd05MnJYNogzyc8rPK7pj6m95ptUApc8sHKVA==} + dependencies: + '@codemirror/state': 6.2.1 + '@codemirror/view': 6.12.0 + crelt: 1.0.6 + dev: true + + /@codemirror/search@6.5.3: + resolution: {integrity: sha512-M1nGnpUTlOqp0Ywn6V30T8eFcuNFIDfx4+0ja5Wag+qQpL/HZgsIZ7FpE6qZatPziakgj+UXyZTrTUditrkwIQ==} dependencies: '@codemirror/state': 6.2.1 '@codemirror/view': 6.12.0 @@ -1058,7 +1110,7 @@ packages: /@codemirror/theme-one-dark@6.1.2: resolution: {integrity: sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==} dependencies: - '@codemirror/language': 6.8.0 + '@codemirror/language': 6.9.0 '@codemirror/state': 6.2.1 '@codemirror/view': 6.12.0 '@lezer/highlight': 1.1.6 @@ -1739,6 +1791,10 @@ packages: resolution: {integrity: sha512-JH4wAXCgUOcCGNekQPLhVeUtIqjH0yPBs7vvUdSjyQama9618IOKFJwkv2kcqdhF0my8hQEgCTEJU0GIgnahvA==} dev: true + /@lezer/common@1.0.4: + resolution: {integrity: sha512-lZHlk8p67x4aIDtJl6UQrXSOP6oi7dQR3W/geFVrENdA1JDaAJWldnVqVjPMJupbTKbzDfFcePfKttqVidS/dg==} + dev: true + /@lezer/highlight@1.1.6: resolution: {integrity: sha512-cmSJYa2us+r3SePpRCjN5ymCqCPv+zyXmDl0ciWtVaNiORT/MxM7ZgOMQZADD0o51qOaOg24qc/zBViOIwAjJg==} dependencies: @@ -1759,6 +1815,12 @@ packages: '@lezer/lr': 1.3.9 dev: true + /@lezer/lr@1.3.10: + resolution: {integrity: sha512-BZfVvf7Re5BIwJHlZXbJn9L8lus5EonxQghyn+ih8Wl36XMFBPTXC0KM0IdUtj9w/diPHsKlXVgL+AlX2jYJ0Q==} + dependencies: + '@lezer/common': 1.0.4 + dev: true + /@lezer/lr@1.3.9: resolution: {integrity: sha512-XPz6dzuTHlnsbA5M2DZgjflNQ+9Hi5Swhic0RULdp3oOs3rh6bqGZolosVqN/fQIT8uNiepzINJDnS39oweTHQ==} dependencies: @@ -2245,10 +2307,6 @@ packages: /@types/parse5@6.0.3: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} - /@types/prettier@2.7.1: - resolution: {integrity: sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==} - dev: true - /@types/prop-types@15.7.5: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true @@ -2294,7 +2352,7 @@ packages: /@types/yargs-parser@21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} - /@uiw/codemirror-extensions-basic-setup@4.20.2(@codemirror/autocomplete@6.9.0)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.1)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0): + /@uiw/codemirror-extensions-basic-setup@4.20.2(@codemirror/autocomplete@6.9.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.9.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.3)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0): resolution: {integrity: sha512-8oF7ICSEoJVjn9MNKLsY5BaxGsFS/Qh8AMHa/0hZP1fExeI+LKhaaSfHbdRk8RpYE5Ffjtx+tBQfh22YBiv5dQ==} peerDependencies: '@codemirror/autocomplete': '>=6.0.0' @@ -2305,16 +2363,16 @@ packages: '@codemirror/state': '>=6.0.0' '@codemirror/view': '>=6.0.0' dependencies: - '@codemirror/autocomplete': 6.9.0(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0)(@lezer/common@1.0.3) + '@codemirror/autocomplete': 6.9.1(@codemirror/language@6.9.0)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0)(@lezer/common@1.0.3) '@codemirror/commands': 6.2.4 - '@codemirror/language': 6.8.0 + '@codemirror/language': 6.9.0 '@codemirror/lint': 6.2.1 - '@codemirror/search': 6.5.1 + '@codemirror/search': 6.5.3 '@codemirror/state': 6.2.1 '@codemirror/view': 6.12.0 dev: true - /@uiw/react-codemirror@4.20.2(@babel/runtime@7.22.10)(@codemirror/autocomplete@6.9.0)(@codemirror/language@6.8.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.1)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.12.0)(codemirror@6.0.1)(react-dom@17.0.2)(react@17.0.2): + /@uiw/react-codemirror@4.20.2(@babel/runtime@7.22.15)(@codemirror/autocomplete@6.9.1)(@codemirror/language@6.9.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.3)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.12.0)(codemirror@6.0.1)(react-dom@17.0.2)(react@17.0.2): resolution: {integrity: sha512-Rf6i9HgtNnYAVRBb1gfWlhiiOBrEPuIfHLn87cV9XPpjP+YtqZoP6VMMlMq4XFTbZ/E1GIxnSUgJMQToTth0iw==} peerDependencies: '@babel/runtime': '>=7.11.0' @@ -2325,12 +2383,12 @@ packages: react: '>=16.8.0' react-dom: '>=16.8.0' dependencies: - '@babel/runtime': 7.22.10 + '@babel/runtime': 7.22.15 '@codemirror/commands': 6.2.4 '@codemirror/state': 6.2.1 '@codemirror/theme-one-dark': 6.1.2 '@codemirror/view': 6.12.0 - '@uiw/codemirror-extensions-basic-setup': 4.20.2(@codemirror/autocomplete@6.9.0)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.1)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0) + '@uiw/codemirror-extensions-basic-setup': 4.20.2(@codemirror/autocomplete@6.9.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.9.0)(@codemirror/lint@6.2.1)(@codemirror/search@6.5.3)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0) codemirror: 6.0.1(@lezer/common@1.0.3) react: 17.0.2 react-dom: 17.0.2(react@17.0.2) @@ -2996,7 +3054,7 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} @@ -3068,11 +3126,11 @@ packages: /codemirror@6.0.1(@lezer/common@1.0.3): resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==} dependencies: - '@codemirror/autocomplete': 6.9.0(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0)(@lezer/common@1.0.3) - '@codemirror/commands': 6.2.4 - '@codemirror/language': 6.8.0 - '@codemirror/lint': 6.2.1 - '@codemirror/search': 6.5.1 + '@codemirror/autocomplete': 6.9.1(@codemirror/language@6.9.0)(@codemirror/state@6.2.1)(@codemirror/view@6.12.0)(@lezer/common@1.0.3) + '@codemirror/commands': 6.2.5 + '@codemirror/language': 6.9.0 + '@codemirror/lint': 6.4.2 + '@codemirror/search': 6.5.3 '@codemirror/state': 6.2.1 '@codemirror/view': 6.12.0 transitivePeerDependencies: @@ -4403,8 +4461,8 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -6487,6 +6545,12 @@ packages: engines: {node: '>=10.13.0'} hasBin: true + /prettier@3.0.3: + resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /prismjs@1.29.0: resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} engines: {node: '>=6'} @@ -6857,7 +6921,7 @@ packages: engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /rollup@3.21.3: @@ -6865,7 +6929,7 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /rollup@3.28.0: @@ -6873,7 +6937,7 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 /rome@12.0.0: resolution: {integrity: sha512-w/tLvLj5PGUCx3R+Kna08BMq4zL83Xzh9spvrqoWa3Nkzk16SkD8JSpyWWP9WhI2r3qv3Xvc7FnYZ4QDnjAiYg==} @@ -7294,6 +7358,10 @@ packages: resolution: {integrity: sha512-78Jv8kYJdjbvRwwijtCevYADfsI0lGzYJe4mMFdceO8l75DFFDoqBhR1jVDicDRRaX4//g1u9wKeo+ztc2h1Rw==} dev: true + /style-mod@4.1.0: + resolution: {integrity: sha512-Ca5ib8HrFn+f+0n4N4ScTIA9iTOQ7MaGS1ylHcoVqW9J7w2w8PzN6g9gKmTYgGEBH8e120+RCmhpje6jC5uGWA==} + dev: true + /style-to-object@0.4.2: resolution: {integrity: sha512-1JGpfPB3lo42ZX8cuPrheZbfQ6kqPPnPHlKMyeRYtfKD+0jG+QsXgXN57O/dvJlzlB2elI6dGmrPnl5VPQFPaA==} dependencies: @@ -7808,7 +7876,7 @@ packages: rollup: 2.78.1 sass: 1.62.1 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /vite@4.4.9(@types/node@18.16.3)(sass@1.62.1): @@ -7845,7 +7913,7 @@ packages: rollup: 3.28.0 sass: 1.62.1 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 /vitefu@0.2.4(vite@4.4.9): resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==} diff --git a/website/package.json b/website/package.json index b29782090052..b9575eb11341 100644 --- a/website/package.json +++ b/website/package.json @@ -1,71 +1,70 @@ { - "name": "@biomejs/website", - "private": true, - "scripts": { - "start": "astro dev --open", - "format": "cargo biome-cli-dev format --write .", - "tsc": "tsc --skipLibCheck", - "check": "cargo biome-cli-dev check ./", - "check:apply": "cargo biome-cli-dev check ./ --apply-unsafe", - "start:playground": "pnpm build:wasm-dev && pnpm start", - "build": "pnpm build:wasm && pnpm build:js", - "build:js": "astro build", - "build:wasm": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomedev ../crates/biome_wasm", - "build:wasm-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --scope biomedev ../crates/biome_wasm", - "preview": "astro preview" - }, - "devDependencies": { - "@algolia/client-search": "^4.17.0", - "@astrojs/mdx": "^0.19.7", - "@astrojs/prism": "^2.1.2", - "@astrojs/react": "^2.2.2", - "@astrojs/rss": "^2.4.4", - "@astrojs/vercel": "^3.8.1", - "@codemirror/lang-javascript": "^6.1.8", - "@codemirror/lang-json": "^6.0.1", - "@codemirror/lint": "^6.2.1", - "@codemirror/state": "6.2.1", - "@codemirror/view": "6.12.0", - "@docsearch/css": "^3.3.0", - "@docsearch/js": "^3.3.0", - "@fontsource/inter": "^4.5.14", - "@biomejs/wasm-web": "../packages/@biomejs/wasm-web", - "@types/mermaid": "^9.1.0", - "@types/node": "^18.16.3", - "@types/prettier": "^2.7.1", - "@types/react": "^18.2.20", - "@types/react-dom": "^18.2.7", - "@uiw/react-codemirror": "^4.20.2", - "@vitejs/plugin-react": "^2.1.0", - "astro": "^2.10.9", - "astro-compress": "^2.0.12", - "autoprefixer": "^10.4.12", - "codemirror-lang-rome-ast": "0.0.6", - "fast-diff": "^1.2.0", - "globby": "^13.1.2", - "hast-util-to-html": "^8.0.4", - "lang-rome-formatter-ir": "0.0.2", - "mdast-util-to-hast": "^12.3.0", - "mermaid": "^9.4.3", - "postcss": "^8.4.23", - "prettier": "^2.8.8", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "rehype-autolink-headings": "^6.1.1", - "rehype-slug": "^5.1.0", - "rehype-toc": "^3.0.2", - "remark-toc": "^8.0.1", - "rollup": "^3.21.3", - "rome": "^12.0.0", - "sass": "^1.62.1", - "typescript": "^5.0.4", - "vite": "3.1.8", - "vite-plugin-svgr": "^2.2.2" - }, - "engines": { - "pnpm": "^8.0.0" - }, - "dependencies": { - "@astrojs/starlight": "^0.8.0" - } + "name": "@biomejs/website", + "private": true, + "scripts": { + "start": "astro dev --open", + "format": "cargo biome-cli-dev format --write .", + "tsc": "tsc --skipLibCheck", + "check": "cargo biome-cli-dev check ./", + "check:apply": "cargo biome-cli-dev check ./ --apply-unsafe", + "start:playground": "pnpm build:wasm-dev && pnpm start", + "build": "pnpm build:wasm && pnpm build:js", + "build:js": "astro build", + "build:wasm": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomedev ../crates/biome_wasm", + "build:wasm-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --scope biomedev ../crates/biome_wasm", + "preview": "astro preview" + }, + "devDependencies": { + "@algolia/client-search": "^4.17.0", + "@astrojs/mdx": "^0.19.7", + "@astrojs/prism": "^2.1.2", + "@astrojs/react": "^2.2.2", + "@astrojs/rss": "^2.4.4", + "@astrojs/vercel": "^3.8.1", + "@biomejs/wasm-web": "../packages/@biomejs/wasm-web", + "@codemirror/lang-javascript": "^6.1.8", + "@codemirror/lang-json": "^6.0.1", + "@codemirror/lint": "^6.2.1", + "@codemirror/state": "6.2.1", + "@codemirror/view": "6.12.0", + "@docsearch/css": "^3.3.0", + "@docsearch/js": "^3.3.0", + "@fontsource/inter": "^4.5.14", + "@types/mermaid": "^9.1.0", + "@types/node": "^18.16.3", + "@types/react": "^18.2.20", + "@types/react-dom": "^18.2.7", + "@uiw/react-codemirror": "^4.20.2", + "@vitejs/plugin-react": "^2.1.0", + "astro": "^2.10.9", + "astro-compress": "^2.0.12", + "autoprefixer": "^10.4.12", + "codemirror-lang-rome-ast": "0.0.6", + "fast-diff": "^1.2.0", + "globby": "^13.1.2", + "hast-util-to-html": "^8.0.4", + "lang-rome-formatter-ir": "0.0.2", + "mdast-util-to-hast": "^12.3.0", + "mermaid": "^9.4.3", + "postcss": "^8.4.23", + "prettier": "^3.0.3", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "rehype-autolink-headings": "^6.1.1", + "rehype-slug": "^5.1.0", + "rehype-toc": "^3.0.2", + "remark-toc": "^8.0.1", + "rollup": "^3.21.3", + "rome": "^12.0.0", + "sass": "^1.62.1", + "typescript": "^5.0.4", + "vite": "3.1.8", + "vite-plugin-svgr": "^2.2.2" + }, + "engines": { + "pnpm": "^8.0.0" + }, + "dependencies": { + "@astrojs/starlight": "^0.8.0" + } } diff --git a/website/src/playground/types.ts b/website/src/playground/types.ts index 2058c07bcc80..aec2f23b6cf3 100644 --- a/website/src/playground/types.ts +++ b/website/src/playground/types.ts @@ -2,6 +2,8 @@ import type { Diagnostic } from "@biomejs/wasm-web"; import type { parser } from "codemirror-lang-rome-ast"; import type { Dispatch, SetStateAction } from "react"; +export type { Options as PrettierOptions } from "prettier"; + export enum IndentStyle { Tab = "tab", Space = "space", diff --git a/website/src/playground/workers/prettierWorker.ts b/website/src/playground/workers/prettierWorker.ts index c3a3fdf4b889..7556f59068ad 100644 --- a/website/src/playground/workers/prettierWorker.ts +++ b/website/src/playground/workers/prettierWorker.ts @@ -1,10 +1,13 @@ -import prettier, { Options as PrettierOptions } from "prettier"; +import * as prettier from "prettier"; // @ts-expect-error import parserBabel from "prettier/esm/parser-babel.mjs"; +// @ts-expect-error +import pluginEstree from "prettier/plugins/estree.mjs"; import { ArrowParentheses, IndentStyle, PlaygroundSettings, + PrettierOptions, PrettierOutput, QuoteProperties, QuoteStyle, @@ -16,7 +19,7 @@ import { isJsonFilename, isTypeScriptFilename } from "../utils"; let settings = defaultPlaygroundState.settings; -self.addEventListener("message", (e) => { +self.addEventListener("message", async (e) => { switch (e.data.type) { case "updateSettings": { settings = e.data.settings as PlaygroundSettings; @@ -38,7 +41,7 @@ self.addEventListener("message", (e) => { const code = e.data.code as string; const filename = e.data.filename as string; - const prettierOutput = formatWithPrettier(code, { + const prettierOutput = await formatWithPrettier(code, { lineWidth, indentStyle, indentWidth, @@ -65,7 +68,7 @@ self.addEventListener("message", (e) => { } }); -function formatWithPrettier( +async function formatWithPrettier( code: string, options: { lineWidth: number; @@ -79,14 +82,14 @@ function formatWithPrettier( semicolons: Semicolons; arrowParentheses: ArrowParentheses; }, -): PrettierOutput { +): Promise { try { const prettierOptions: PrettierOptions = { useTabs: options.indentStyle === IndentStyle.Tab, tabWidth: options.indentWidth, printWidth: options.lineWidth, filepath: options.filepath, - plugins: [parserBabel], + plugins: [parserBabel, pluginEstree], parser: getPrettierParser(options.filepath), singleQuote: options.quoteStyle === QuoteStyle.Single, jsxSingleQuote: options.jsxQuoteStyle === QuoteStyle.Single, @@ -101,18 +104,15 @@ function formatWithPrettier( // @ts-expect-error const debug = prettier.__debug; - const document = debug.printToDoc(code, prettierOptions); + const document = await debug.printToDoc(code, prettierOptions); - // formatDoc must be before printDocToString because printDocToString mutates the document and breaks the ir - const ir = debug.formatDoc(document, { + // formatDoc must be before prettier.format because prettier.format mutates the document and breaks the ir + const ir = await debug.formatDoc(document, { parser: "babel", - plugins: [parserBabel], + plugins: [parserBabel, pluginEstree], }); - const formattedCode = debug.printDocToString( - document, - prettierOptions, - ).formatted; + const formattedCode = await prettier.format(code, prettierOptions); return { type: "SUCCESS",