From 0fc134d68e47008d757f8868f3939897a3f0aafa Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 06:42:53 +0800 Subject: [PATCH 1/7] Upgrade to Volar 2.0 --- examples/nextjs/package-lock.json | 36 ++++---- examples/nextjs/package.json | 2 +- package-lock.json | 149 +++++++++++++++++++++++------- package.json | 6 +- src/dts.test.ts | 7 +- src/dts.ts | 9 -- src/index.ts | 53 ++--------- src/language-service-host.ts | 94 ------------------- src/language-service/language.ts | 95 ++++++++++--------- 9 files changed, 196 insertions(+), 255 deletions(-) delete mode 100644 src/language-service-host.ts diff --git a/examples/nextjs/package-lock.json b/examples/nextjs/package-lock.json index eb8fb84..5a847d3 100644 --- a/examples/nextjs/package-lock.json +++ b/examples/nextjs/package-lock.json @@ -15,7 +15,7 @@ "next": "13.4.1", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "^4.9.4" + "typescript": "5.3.3" } }, "../..": { @@ -23,18 +23,18 @@ "version": "0.1.1", "license": "MIT", "dependencies": { - "@volar/language-core": "^1.10.4", - "@volar/source-map": "^1.10.4", - "@volar/typescript": "^1.10.4", + "@volar/language-core": "~2.0.1", + "@volar/language-service": "~2.0.1", + "@volar/typescript": "~2.0.1", "change-case": "^4.1.2" }, "devDependencies": { "@mizdra/eslint-config-mizdra": "^2.0.0", "@mizdra/prettier-config-mizdra": "^1.0.0", - "@tsconfig/node18": "^1.0.3", + "@tsconfig/node18": "^18.2.2", "@tsconfig/strictest": "^2.0.2", "@types/eslint": "^8.37.0", - "@types/node": "^18.18.1", + "@types/node": "^18.18.8", "eslint": "^8.38.0", "minimatch": "^9.0.3", "npm-run-all": "^4.1.5", @@ -464,15 +464,15 @@ "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/zod": { @@ -490,13 +490,13 @@ "requires": { "@mizdra/eslint-config-mizdra": "^2.0.0", "@mizdra/prettier-config-mizdra": "^1.0.0", - "@tsconfig/node18": "^1.0.3", + "@tsconfig/node18": "^18.2.2", "@tsconfig/strictest": "^2.0.2", "@types/eslint": "^8.37.0", - "@types/node": "^18.18.1", - "@volar/language-core": "^1.10.4", - "@volar/source-map": "^1.10.4", - "@volar/typescript": "^1.10.4", + "@types/node": "^18.18.8", + "@volar/language-core": "~2.0.1", + "@volar/language-service": "~2.0.1", + "@volar/typescript": "~2.0.1", "change-case": "^4.1.2", "eslint": "^8.38.0", "minimatch": "^9.0.3", @@ -735,9 +735,9 @@ "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==" }, "zod": { "version": "3.21.4", diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index 3c1f2c8..2834699 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -18,6 +18,6 @@ "next": "13.4.1", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "^4.9.4" + "typescript": "5.3.3" } } diff --git a/package-lock.json b/package-lock.json index 510af8d..84c7aa1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "0.1.1", "license": "MIT", "dependencies": { - "@volar/language-core": "^1.10.9", - "@volar/source-map": "^1.10.9", - "@volar/typescript": "^1.10.9", + "@volar/language-core": "~2.0.1", + "@volar/language-service": "~2.0.1", + "@volar/typescript": "~2.0.1", "change-case": "^4.1.2" }, "devDependencies": { @@ -1076,27 +1076,38 @@ } }, "node_modules/@volar/language-core": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.10.9.tgz", - "integrity": "sha512-QXHMX7CeXLqXwvC7nbr6iZ3zrqgKdJ9f6g1B211eZBnvaBki2ds0+Kz8cprUiulVuMQEPJNhDfuh8Vym1gxHRQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.1.tgz", + "integrity": "sha512-k979vTFcACHGAmiMVZJpHP0Er3ULVhR2bjGEy5CYKXKd4stx4VHT/sRWEsc5v/pBBrfTVm18wziSjWEQC4v+dw==", + "dependencies": { + "@volar/source-map": "2.0.1" + } + }, + "node_modules/@volar/language-service": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.0.1.tgz", + "integrity": "sha512-M8MyDXojSJ13KaSmFVSyRTC8rbyRgI/vAtuw8meTeU+mPsqg7z+QTSvbqx4VfLHrBvo1uzeT11PZt5QGTmL2Mg==", "dependencies": { - "@volar/source-map": "1.10.9" + "@volar/language-core": "2.0.1", + "vscode-languageserver-protocol": "^3.17.5", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" } }, "node_modules/@volar/source-map": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.10.9.tgz", - "integrity": "sha512-ul8yGO9nCxy6UedVuo0VsfKMLZzr39N1rgbtnYTGP5C554EDcUix6K/HDurhVdPHEDIw1yhXltLZZQKi3NrTvA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", + "integrity": "sha512-irMc9kI3xLlc50nwdz+o+rHAncPpDXL2pn21e1qMG3mijxuLAZYOFSx6B6f0VDnTKvExXJ8pN85NBxWm3ksPgQ==", "dependencies": { - "muggle-string": "^0.3.1" + "muggle-string": "^0.4.0" } }, "node_modules/@volar/typescript": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.10.9.tgz", - "integrity": "sha512-5jLB46mCQLJqLII/qDLgfyHSq1cesjwuJQIa2GNWd7LPLSpX5vzo3jfQLWc/gyo3up2fQFrlRJK2kgY5REtwuQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1.tgz", + "integrity": "sha512-k3GJMVv38npuaV+O/kYUylDW0QhM6/ItcdIwtvQ74ZS5j8Toqpr+dYc5Hr+5c4vQo33FStBX0C8lgCoISMEP6g==", "dependencies": { - "@volar/language-core": "1.10.9", + "@volar/language-core": "2.0.1", "path-browserify": "^1.0.1" } }, @@ -3475,9 +3486,9 @@ "dev": true }, "node_modules/muggle-string": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.3.1.tgz", - "integrity": "sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==" + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz", + "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==" }, "node_modules/nanoid": { "version": "3.3.6", @@ -5309,6 +5320,38 @@ "vitest": ">=0.28.5" } }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", + "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", @@ -6076,27 +6119,38 @@ } }, "@volar/language-core": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.10.9.tgz", - "integrity": "sha512-QXHMX7CeXLqXwvC7nbr6iZ3zrqgKdJ9f6g1B211eZBnvaBki2ds0+Kz8cprUiulVuMQEPJNhDfuh8Vym1gxHRQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.1.tgz", + "integrity": "sha512-k979vTFcACHGAmiMVZJpHP0Er3ULVhR2bjGEy5CYKXKd4stx4VHT/sRWEsc5v/pBBrfTVm18wziSjWEQC4v+dw==", "requires": { - "@volar/source-map": "1.10.9" + "@volar/source-map": "2.0.1" + } + }, + "@volar/language-service": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.0.1.tgz", + "integrity": "sha512-M8MyDXojSJ13KaSmFVSyRTC8rbyRgI/vAtuw8meTeU+mPsqg7z+QTSvbqx4VfLHrBvo1uzeT11PZt5QGTmL2Mg==", + "requires": { + "@volar/language-core": "2.0.1", + "vscode-languageserver-protocol": "^3.17.5", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" } }, "@volar/source-map": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.10.9.tgz", - "integrity": "sha512-ul8yGO9nCxy6UedVuo0VsfKMLZzr39N1rgbtnYTGP5C554EDcUix6K/HDurhVdPHEDIw1yhXltLZZQKi3NrTvA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", + "integrity": "sha512-irMc9kI3xLlc50nwdz+o+rHAncPpDXL2pn21e1qMG3mijxuLAZYOFSx6B6f0VDnTKvExXJ8pN85NBxWm3ksPgQ==", "requires": { - "muggle-string": "^0.3.1" + "muggle-string": "^0.4.0" } }, "@volar/typescript": { - "version": "1.10.9", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.10.9.tgz", - "integrity": "sha512-5jLB46mCQLJqLII/qDLgfyHSq1cesjwuJQIa2GNWd7LPLSpX5vzo3jfQLWc/gyo3up2fQFrlRJK2kgY5REtwuQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1.tgz", + "integrity": "sha512-k3GJMVv38npuaV+O/kYUylDW0QhM6/ItcdIwtvQ74ZS5j8Toqpr+dYc5Hr+5c4vQo33FStBX0C8lgCoISMEP6g==", "requires": { - "@volar/language-core": "1.10.9", + "@volar/language-core": "2.0.1", "path-browserify": "^1.0.1" } }, @@ -7909,9 +7963,9 @@ "dev": true }, "muggle-string": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.3.1.tgz", - "integrity": "sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==" + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz", + "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==" }, "nanoid": { "version": "3.3.6", @@ -9239,6 +9293,35 @@ "@actions/core": "^1.10.0" } }, + "vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==" + }, + "vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "requires": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "vscode-languageserver-textdocument": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", + "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" + }, + "vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", diff --git a/package.json b/package.json index f9f31c4..dbc401a 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,9 @@ "dist" ], "dependencies": { - "@volar/language-core": "^1.10.9", - "@volar/source-map": "^1.10.9", - "@volar/typescript": "^1.10.9", + "@volar/language-core": "~2.0.1", + "@volar/language-service": "~2.0.1", + "@volar/typescript": "~2.0.1", "change-case": "^4.1.2" }, "peerDependencies": { diff --git a/src/dts.test.ts b/src/dts.test.ts index 5ae6cef..dc51a56 100644 --- a/src/dts.test.ts +++ b/src/dts.test.ts @@ -1,10 +1,5 @@ import { expect, it } from 'vitest'; -import { getDtsFilePath, getExportedName, getDtsContent } from './dts.js'; - -it('getDtsFilePath', () => { - expect(getDtsFilePath('/dir/foo.png', false)).toBe('/dir/foo.png.d.ts'); - expect(getDtsFilePath('/dir/foo.png', true)).toBe('/dir/foo.d.png.ts'); -}); +import { getExportedName, getDtsContent } from './dts.js'; it('getExportedName', () => { expect(getExportedName('/dir/foo-bar.png', 'constantCase', 'I_')).toBe('I_FOO_BAR'); diff --git a/src/dts.ts b/src/dts.ts index cca5ccb..2bba9ed 100644 --- a/src/dts.ts +++ b/src/dts.ts @@ -2,15 +2,6 @@ import path from 'node:path'; import { ExportedNameCase } from './option.js'; import { changeCase } from './util'; -export function getDtsFilePath(filePath: string, arbitraryExtensions: boolean): string { - const { dir, name, ext } = path.parse(filePath); - if (arbitraryExtensions) { - return path.join(dir, `${name}.d${ext}.ts`); - } else { - return path.join(dir, `${name + ext}.d.ts`); - } -} - export function getExportedName( filePath: string, exportedNameCase: ExportedNameCase, diff --git a/src/index.ts b/src/index.ts index 0d21012..c267e6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,50 +1,17 @@ -import { createVirtualFiles } from '@volar/language-core'; -import { decorateLanguageService } from '@volar/typescript'; -import type * as ts from 'typescript/lib/tsserverlibrary'; +import { createLanguageServicePlugin } from '@volar/typescript/lib/quickstart/createLanguageServicePlugin.js'; import { createAssetLanguage } from './language-service/language.js'; -import { - AssetLanguageServiceHost, - createAssetLanguageServiceHost, - decorateLanguageServiceHost, -} from './language-service-host.js'; import { getAssetPluginOptions } from './option.js'; -const projectAssetLSHost = new WeakMap(); +export = createLanguageServicePlugin((ts, info) => { -const init: ts.server.PluginModuleFactory = (modules) => { - const { typescript: ts } = modules; - const pluginModule: ts.server.PluginModule = { - create(info) { - const assetPluginOptions = getAssetPluginOptions(info); + const assetPluginOptions = getAssetPluginOptions(info); - if (!info.project.fileExists(assetPluginOptions.tsConfigPath)) { - // project name not a tsconfig path, this is a inferred project - return info.languageService; - } + if (!info.project.fileExists(assetPluginOptions.tsConfigPath)) { + // project name not a tsconfig path, this is a inferred project + return []; + } - const assetTSLSHost = createAssetLanguageServiceHost(ts.sys, info, assetPluginOptions); - const assetLanguage = createAssetLanguage(assetTSLSHost, assetPluginOptions); - const virtualFiles = createVirtualFiles([assetLanguage]); + const assetLanguage = createAssetLanguage(ts.sys, assetPluginOptions); - projectAssetLSHost.set(info.project, assetTSLSHost); - - decorateLanguageService(virtualFiles, info.languageService, true); - decorateLanguageServiceHost( - assetTSLSHost, - info.project, - virtualFiles, - info.languageServiceHost, - ts, - assetPluginOptions.extensions, - ); - - return info.languageService; - }, - getExternalFiles(project) { - return projectAssetLSHost.get(project)?.getAssetFileNames() ?? []; - }, - }; - return pluginModule; -}; - -export = init; + return [assetLanguage]; +}); diff --git a/src/language-service-host.ts b/src/language-service-host.ts deleted file mode 100644 index fd43d09..0000000 --- a/src/language-service-host.ts +++ /dev/null @@ -1,94 +0,0 @@ -import path from 'node:path'; -import { createVirtualFiles } from '@volar/language-core'; -import { decorateLanguageServiceHost as _decorateLanguageServiceHost } from '@volar/typescript'; -import type * as ts from 'typescript/lib/tsserverlibrary'; -import { AssetPluginOptions, SuggestionRule } from './option'; - -export type AssetLanguageServiceHost = { - getAssetFileNames(): string[]; - isAssetFile(filePath: string): boolean; - getMatchedSuggestionRule(assetFilePath: string): SuggestionRule | undefined; -}; - -export function createAssetLanguageServiceHost( - sys: ts.System, - info: ts.server.PluginCreateInfo, - assetPluginOptions: AssetPluginOptions, -): AssetLanguageServiceHost { - if (sys.watchDirectory === undefined) throw new Error('sys.watchDirectory is undefined'); - - const projectRoot = path.dirname(assetPluginOptions.tsConfigPath); - - function isMatchFile(fileName: string, extensions: string[], exclude: string[], include: string[]): boolean { - if (!extensions.includes(path.extname(fileName))) return false; - return sys.readDirectory(path.dirname(fileName), extensions, exclude, include, 1).includes(fileName); - } - function getAssetFileNameAndRule(): Map { - const assetFileNameAndRule = new Map(); - const fileNames = sys.readDirectory( - path.dirname(assetPluginOptions.tsConfigPath), - assetPluginOptions.extensions, - assetPluginOptions.exclude, - assetPluginOptions.include, - ); - for (const fileName of fileNames) { - // TODO: support custom rule - assetFileNameAndRule.set(fileName, { - exportedNameCase: assetPluginOptions.exportedNameCase, - exportedNamePrefix: assetPluginOptions.exportedNamePrefix, - }); - } - return assetFileNameAndRule; - } - - const assetFileNameAndRule = getAssetFileNameAndRule(); - sys.watchDirectory( - projectRoot, - (fileName) => { - if (!isMatchFile(fileName, assetPluginOptions.extensions, assetPluginOptions.exclude, assetPluginOptions.include)) - return; - if (sys.fileExists(fileName)) { - // TODO: support custom rule - assetFileNameAndRule.set(fileName, { - exportedNameCase: assetPluginOptions.exportedNameCase, - exportedNamePrefix: assetPluginOptions.exportedNamePrefix, - }); - } else { - assetFileNameAndRule.delete(fileName); - } - info.project.markAsDirty(); - info.project.updateGraph(); - }, - true, - { excludeDirectories: assetPluginOptions.exclude }, - ); - - return { - getAssetFileNames() { - return [...assetFileNameAndRule.keys()]; - }, - isAssetFile(filePath: string) { - return assetFileNameAndRule.has(filePath); - }, - getMatchedSuggestionRule(assetFilePath: string) { - return assetFileNameAndRule.get(assetFilePath); - }, - }; -} - -// eslint-disable-next-line max-params -export function decorateLanguageServiceHost( - assetLanguageServiceHost: AssetLanguageServiceHost, - project: ts.server.Project, - virtualFiles: ReturnType, - languageServiceHost: ts.LanguageServiceHost, - ts: typeof import('typescript/lib/tsserverlibrary'), - extensions: string[], -) { - _decorateLanguageServiceHost(virtualFiles, languageServiceHost, ts, extensions); - - const getScriptFileNames = project.getScriptFileNames.bind(project); - languageServiceHost.getScriptFileNames = () => { - return [...getScriptFileNames(), ...assetLanguageServiceHost.getAssetFileNames()]; - }; -} diff --git a/src/language-service/language.ts b/src/language-service/language.ts index 502bcea..535a3c5 100644 --- a/src/language-service/language.ts +++ b/src/language-service/language.ts @@ -1,56 +1,55 @@ -import { VirtualFile, FileKind, FileCapabilities } from '@volar/language-core'; -import { Stack } from '@volar/source-map'; -import type * as ts from 'typescript/lib/tsserverlibrary'; -import { getDtsContent, getDtsFilePath } from '../dts'; -import { AssetLanguageServiceHost } from '../language-service-host.js'; +import type { LanguagePlugin } from '@volar/language-core'; +import { getDtsContent } from '../dts'; import { AssetPluginOptions } from '../option'; +import path from 'node:path'; +import type * as ts from 'typescript/lib/tsserverlibrary'; -export class AssetFile implements VirtualFile { - kind = FileKind.TypeScriptHostFile; - capabilities = FileCapabilities.full; - codegenStacks: Stack[] = []; // TODO: what is this? - fileName!: string; - mappings: VirtualFile['mappings'] = []; - embeddedFiles: VirtualFile['embeddedFiles'] = []; - - constructor( - public sourceFileName: string, - public snapshot: ts.IScriptSnapshot, - public host: AssetLanguageServiceHost, - public assetPluginOptions: AssetPluginOptions, - ) { - this.fileName = getDtsFilePath(this.sourceFileName, this.assetPluginOptions.allowArbitraryExtensions); - this.update(snapshot); - } - - public update(newSnapshot: ts.IScriptSnapshot) { - this.snapshot = newSnapshot; - const suggestionRule = this.host.getMatchedSuggestionRule(this.sourceFileName); - if (suggestionRule === undefined) return; - - const dtsContent = getDtsContent( - this.sourceFileName, - suggestionRule.exportedNameCase, - suggestionRule.exportedNamePrefix, - ); - this.snapshot = { - getText: (start, end) => dtsContent.substring(start, end), - getLength: () => dtsContent.length, - getChangeRange: () => undefined, // TODO: what is this? - }; - } -} - -export function createAssetLanguage(host: AssetLanguageServiceHost, assetPluginOptions: AssetPluginOptions) { +export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPluginOptions): LanguagePlugin { return { - createVirtualFile(fileName: string, snapshot: ts.IScriptSnapshot) { - if (host.isAssetFile(fileName)) { - return new AssetFile(fileName, snapshot, host, assetPluginOptions); + createVirtualCode(fileId, languageId, snapshot) { + const fileName = fileId.includes('://') ? fileId.split('://')[1]! : fileId; + if (isMatchFile( + fileName, + assetPluginOptions.extensions, + assetPluginOptions.exclude, + assetPluginOptions.include + )) { + const dtsContent = getDtsContent( + fileName, + assetPluginOptions.exportedNameCase, + assetPluginOptions.exportedNamePrefix, + ); + return { + id: 'main', + mappings: [], + embeddedCodes: [], + languageId: 'typescript', + snapshot: { + getText: (start, end) => dtsContent.substring(start, end), + getLength: () => dtsContent.length, + getChangeRange: () => undefined, + }, + } } - return undefined; + return; }, - updateVirtualFile(assetFile: AssetFile, snapshot: ts.IScriptSnapshot) { - assetFile.update(snapshot); + updateVirtualCode(fileId, virtualCode, newSnapshot) { + return virtualCode; // asset file content update does not affect virtual code }, + typescript: { + extraFileExtensions: assetPluginOptions.extensions.map(ext => ({ extension: ext.slice(1), isMixedContent: true, scriptKind: 7 })), + getScript(virtualCode) { + return { + code: virtualCode, + extension: '.ts', + scriptKind: 3, + }; + }, + } }; + + function isMatchFile(fileName: string, extensions: string[], exclude: string[], include: string[]): boolean { + if (!extensions.includes(path.extname(fileName))) return false; + return sys.readDirectory(path.dirname(fileName), extensions, exclude, include, 1).includes(fileName); + } } From 9252b4798baeb4694cbc2b03b5c569b7ef5c44d6 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 06:50:18 +0800 Subject: [PATCH 2/7] Bump `@volar/typescript` --- package-lock.json | 98 ++++------------------------------------------- package.json | 3 +- 2 files changed, 8 insertions(+), 93 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84c7aa1..f4bc6e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,7 @@ "license": "MIT", "dependencies": { "@volar/language-core": "~2.0.1", - "@volar/language-service": "~2.0.1", - "@volar/typescript": "~2.0.1", + "@volar/typescript": "~2.0.1-patch.1", "change-case": "^4.1.2" }, "devDependencies": { @@ -1083,17 +1082,6 @@ "@volar/source-map": "2.0.1" } }, - "node_modules/@volar/language-service": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.0.1.tgz", - "integrity": "sha512-M8MyDXojSJ13KaSmFVSyRTC8rbyRgI/vAtuw8meTeU+mPsqg7z+QTSvbqx4VfLHrBvo1uzeT11PZt5QGTmL2Mg==", - "dependencies": { - "@volar/language-core": "2.0.1", - "vscode-languageserver-protocol": "^3.17.5", - "vscode-languageserver-textdocument": "^1.0.11", - "vscode-uri": "^3.0.8" - } - }, "node_modules/@volar/source-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", @@ -1103,9 +1091,9 @@ } }, "node_modules/@volar/typescript": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1.tgz", - "integrity": "sha512-k3GJMVv38npuaV+O/kYUylDW0QhM6/ItcdIwtvQ74ZS5j8Toqpr+dYc5Hr+5c4vQo33FStBX0C8lgCoISMEP6g==", + "version": "2.0.1-patch.1", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1-patch.1.tgz", + "integrity": "sha512-sVHDdVYLGcTGuvwugw72YoQJdqMO/3tobWYO2w/9iDE/dLK6S3lwEobHDyH19wM/YVM3aBkZAQde5MPdwDyvlQ==", "dependencies": { "@volar/language-core": "2.0.1", "path-browserify": "^1.0.1" @@ -5320,38 +5308,6 @@ "vitest": ">=0.28.5" } }, - "node_modules/vscode-jsonrpc": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", - "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/vscode-languageserver-protocol": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", - "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", - "dependencies": { - "vscode-jsonrpc": "8.2.0", - "vscode-languageserver-types": "3.17.5" - } - }, - "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", - "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" - }, - "node_modules/vscode-languageserver-types": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", - "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" - }, - "node_modules/vscode-uri": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", - "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" - }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", @@ -6126,17 +6082,6 @@ "@volar/source-map": "2.0.1" } }, - "@volar/language-service": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.0.1.tgz", - "integrity": "sha512-M8MyDXojSJ13KaSmFVSyRTC8rbyRgI/vAtuw8meTeU+mPsqg7z+QTSvbqx4VfLHrBvo1uzeT11PZt5QGTmL2Mg==", - "requires": { - "@volar/language-core": "2.0.1", - "vscode-languageserver-protocol": "^3.17.5", - "vscode-languageserver-textdocument": "^1.0.11", - "vscode-uri": "^3.0.8" - } - }, "@volar/source-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", @@ -6146,9 +6091,9 @@ } }, "@volar/typescript": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1.tgz", - "integrity": "sha512-k3GJMVv38npuaV+O/kYUylDW0QhM6/ItcdIwtvQ74ZS5j8Toqpr+dYc5Hr+5c4vQo33FStBX0C8lgCoISMEP6g==", + "version": "2.0.1-patch.1", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1-patch.1.tgz", + "integrity": "sha512-sVHDdVYLGcTGuvwugw72YoQJdqMO/3tobWYO2w/9iDE/dLK6S3lwEobHDyH19wM/YVM3aBkZAQde5MPdwDyvlQ==", "requires": { "@volar/language-core": "2.0.1", "path-browserify": "^1.0.1" @@ -9293,35 +9238,6 @@ "@actions/core": "^1.10.0" } }, - "vscode-jsonrpc": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", - "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==" - }, - "vscode-languageserver-protocol": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", - "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", - "requires": { - "vscode-jsonrpc": "8.2.0", - "vscode-languageserver-types": "3.17.5" - } - }, - "vscode-languageserver-textdocument": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", - "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" - }, - "vscode-languageserver-types": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", - "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" - }, - "vscode-uri": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", - "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" - }, "well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", diff --git a/package.json b/package.json index dbc401a..046215c 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,7 @@ ], "dependencies": { "@volar/language-core": "~2.0.1", - "@volar/language-service": "~2.0.1", - "@volar/typescript": "~2.0.1", + "@volar/typescript": "~2.0.1-patch.1", "change-case": "^4.1.2" }, "peerDependencies": { From d8f6367f567f2809331972b76482b756166a7b96 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 06:53:50 +0800 Subject: [PATCH 3/7] Pin typescript --- examples/nextjs/package-lock.json | 8 +++----- examples/nextjs/package.json | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/nextjs/package-lock.json b/examples/nextjs/package-lock.json index 5a847d3..26d9055 100644 --- a/examples/nextjs/package-lock.json +++ b/examples/nextjs/package-lock.json @@ -15,7 +15,7 @@ "next": "13.4.1", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "5.3.3" + "typescript": "^5.3.0" } }, "../..": { @@ -24,8 +24,7 @@ "license": "MIT", "dependencies": { "@volar/language-core": "~2.0.1", - "@volar/language-service": "~2.0.1", - "@volar/typescript": "~2.0.1", + "@volar/typescript": "~2.0.1-patch.1", "change-case": "^4.1.2" }, "devDependencies": { @@ -495,8 +494,7 @@ "@types/eslint": "^8.37.0", "@types/node": "^18.18.8", "@volar/language-core": "~2.0.1", - "@volar/language-service": "~2.0.1", - "@volar/typescript": "~2.0.1", + "@volar/typescript": "~2.0.1-patch.1", "change-case": "^4.1.2", "eslint": "^8.38.0", "minimatch": "^9.0.3", diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index 2834699..96519b7 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -18,6 +18,6 @@ "next": "13.4.1", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "5.3.3" + "typescript": "^5.3.0" } } From 123539cfc2a2d4e35b3ae6547b8843235b624380 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 07:01:38 +0800 Subject: [PATCH 4/7] Update language.ts --- src/language-service/language.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/language-service/language.ts b/src/language-service/language.ts index 535a3c5..855d362 100644 --- a/src/language-service/language.ts +++ b/src/language-service/language.ts @@ -1,12 +1,12 @@ import type { LanguagePlugin } from '@volar/language-core'; -import { getDtsContent } from '../dts'; -import { AssetPluginOptions } from '../option'; import path from 'node:path'; import type * as ts from 'typescript/lib/tsserverlibrary'; +import { getDtsContent } from '../dts'; +import { AssetPluginOptions } from '../option'; export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPluginOptions): LanguagePlugin { return { - createVirtualCode(fileId, languageId, snapshot) { + createVirtualCode(fileId) { const fileName = fileId.includes('://') ? fileId.split('://')[1]! : fileId; if (isMatchFile( fileName, @@ -31,9 +31,8 @@ export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPlu }, } } - return; }, - updateVirtualCode(fileId, virtualCode, newSnapshot) { + updateVirtualCode(_fileId, virtualCode) { return virtualCode; // asset file content update does not affect virtual code }, typescript: { From f28fdd253e6187c0da23020bd4c6fa750d29de2d Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 07:06:30 +0800 Subject: [PATCH 5/7] Update language.ts --- src/language-service/language.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/language-service/language.ts b/src/language-service/language.ts index 855d362..9f13ade 100644 --- a/src/language-service/language.ts +++ b/src/language-service/language.ts @@ -1,5 +1,5 @@ -import type { LanguagePlugin } from '@volar/language-core'; import path from 'node:path'; +import type { LanguagePlugin } from '@volar/language-core'; import type * as ts from 'typescript/lib/tsserverlibrary'; import { getDtsContent } from '../dts'; import { AssetPluginOptions } from '../option'; @@ -7,7 +7,7 @@ import { AssetPluginOptions } from '../option'; export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPluginOptions): LanguagePlugin { return { createVirtualCode(fileId) { - const fileName = fileId.includes('://') ? fileId.split('://')[1]! : fileId; + const fileName = fileId.includes('://') ? (fileId.split('://')[1] ?? '') : fileId; if (isMatchFile( fileName, assetPluginOptions.extensions, @@ -31,6 +31,7 @@ export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPlu }, } } + return undefined }, updateVirtualCode(_fileId, virtualCode) { return virtualCode; // asset file content update does not affect virtual code From 8a45fb395e180ee020f2dc1b3bef1a0593638728 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 5 Feb 2024 07:54:14 +0800 Subject: [PATCH 6/7] Format --- src/index.ts | 1 - src/language-service/language.ts | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index c267e6d..74dbc76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,6 @@ import { createAssetLanguage } from './language-service/language.js'; import { getAssetPluginOptions } from './option.js'; export = createLanguageServicePlugin((ts, info) => { - const assetPluginOptions = getAssetPluginOptions(info); if (!info.project.fileExists(assetPluginOptions.tsConfigPath)) { diff --git a/src/language-service/language.ts b/src/language-service/language.ts index 9f13ade..0f8a176 100644 --- a/src/language-service/language.ts +++ b/src/language-service/language.ts @@ -7,13 +7,10 @@ import { AssetPluginOptions } from '../option'; export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPluginOptions): LanguagePlugin { return { createVirtualCode(fileId) { - const fileName = fileId.includes('://') ? (fileId.split('://')[1] ?? '') : fileId; - if (isMatchFile( - fileName, - assetPluginOptions.extensions, - assetPluginOptions.exclude, - assetPluginOptions.include - )) { + const fileName = fileId.includes('://') ? fileId.split('://')[1] ?? '' : fileId; + if ( + isMatchFile(fileName, assetPluginOptions.extensions, assetPluginOptions.exclude, assetPluginOptions.include) + ) { const dtsContent = getDtsContent( fileName, assetPluginOptions.exportedNameCase, @@ -29,15 +26,19 @@ export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPlu getLength: () => dtsContent.length, getChangeRange: () => undefined, }, - } + }; } - return undefined + return undefined; }, updateVirtualCode(_fileId, virtualCode) { return virtualCode; // asset file content update does not affect virtual code }, typescript: { - extraFileExtensions: assetPluginOptions.extensions.map(ext => ({ extension: ext.slice(1), isMixedContent: true, scriptKind: 7 })), + extraFileExtensions: assetPluginOptions.extensions.map((ext) => ({ + extension: ext.slice(1), + isMixedContent: true, + scriptKind: 7, + })), getScript(virtualCode) { return { code: virtualCode, @@ -45,7 +46,7 @@ export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPlu scriptKind: 3, }; }, - } + }, }; function isMatchFile(fileName: string, extensions: string[], exclude: string[], include: string[]): boolean { From 21fcddcfd20a4923cc630100c13f2262b999c3f0 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Thu, 8 Feb 2024 04:30:29 +0800 Subject: [PATCH 7/7] chore: bump volar --- package-lock.json | 48 +++++++++++++++++++++++------------------------ package.json | 4 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index f4bc6e3..6afc2ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.1.1", "license": "MIT", "dependencies": { - "@volar/language-core": "~2.0.1", - "@volar/typescript": "~2.0.1-patch.1", + "@volar/language-core": "~2.0.2", + "@volar/typescript": "~2.0.2", "change-case": "^4.1.2" }, "devDependencies": { @@ -1075,27 +1075,27 @@ } }, "node_modules/@volar/language-core": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.1.tgz", - "integrity": "sha512-k979vTFcACHGAmiMVZJpHP0Er3ULVhR2bjGEy5CYKXKd4stx4VHT/sRWEsc5v/pBBrfTVm18wziSjWEQC4v+dw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.2.tgz", + "integrity": "sha512-sFtXrTDu59wNrUodrOzf62XpVpLAj47vT9P5dbcLxv3YfmbbW8Ssk9aLdqTksKDMhIe+hJVKrQm4UqBJ8iXaig==", "dependencies": { - "@volar/source-map": "2.0.1" + "@volar/source-map": "2.0.2" } }, "node_modules/@volar/source-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", - "integrity": "sha512-irMc9kI3xLlc50nwdz+o+rHAncPpDXL2pn21e1qMG3mijxuLAZYOFSx6B6f0VDnTKvExXJ8pN85NBxWm3ksPgQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.2.tgz", + "integrity": "sha512-jzEQwaAXIq7YJUCU6kvJ0aCfesu/cXT0YrSLxdGa+zxeMa8Q0DtWJE4RlIrvaEtowf9MpcNV7wBXKu4i3R9oTw==", "dependencies": { "muggle-string": "^0.4.0" } }, "node_modules/@volar/typescript": { - "version": "2.0.1-patch.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1-patch.1.tgz", - "integrity": "sha512-sVHDdVYLGcTGuvwugw72YoQJdqMO/3tobWYO2w/9iDE/dLK6S3lwEobHDyH19wM/YVM3aBkZAQde5MPdwDyvlQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.2.tgz", + "integrity": "sha512-lcCrYdg1ZgKZVm0mnk7pOxBGrojZk/YaeFJdxLH0gd/Kd13Go7uNvfotlYSGQshwHKcbJ0zaqY0et9w9oW1yyA==", "dependencies": { - "@volar/language-core": "2.0.1", + "@volar/language-core": "2.0.2", "path-browserify": "^1.0.1" } }, @@ -6075,27 +6075,27 @@ } }, "@volar/language-core": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.1.tgz", - "integrity": "sha512-k979vTFcACHGAmiMVZJpHP0Er3ULVhR2bjGEy5CYKXKd4stx4VHT/sRWEsc5v/pBBrfTVm18wziSjWEQC4v+dw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.0.2.tgz", + "integrity": "sha512-sFtXrTDu59wNrUodrOzf62XpVpLAj47vT9P5dbcLxv3YfmbbW8Ssk9aLdqTksKDMhIe+hJVKrQm4UqBJ8iXaig==", "requires": { - "@volar/source-map": "2.0.1" + "@volar/source-map": "2.0.2" } }, "@volar/source-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.1.tgz", - "integrity": "sha512-irMc9kI3xLlc50nwdz+o+rHAncPpDXL2pn21e1qMG3mijxuLAZYOFSx6B6f0VDnTKvExXJ8pN85NBxWm3ksPgQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.0.2.tgz", + "integrity": "sha512-jzEQwaAXIq7YJUCU6kvJ0aCfesu/cXT0YrSLxdGa+zxeMa8Q0DtWJE4RlIrvaEtowf9MpcNV7wBXKu4i3R9oTw==", "requires": { "muggle-string": "^0.4.0" } }, "@volar/typescript": { - "version": "2.0.1-patch.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.1-patch.1.tgz", - "integrity": "sha512-sVHDdVYLGcTGuvwugw72YoQJdqMO/3tobWYO2w/9iDE/dLK6S3lwEobHDyH19wM/YVM3aBkZAQde5MPdwDyvlQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.0.2.tgz", + "integrity": "sha512-lcCrYdg1ZgKZVm0mnk7pOxBGrojZk/YaeFJdxLH0gd/Kd13Go7uNvfotlYSGQshwHKcbJ0zaqY0et9w9oW1yyA==", "requires": { - "@volar/language-core": "2.0.1", + "@volar/language-core": "2.0.2", "path-browserify": "^1.0.1" } }, diff --git a/package.json b/package.json index 046215c..f68bd2f 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "dist" ], "dependencies": { - "@volar/language-core": "~2.0.1", - "@volar/typescript": "~2.0.1-patch.1", + "@volar/language-core": "~2.0.2", + "@volar/typescript": "~2.0.2", "change-case": "^4.1.2" }, "peerDependencies": {