From b76fe5e9f116d6e4397187b1d037ceea6394edf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Deng=20=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Sun, 8 Sep 2024 11:30:27 +0800 Subject: [PATCH] feat: upgrade vue language tools to v2.1 (#382) --- package.json | 4 ++-- pnpm-lock.yaml | 64 ++++++++++++++++++++++++++++++-------------------- src/program.ts | 14 ++++------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index e8c78a0..4dfce12 100644 --- a/package.json +++ b/package.json @@ -60,8 +60,8 @@ "dependencies": { "@microsoft/api-extractor": "7.47.4", "@rollup/pluginutils": "^5.1.0", - "@volar/typescript": "^2.3.4", - "@vue/language-core": "2.0.29", + "@volar/typescript": "^2.4.4", + "@vue/language-core": "2.1.6", "compare-versions": "^6.1.1", "debug": "^4.3.6", "kolorist": "^1.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 768b6a1..5dd300e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,11 +22,11 @@ importers: specifier: ^5.1.0 version: 5.1.0(rollup@3.29.4) '@volar/typescript': - specifier: ^2.3.4 - version: 2.3.4 + specifier: ^2.4.4 + version: 2.4.4 '@vue/language-core': - specifier: 2.0.29 - version: 2.0.29(typescript@5.5.4) + specifier: 2.1.6 + version: 2.1.6(typescript@5.5.4) compare-versions: specifier: ^6.1.1 version: 6.1.1 @@ -1438,23 +1438,20 @@ packages: '@vitest/utils@2.0.4': resolution: {integrity: sha512-Zc75QuuoJhOBnlo99ZVUkJIuq4Oj0zAkrQ2VzCqNCx6wAwViHEh5Fnp4fiJTE9rA+sAoXRf00Z9xGgfEzV6fzQ==} - '@volar/language-core@2.3.4': - resolution: {integrity: sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==} - '@volar/language-core@2.4.0-alpha.18': resolution: {integrity: sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==} - '@volar/source-map@2.3.4': - resolution: {integrity: sha512-C+t63nwcblqLIVTYXaVi/+gC8NukDaDIQI72J3R7aXGvtgaVB16c+J8Iz7/VfOy7kjYv7lf5GhBny6ACw9fTGQ==} + '@volar/language-core@2.4.4': + resolution: {integrity: sha512-kO9k4kTLfxpg+6lq7/KAIv3m2d62IHuCL6GbVgYZTpfKvIGoAIlDxK7pFcB/eczN2+ydg/vnyaeZ6SGyZrJw2w==} '@volar/source-map@2.4.0-alpha.18': resolution: {integrity: sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==} - '@volar/typescript@2.3.4': - resolution: {integrity: sha512-acCvt7dZECyKcvO5geNybmrqOsu9u8n5XP1rfiYsOLYGPxvHRav9BVmEdRyZ3vvY6mNyQ1wLL5Hday4IShe17w==} + '@volar/source-map@2.4.4': + resolution: {integrity: sha512-xG3PZqOP2haG8XG4Pg3PD1UGDAdqZg24Ru8c/qYjYAnmcj6GBR64mstx+bZux5QOyRaJK+/lNM/RnpvBD3489g==} - '@volar/typescript@2.4.0-alpha.18': - resolution: {integrity: sha512-sXh5Y8sqGUkgxpMWUGvRXggxYHAVxg0Pa1C42lQZuPDrW6vHJPR0VCK8Sr7WJsAW530HuNQT/ZIskmXtxjybMQ==} + '@volar/typescript@2.4.4': + resolution: {integrity: sha512-QQMQRVj0fVHJ3XdRKiS1LclhG0VBXdFYlyuHRQF/xLk2PuJuHNWP26MDZNvEVCvnyUQuUQhIAfylwY5TGPgc6w==} '@vue/babel-helper-vue-transform-on@1.1.5': resolution: {integrity: sha512-SgUymFpMoAyWeYWLAY+MkCK3QEROsiUnfaw5zxOVD/M64KQs8D/4oK6Q5omVA2hnvEOE0SCkH2TZxs/jnnUj7w==} @@ -1515,6 +1512,14 @@ packages: typescript: optional: true + '@vue/language-core@2.1.6': + resolution: {integrity: sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@vue/reactivity@3.4.32': resolution: {integrity: sha512-1P7QvghAzhSIWmiNmh4MNkLVjr2QTNDcFv2sKmytEWhR6t7BZzNicgm5ENER4uU++wbWxgRh/pSEYgdI3MDcvg==} @@ -5424,27 +5429,21 @@ snapshots: loupe: 3.1.1 tinyrainbow: 1.2.0 - '@volar/language-core@2.3.4': - dependencies: - '@volar/source-map': 2.3.4 - '@volar/language-core@2.4.0-alpha.18': dependencies: '@volar/source-map': 2.4.0-alpha.18 - '@volar/source-map@2.3.4': {} + '@volar/language-core@2.4.4': + dependencies: + '@volar/source-map': 2.4.4 '@volar/source-map@2.4.0-alpha.18': {} - '@volar/typescript@2.3.4': - dependencies: - '@volar/language-core': 2.3.4 - path-browserify: 1.0.1 - vscode-uri: 3.0.8 + '@volar/source-map@2.4.4': {} - '@volar/typescript@2.4.0-alpha.18': + '@volar/typescript@2.4.4': dependencies: - '@volar/language-core': 2.4.0-alpha.18 + '@volar/language-core': 2.4.4 path-browserify: 1.0.1 vscode-uri: 3.0.8 @@ -5553,6 +5552,19 @@ snapshots: optionalDependencies: typescript: 5.5.4 + '@vue/language-core@2.1.6(typescript@5.5.4)': + dependencies: + '@volar/language-core': 2.4.4 + '@vue/compiler-dom': 3.4.32 + '@vue/compiler-vue2': 2.7.16 + '@vue/shared': 3.4.32 + computeds: 0.0.1 + minimatch: 9.0.3 + muggle-string: 0.4.1 + path-browserify: 1.0.1 + optionalDependencies: + typescript: 5.5.4 + '@vue/reactivity@3.4.32': dependencies: '@vue/shared': 3.4.32 @@ -8435,7 +8447,7 @@ snapshots: vue-tsc@2.0.29(typescript@5.5.4): dependencies: - '@volar/typescript': 2.4.0-alpha.18 + '@volar/typescript': 2.4.4 '@vue/language-core': 2.0.29(typescript@5.5.4) semver: 7.6.3 typescript: 5.5.4 diff --git a/src/program.ts b/src/program.ts index 6d489f7..d879688 100644 --- a/src/program.ts +++ b/src/program.ts @@ -1,7 +1,6 @@ import { createParsedCommandLine, - createRootFileChecker, - createVueLanguagePlugin2, + createVueLanguagePlugin, resolveVueCompilerOptions } from '@vue/language-core' @@ -32,16 +31,11 @@ const _createProgram = !hasVue } } - const vueLanguagePlugin = createVueLanguagePlugin2( + const vueLanguagePlugin = createVueLanguagePlugin( ts, - id => id, - createRootFileChecker( - undefined, - () => options.rootNames.map(rootName => rootName.replace(/\\/g, '/')), - options.host?.useCaseSensitiveFileNames?.() ?? false - ), options.options, - vueOptions + vueOptions, + id => id ) return [vueLanguagePlugin] })