From 474f1bd8272487a3704004eee9b7db0ea100a11a Mon Sep 17 00:00:00 2001 From: chemzqm Date: Thu, 27 Sep 2018 19:30:26 +0800 Subject: [PATCH] fix locate of bundled typescript module --- package.json | 4 +-- src/server/utils/versionProvider.ts | 20 +++++------ yarn.lock | 54 ++++++++++++++--------------- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index caa7488..b90f29a 100644 --- a/package.json +++ b/package.json @@ -380,10 +380,10 @@ "@types/node": "^10.9.4", "coc.nvim": "^0.0.15", "rimraf": "^2.6.2", - "tslint": "^5.11.0", - "typescript": "^3.0.3" + "tslint": "^5.11.0" }, "dependencies": { + "typescript": "^3.0.3", "semver": "^5.5.1", "tslib": "^1.9.3", "vscode-languageserver-protocol": "^3.12.0", diff --git a/src/server/utils/versionProvider.ts b/src/server/utils/versionProvider.ts index 66911fd..a24ca08 100644 --- a/src/server/utils/versionProvider.ts +++ b/src/server/utils/versionProvider.ts @@ -121,17 +121,15 @@ export class TypeScriptVersionProvider { } public get bundledVersion(): TypeScriptVersion | null { - let file = path.join(workspace.pluginRoot, 'node_modules/typescript/lib/tsserver.js') - if (!fs.existsSync(file)) return null - try { - const bundledVersion = new TypeScriptVersion( - path.dirname(file), - '' - ) - return bundledVersion - } catch (e) { - // noop + const file = require.resolve('typescript') + if (!file || !fs.existsSync(file)) { + workspace.showMessage('Bundled typescript module not found', 'error') + return null } - return null + const bundledVersion = new TypeScriptVersion( + path.dirname(file), + '' + ) + return bundledVersion } } diff --git a/yarn.lock b/yarn.lock index c3c55c8..632602c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -98,8 +98,8 @@ tslint-react "^3.2.0" "@types/node@^10.9.4": - version "10.9.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.4.tgz#0f4cb2dc7c1de6096055357f70179043c33e9897" + version "10.11.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.11.0.tgz#ddd0d67a3b6c3810dd1a59e36675fa82de5e19ae" ansi-regex@^2.0.0: version "2.1.1" @@ -184,8 +184,8 @@ chalk@^2.0.0, chalk@^2.3.0: supports-color "^5.3.0" circular-json@^0.5.5: - version "0.5.5" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.5.tgz#64182ef359042d37cd8e767fc9de878b1e9447d3" + version "0.5.7" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.7.tgz#b8be478d72ea58c7eeda26bf1cf1fba43d188842" coc.nvim@^0.0.15: version "0.0.15" @@ -224,8 +224,8 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" commander@^2.12.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + version "2.18.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.18.0.tgz#2bf063ddee7c7891176981a2cc798e5754bc6970" concat-map@0.0.1: version "0.0.1" @@ -244,10 +244,10 @@ debounce@^1.2.0: resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131" debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + version "3.2.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.5.tgz#c2418fbfd7a29f4d4f70ff4cea604d4b64c46407" dependencies: - ms "2.0.0" + ms "^2.1.1" deep-equal@^1.0.1: version "1.0.1" @@ -291,8 +291,8 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" event-lite@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/event-lite/-/event-lite-0.1.1.tgz#47cf08a8d37d0b694cdb7b3b17b51faac6576086" + version "0.1.2" + resolved "https://registry.yarnpkg.com/event-lite/-/event-lite-0.1.2.tgz#838a3e0fdddef8cc90f128006c8e55a4e4e4c11b" fast-diff@^1.1.2: version "1.1.2" @@ -394,8 +394,8 @@ jsonc-parser@^2.0.2: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.0.2.tgz#42fcf56d70852a043fadafde51ddb4a85649978d" lodash@^4.2.0: - version "4.17.10" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" log4js@^3.0.5: version "3.0.5" @@ -429,9 +429,9 @@ mkdirp@^0.5.1: dependencies: minimist "0.0.8" -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" msgpack-lite@^0.1.26: version "0.1.26" @@ -480,7 +480,7 @@ process-nextick-args@~2.0.0: readable-stream@^2.3.0: version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -614,20 +614,20 @@ uuid@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" -vscode-jsonrpc@^3.6.2: - version "3.6.2" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8" +vscode-jsonrpc@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" vscode-languageserver-protocol@^3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.12.0.tgz#5b23501292abad88f0463b01e83ff98e64a37652" + version "3.13.0" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.13.0.tgz#710d8e42119bb3affb1416e1e104bd6b4d503595" dependencies: - vscode-jsonrpc "^3.6.2" - vscode-languageserver-types "^3.12.0" + vscode-jsonrpc "^4.0.0" + vscode-languageserver-types "3.13.0" -vscode-languageserver-types@^3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.12.0.tgz#f96051381b6a050b7175b37d6cb5d2f2eb64b944" +vscode-languageserver-types@3.13.0, vscode-languageserver-types@^3.12.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.13.0.tgz#b704b024cef059f7b326611c99b9c8753c0a18b4" vscode-uri@^1.0.6: version "1.0.6"