Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make @vue/compiler-sfc peer dependency #183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -67,6 +67,8 @@ yarn add --dev @trivago/prettier-plugin-sort-imports

**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**

**Note: If formatting `.vue` sfc files please install `@vue/compiler-sfc` if not in your dependency tree - this normally is within Vue projects.**

### Usage

Add an order in prettier config file.
Expand Down Expand Up @@ -210,8 +212,8 @@ Having some trouble or an issue ? You can check [FAQ / Troubleshooting section](
| NodeJS with ES Modules | ✅ Everything | - |
| React | ✅ Everything | - |
| Angular | ✅ Everything | Supported through `importOrderParserPlugins` API |
| Vue | ✅ Everything | - |
| Svelte | ⚠️ Soon to be supported. | Any contribution is welcome. |
| Vue | ✅ Everything | Peer dependency `@vue/compiler-sfc` is required |
| Svelte | ⚠️ Soon to be supported. | Any contribution is welcome. |

### Used by

Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -39,20 +39,21 @@
"@babel/traverse": "7.17.3",
"@babel/types": "7.17.0",
"javascript-natural-sort": "0.7.1",
"lodash": "4.17.21",
"@vue/compiler-sfc": "^3.2.40"
"lodash": "4.17.21"
},
"devDependencies": {
"@types/chai": "4.2.15",
"@types/jest": "26.0.20",
"@types/lodash": "4.14.168",
"@types/node": "14.14.34",
"@vue/compiler-sfc": "^3.2.41",
"jest": "26.6.3",
"prettier": "2.7.1",
"ts-jest": "26.5.3",
"typescript": "4.2.3"
},
"peerDependencies": {
"@vue/compiler-sfc": "3.x",
"prettier": "2.x"
}
}
3 changes: 1 addition & 2 deletions src/preprocessors/vue-preprocessor.ts
@@ -1,9 +1,8 @@
import { parse } from '@vue/compiler-sfc';

import { PrettierOptions } from '../types';
import { preprocessor } from './preprocessor';

export function vuePreprocessor(code: string, options: PrettierOptions) {
const { parse } = require('@vue/compiler-sfc')
const { descriptor } = parse(code);
const content =
(descriptor.script ?? descriptor.scriptSetup)?.content ?? code;
Expand Down
72 changes: 36 additions & 36 deletions yarn.lock
Expand Up @@ -642,63 +642,63 @@
dependencies:
"@types/yargs-parser" "*"

"@vue/compiler-core@3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.40.tgz#c785501f09536748121e937fb87605bbb1ada8e5"
integrity sha512-2Dc3Stk0J/VyQ4OUr2yEC53kU28614lZS+bnrCbFSAIftBJ40g/2yQzf4mPBiFuqguMB7hyHaujdgZAQ67kZYA==
"@vue/compiler-core@3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.41.tgz#fb5b25f23817400f44377d878a0cdead808453ef"
integrity sha512-oA4mH6SA78DT+96/nsi4p9DX97PHcNROxs51lYk7gb9Z4BPKQ3Mh+BLn6CQZBw857Iuhu28BfMSRHAlPvD4vlw==
dependencies:
"@babel/parser" "^7.16.4"
"@vue/shared" "3.2.40"
"@vue/shared" "3.2.41"
estree-walker "^2.0.2"
source-map "^0.6.1"

"@vue/compiler-dom@3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.40.tgz#c225418773774db536174d30d3f25ba42a33e7e4"
integrity sha512-OZCNyYVC2LQJy4H7h0o28rtk+4v+HMQygRTpmibGoG9wZyomQiS5otU7qo3Wlq5UfHDw2RFwxb9BJgKjVpjrQw==
"@vue/compiler-dom@3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.41.tgz#dc63dcd3ce8ca8a8721f14009d498a7a54380299"
integrity sha512-xe5TbbIsonjENxJsYRbDJvthzqxLNk+tb3d/c47zgREDa/PCp6/Y4gC/skM4H6PIuX5DAxm7fFJdbjjUH2QTMw==
dependencies:
"@vue/compiler-core" "3.2.40"
"@vue/shared" "3.2.40"
"@vue/compiler-core" "3.2.41"
"@vue/shared" "3.2.41"

"@vue/compiler-sfc@^3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.40.tgz#61823283efc84d25d9d2989458f305d32a2ed141"
integrity sha512-tzqwniIN1fu1PDHC3CpqY/dPCfN/RN1thpBC+g69kJcrl7mbGiHKNwbA6kJ3XKKy8R6JLKqcpVugqN4HkeBFFg==
"@vue/compiler-sfc@^3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.41.tgz#238fb8c48318408c856748f4116aff8cc1dc2a73"
integrity sha512-+1P2m5kxOeaxVmJNXnBskAn3BenbTmbxBxWOtBq3mQTCokIreuMULFantBUclP0+KnzNCMOvcnKinqQZmiOF8w==
dependencies:
"@babel/parser" "^7.16.4"
"@vue/compiler-core" "3.2.40"
"@vue/compiler-dom" "3.2.40"
"@vue/compiler-ssr" "3.2.40"
"@vue/reactivity-transform" "3.2.40"
"@vue/shared" "3.2.40"
"@vue/compiler-core" "3.2.41"
"@vue/compiler-dom" "3.2.41"
"@vue/compiler-ssr" "3.2.41"
"@vue/reactivity-transform" "3.2.41"
"@vue/shared" "3.2.41"
estree-walker "^2.0.2"
magic-string "^0.25.7"
postcss "^8.1.10"
source-map "^0.6.1"

"@vue/compiler-ssr@3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.40.tgz#67df95a096c63e9ec4b50b84cc6f05816793629c"
integrity sha512-80cQcgasKjrPPuKcxwuCx7feq+wC6oFl5YaKSee9pV3DNq+6fmCVwEEC3vvkf/E2aI76rIJSOYHsWSEIxK74oQ==
"@vue/compiler-ssr@3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.41.tgz#344f564d68584b33367731c04ffc949784611fcb"
integrity sha512-Y5wPiNIiaMz/sps8+DmhaKfDm1xgj6GrH99z4gq2LQenfVQcYXmHIOBcs5qPwl7jaW3SUQWjkAPKMfQemEQZwQ==
dependencies:
"@vue/compiler-dom" "3.2.40"
"@vue/shared" "3.2.40"
"@vue/compiler-dom" "3.2.41"
"@vue/shared" "3.2.41"

"@vue/reactivity-transform@3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.40.tgz#dc24b9074b26f0d9dd2034c6349f5bb2a51c86ac"
integrity sha512-HQUCVwEaacq6fGEsg2NUuGKIhUveMCjOk8jGHqLXPI2w6zFoPrlQhwWEaINTv5kkZDXKEnCijAp+4gNEHG03yw==
"@vue/reactivity-transform@3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.41.tgz#9ff938877600c97f646e09ac1959b5150fb11a0c"
integrity sha512-mK5+BNMsL4hHi+IR3Ft/ho6Za+L3FA5j8WvreJ7XzHrqkPq8jtF/SMo7tuc9gHjLDwKZX1nP1JQOKo9IEAn54A==
dependencies:
"@babel/parser" "^7.16.4"
"@vue/compiler-core" "3.2.40"
"@vue/shared" "3.2.40"
"@vue/compiler-core" "3.2.41"
"@vue/shared" "3.2.41"
estree-walker "^2.0.2"
magic-string "^0.25.7"

"@vue/shared@3.2.40":
version "3.2.40"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.40.tgz#e57799da2a930b975321981fcee3d1e90ed257ae"
integrity sha512-0PLQ6RUtZM0vO3teRfzGi4ltLUO5aO+kLgwh4Um3THSR03rpQWLTuRCkuO5A41ITzwdWeKdPHtSARuPkoo5pCQ==
"@vue/shared@3.2.41":
version "3.2.41"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.41.tgz#fbc95422df654ea64e8428eced96ba6ad555d2bb"
integrity sha512-W9mfWLHmJhkfAmV+7gDjcHeAWALQtgGT3JErxULl0oz6R6+3ug91I7IErs93eCFhPCZPHBs4QJS7YWEV7A3sxw==

abab@^2.0.3, abab@^2.0.5:
version "2.0.5"
Expand Down