typescript-language-server 0.6.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/README.md +105 -32
- package/lib/cli.js +5 -11
- package/lib/cli.js.map +1 -1
- package/lib/commands.d.ts +4 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/completion.d.ts +4 -1
- package/lib/completion.d.ts.map +1 -1
- package/lib/completion.js +192 -34
- package/lib/completion.js.map +1 -1
- package/lib/diagnostic-queue.d.ts +3 -0
- package/lib/diagnostic-queue.d.ts.map +1 -1
- package/lib/diagnostic-queue.js +14 -3
- package/lib/diagnostic-queue.js.map +1 -1
- package/lib/file-lsp-server.spec.js +22 -0
- package/lib/file-lsp-server.spec.js.map +1 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +1 -0
- package/lib/logger.js.map +1 -1
- package/lib/lsp-connection.d.ts.map +1 -1
- package/lib/lsp-connection.js +2 -0
- package/lib/lsp-connection.js.map +1 -1
- package/lib/lsp-server.d.ts +7 -12
- package/lib/lsp-server.d.ts.map +1 -1
- package/lib/lsp-server.js +192 -56
- package/lib/lsp-server.js.map +1 -1
- package/lib/lsp-server.spec.js +213 -10
- package/lib/lsp-server.spec.js.map +1 -1
- package/lib/organize-imports.d.ts +2 -1
- package/lib/organize-imports.d.ts.map +1 -1
- package/lib/organize-imports.js +7 -5
- package/lib/organize-imports.js.map +1 -1
- package/lib/organize-imports.spec.js +14 -7
- package/lib/organize-imports.spec.js.map +1 -1
- package/lib/protocol-translation.d.ts +7 -3
- package/lib/protocol-translation.d.ts.map +1 -1
- package/lib/protocol-translation.js +26 -18
- package/lib/protocol-translation.js.map +1 -1
- package/lib/semantic-tokens.d.ts +9 -0
- package/lib/semantic-tokens.d.ts.map +1 -0
- package/lib/semantic-tokens.js +47 -0
- package/lib/semantic-tokens.js.map +1 -0
- package/lib/test-utils.d.ts.map +1 -1
- package/lib/test-utils.js +5 -3
- package/lib/test-utils.js.map +1 -1
- package/lib/ts-protocol.d.ts +19 -0
- package/lib/ts-protocol.d.ts.map +1 -1
- package/lib/ts-protocol.js +10 -1
- package/lib/ts-protocol.js.map +1 -1
- package/lib/tsp-client.d.ts +7 -1
- package/lib/tsp-client.d.ts.map +1 -1
- package/lib/tsp-client.js +30 -14
- package/lib/tsp-client.js.map +1 -1
- package/lib/tsp-client.spec.js +74 -82
- package/lib/tsp-client.spec.js.map +1 -1
- package/lib/tsp-command-types.d.ts +14 -1
- package/lib/tsp-command-types.d.ts.map +1 -1
- package/lib/tsp-command-types.js +21 -1
- package/lib/tsp-command-types.js.map +1 -1
- package/lib/utils/SnippetString.d.ts +12 -0
- package/lib/utils/SnippetString.d.ts.map +1 -0
- package/lib/utils/SnippetString.js +69 -0
- package/lib/utils/SnippetString.js.map +1 -0
- package/lib/utils/api.d.ts +45 -0
- package/lib/utils/api.d.ts.map +1 -0
- package/lib/utils/api.js +95 -0
- package/lib/utils/api.js.map +1 -0
- package/lib/utils/configuration.d.ts +10 -0
- package/lib/utils/configuration.d.ts.map +1 -0
- package/lib/utils/configuration.js +3 -0
- package/lib/utils/configuration.js.map +1 -0
- package/lib/utils/typeConverters.d.ts +11 -0
- package/lib/utils/typeConverters.d.ts.map +1 -0
- package/lib/utils/typeConverters.js +22 -0
- package/lib/utils/typeConverters.js.map +1 -0
- package/lib/utils/versionProvider.d.ts +29 -0
- package/lib/utils/versionProvider.d.ts.map +1 -0
- package/lib/utils/versionProvider.js +148 -0
- package/lib/utils/versionProvider.js.map +1 -0
- package/lib/utils.d.ts +0 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -8
- package/lib/utils.js.map +1 -1
- package/package.json +34 -20
- package/lib/modules-resolver.d.ts +0 -3
- package/lib/modules-resolver.d.ts.map +0 -1
- package/lib/modules-resolver.js +0 -54
- package/lib/modules-resolver.js.map +0 -1
- package/lib/modules-resolver.spec.d.ts +0 -2
- package/lib/modules-resolver.spec.d.ts.map +0 -1
- package/lib/modules-resolver.spec.js +0 -37
- package/lib/modules-resolver.spec.js.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TypeScriptVersionProvider = exports.TypeScriptVersion = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const fs_1 = __importDefault(require("fs"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const which_1 = __importDefault(require("which"));
|
|
14
|
+
const pkg_up_1 = __importDefault(require("pkg-up"));
|
|
15
|
+
const api_1 = __importDefault(require("./api"));
|
|
16
|
+
class TypeScriptVersion {
|
|
17
|
+
constructor(source, path, _pathLabel) {
|
|
18
|
+
this.source = source;
|
|
19
|
+
this.path = path;
|
|
20
|
+
this._pathLabel = _pathLabel;
|
|
21
|
+
this._api = null;
|
|
22
|
+
}
|
|
23
|
+
get tscPath() {
|
|
24
|
+
return path_1.default.resolve(this.path, '../bin/tsc');
|
|
25
|
+
}
|
|
26
|
+
get tsServerPath() {
|
|
27
|
+
return path_1.default.resolve(this.path, 'tsserver.js');
|
|
28
|
+
}
|
|
29
|
+
get pathLabel() {
|
|
30
|
+
return typeof this._pathLabel === 'undefined' ? this.path : this._pathLabel;
|
|
31
|
+
}
|
|
32
|
+
get isValid() {
|
|
33
|
+
return this.version !== null;
|
|
34
|
+
}
|
|
35
|
+
get version() {
|
|
36
|
+
if (this._api) {
|
|
37
|
+
return this._api;
|
|
38
|
+
}
|
|
39
|
+
this._api = this.getTypeScriptVersion(this.tsServerPath);
|
|
40
|
+
return this._api;
|
|
41
|
+
}
|
|
42
|
+
get versionString() {
|
|
43
|
+
const version = this.version;
|
|
44
|
+
return version ? version.displayName : null;
|
|
45
|
+
}
|
|
46
|
+
getTypeScriptVersion(serverPath) {
|
|
47
|
+
if (!fs_1.default.existsSync(serverPath)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const p = serverPath.split(path_1.default.sep);
|
|
51
|
+
if (p.length <= 2) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const p2 = p.slice(0, -2);
|
|
55
|
+
const modulePath = p2.join(path_1.default.sep);
|
|
56
|
+
let fileName = path_1.default.join(modulePath, 'package.json');
|
|
57
|
+
if (!fs_1.default.existsSync(fileName)) {
|
|
58
|
+
// Special case for ts dev versions
|
|
59
|
+
if (path_1.default.basename(modulePath) === 'built') {
|
|
60
|
+
fileName = path_1.default.join(modulePath, '..', 'package.json');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!fs_1.default.existsSync(fileName)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const contents = fs_1.default.readFileSync(fileName).toString();
|
|
67
|
+
let desc = null;
|
|
68
|
+
try {
|
|
69
|
+
desc = JSON.parse(contents);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
if (!desc || !desc.version) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return desc.version ? api_1.default.fromVersionString(desc.version) : null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.TypeScriptVersion = TypeScriptVersion;
|
|
81
|
+
const MODULE_FOLDERS = ['node_modules/typescript/lib', '.vscode/pnpify/typescript/lib', '.yarn/sdks/typescript/lib'];
|
|
82
|
+
class TypeScriptVersionProvider {
|
|
83
|
+
constructor(configuration) {
|
|
84
|
+
this.configuration = configuration;
|
|
85
|
+
}
|
|
86
|
+
getUserSettingVersion() {
|
|
87
|
+
const { tsserverPath } = this.configuration || {};
|
|
88
|
+
if (!tsserverPath) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
let resolvedPath = tsserverPath;
|
|
92
|
+
// Resolve full path to the binary if path is not absolute.
|
|
93
|
+
if (!path_1.default.isAbsolute(resolvedPath)) {
|
|
94
|
+
const binaryPath = which_1.default.sync(tsserverPath, { nothrow: true });
|
|
95
|
+
if (binaryPath) {
|
|
96
|
+
resolvedPath = binaryPath;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Resolve symbolic link.
|
|
100
|
+
let stat = fs_1.default.lstatSync(resolvedPath, { throwIfNoEntry: false });
|
|
101
|
+
if (stat === null || stat === void 0 ? void 0 : stat.isSymbolicLink()) {
|
|
102
|
+
resolvedPath = fs_1.default.realpathSync(resolvedPath);
|
|
103
|
+
}
|
|
104
|
+
// Get directory path
|
|
105
|
+
stat = fs_1.default.lstatSync(resolvedPath, { throwIfNoEntry: false });
|
|
106
|
+
if (stat === null || stat === void 0 ? void 0 : stat.isFile()) {
|
|
107
|
+
resolvedPath = path_1.default.dirname(resolvedPath);
|
|
108
|
+
}
|
|
109
|
+
// Resolve path to the "lib" dir.
|
|
110
|
+
try {
|
|
111
|
+
const packageJsonPath = pkg_up_1.default.sync({ cwd: resolvedPath });
|
|
112
|
+
if (packageJsonPath) {
|
|
113
|
+
resolvedPath = path_1.default.join(path_1.default.dirname(packageJsonPath), 'lib');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (_a) {
|
|
117
|
+
// ignore
|
|
118
|
+
}
|
|
119
|
+
return new TypeScriptVersion("user-setting" /* UserSetting */, resolvedPath);
|
|
120
|
+
}
|
|
121
|
+
getWorkspaceVersion(workspaceFolders) {
|
|
122
|
+
for (const p of workspaceFolders) {
|
|
123
|
+
for (const folder of MODULE_FOLDERS) {
|
|
124
|
+
const libFolder = path_1.default.join(p, folder);
|
|
125
|
+
if (fs_1.default.existsSync(libFolder)) {
|
|
126
|
+
const version = new TypeScriptVersion("workspace" /* Workspace */, libFolder);
|
|
127
|
+
if (version.isValid) {
|
|
128
|
+
return version;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
bundledVersion() {
|
|
136
|
+
try {
|
|
137
|
+
const file = require.resolve('typescript');
|
|
138
|
+
const bundledVersion = new TypeScriptVersion("bundled" /* Bundled */, path_1.default.dirname(file), '');
|
|
139
|
+
return bundledVersion;
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
// window.showMessage('Bundled typescript module not found', 'error');
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.TypeScriptVersionProvider = TypeScriptVersionProvider;
|
|
148
|
+
//# sourceMappingURL=versionProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionProvider.js","sourceRoot":"","sources":["../../src/utils/versionProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;gGAGgG;AAChG,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,oDAA2B;AAC3B,gDAAwB;AASxB,MAAa,iBAAiB;IAE1B,YACoB,MAA+B,EAC/B,IAAY,EACX,UAAmB;QAFpB,WAAM,GAAN,MAAM,CAAyB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QACX,eAAU,GAAV,UAAU,CAAS;QAEpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,OAAO;QACd,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAED,IAAW,YAAY;QACnB,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC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AAG,IAAI,iBAAiB,8BAAoC,SAAS,CAAC,CAAC;oBACpF,IAAI,OAAO,CAAC,OAAO,EAAE;wBACjB,OAAO,OAAO,CAAC;qBAClB;iBACJ;aACJ;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,cAAc;QACjB,IAAI;YACA,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC3C,MAAM,cAAc,GAAG,IAAI,iBAAiB,0BAExC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAClB,EAAE,CAAC,CAAC;YACR,OAAO,cAAc,CAAC;SACzB;QAAC,OAAO,CAAC,EAAE;YACR,sEAAsE;YACtE,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ;AArED,8DAqEC"}
|
package/lib/utils.d.ts
CHANGED
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,qBAAa,QAAQ,CAAC,CAAC;IACnB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAEhC,OAAO,aAGJ;CACN
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,qBAAa,QAAQ,CAAC,CAAC;IACnB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAEhC,OAAO,aAGJ;CACN"}
|
package/lib/utils.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.Deferred = void 0;
|
|
10
10
|
class Deferred {
|
|
11
11
|
constructor() {
|
|
12
12
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -16,11 +16,4 @@ class Deferred {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.Deferred = Deferred;
|
|
19
|
-
function getTsserverExecutable() {
|
|
20
|
-
return isWindows() ? 'tsserver.cmd' : 'tsserver';
|
|
21
|
-
}
|
|
22
|
-
exports.getTsserverExecutable = getTsserverExecutable;
|
|
23
|
-
function isWindows() {
|
|
24
|
-
return /^win/.test(process.platform);
|
|
25
|
-
}
|
|
26
19
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAa,QAAQ;IAArB;QAII,YAAO,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AARD,4BAQC
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAa,QAAQ;IAArB;QAII,YAAO,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AARD,4BAQC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-language-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Language Server Protocol (LSP) implementation for TypeScript using tsserver",
|
|
5
5
|
"author": "TypeFox and others",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=12"
|
|
9
|
+
},
|
|
7
10
|
"eslintIgnore": [
|
|
8
11
|
"!.eslintrc.js"
|
|
9
12
|
],
|
|
@@ -17,39 +20,50 @@
|
|
|
17
20
|
"bin": {
|
|
18
21
|
"typescript-language-server": "./lib/cli.js"
|
|
19
22
|
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "rimraf lib *.tsbuildinfo",
|
|
25
|
+
"test": "mocha --exit --reporter spec \"./lib/**/*.spec.js\"",
|
|
26
|
+
"lint": "eslint --ext \".js,.ts\" src",
|
|
27
|
+
"build": "concurrently -n compile,lint -c blue,green \"yarn compile\" \"yarn lint\"",
|
|
28
|
+
"compile": "tsc -b",
|
|
29
|
+
"watch": "tsc -b --watch --verbose",
|
|
30
|
+
"postversion": "git push --follow-tags"
|
|
31
|
+
},
|
|
32
|
+
"husky": {
|
|
33
|
+
"hooks": {
|
|
34
|
+
"pre-commit": "yarn lint && yarn build && yarn test",
|
|
35
|
+
"post-merge": "yarn"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
20
38
|
"dependencies": {
|
|
21
|
-
"
|
|
22
|
-
"commander": "^7.2.0",
|
|
39
|
+
"commander": "^8.3.0",
|
|
23
40
|
"fs-extra": "^10.0.0",
|
|
24
41
|
"p-debounce": "^2.1.0",
|
|
42
|
+
"pkg-up": "^3.1.0",
|
|
43
|
+
"semver": "^7.3.5",
|
|
25
44
|
"tempy": "^1.0.1",
|
|
26
45
|
"vscode-languageserver": "^7.0.0",
|
|
27
46
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
28
47
|
"vscode-languageserver-textdocument": "^1.0.1",
|
|
29
|
-
"vscode-uri": "^
|
|
30
|
-
|
|
31
|
-
"scripts": {
|
|
32
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
33
|
-
"test": "mocha --exit --reporter spec \"./lib/**/*.spec.js\"",
|
|
34
|
-
"lint": "eslint --ext \".js,.ts\" src",
|
|
35
|
-
"build": "concurrently -n compile,lint -c blue,green \"yarn compile\" \"yarn lint\"",
|
|
36
|
-
"compile": "tsc -b",
|
|
37
|
-
"watch": "tsc -b --watch --verbose"
|
|
48
|
+
"vscode-uri": "^3.0.2",
|
|
49
|
+
"which": "^2.0.2"
|
|
38
50
|
},
|
|
39
51
|
"devDependencies": {
|
|
40
|
-
"@types/fs-extra": "^9.0.11",
|
|
41
52
|
"@types/chai": "^4.2.19",
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
53
|
+
"@types/fs-extra": "^9.0.11",
|
|
54
|
+
"@types/mocha": "^9.0.0",
|
|
55
|
+
"@types/node": "^16.11.6",
|
|
56
|
+
"@types/which": "^2.0.1",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
58
|
+
"@typescript-eslint/parser": "^5.3.1",
|
|
46
59
|
"chai": "^4.3.4",
|
|
47
|
-
"concurrently": "^6.
|
|
48
|
-
"eslint": "^
|
|
60
|
+
"concurrently": "^6.4.0",
|
|
61
|
+
"eslint": "^8.2.0",
|
|
62
|
+
"husky": "4.x.x",
|
|
49
63
|
"mocha": "^9.0.1",
|
|
50
64
|
"rimraf": "^3.0.2",
|
|
51
65
|
"source-map-support": "^0.5.19",
|
|
52
|
-
"ts-node": "
|
|
66
|
+
"ts-node": "^10.4.0",
|
|
53
67
|
"typescript": "^4.4.3"
|
|
54
68
|
}
|
|
55
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules-resolver.d.ts","sourceRoot":"","sources":["../src/modules-resolver.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAC,SAAS,CAMlF;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYrF"}
|
package/lib/modules-resolver.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.findPathToYarnSdk = exports.findPathToModule = void 0;
|
|
23
|
-
/*
|
|
24
|
-
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
25
|
-
*
|
|
26
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
27
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
-
*/
|
|
29
|
-
const fs = __importStar(require("fs"));
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
function findPathToModule(dir, moduleName) {
|
|
32
|
-
try {
|
|
33
|
-
return require.resolve(moduleName, { paths: [dir] });
|
|
34
|
-
}
|
|
35
|
-
catch (_a) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.findPathToModule = findPathToModule;
|
|
40
|
-
function findPathToYarnSdk(dir, moduleName) {
|
|
41
|
-
const stat = fs.statSync(dir);
|
|
42
|
-
if (stat.isDirectory()) {
|
|
43
|
-
const candidate = path.resolve(dir, '.yarn', 'sdks', moduleName);
|
|
44
|
-
if (fs.existsSync(candidate)) {
|
|
45
|
-
return candidate;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const parent = path.resolve(dir, '..');
|
|
49
|
-
if (parent !== dir) {
|
|
50
|
-
return findPathToYarnSdk(parent, moduleName);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.findPathToYarnSdk = findPathToYarnSdk;
|
|
54
|
-
//# sourceMappingURL=modules-resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules-resolver.js","sourceRoot":"","sources":["../src/modules-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,uCAAyB;AACzB,2CAA6B;AAE7B,SAAgB,gBAAgB,CAAC,GAAW,EAAE,UAAkB;IAC5D,IAAI;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACxD;IAAC,WAAM;QACJ,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAND,4CAMC;AAED,SAAgB,iBAAiB,CAAC,GAAW,EAAE,UAAkB;IAC7D,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACjE,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC1B,OAAO,SAAS,CAAC;SACpB;KACJ;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,MAAM,KAAK,GAAG,EAAE;QAChB,OAAO,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;KAChD;AACL,CAAC;AAZD,8CAYC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules-resolver.spec.d.ts","sourceRoot":"","sources":["../src/modules-resolver.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
11
|
-
}) : (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
}));
|
|
15
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
-
}) : function(o, v) {
|
|
18
|
-
o["default"] = v;
|
|
19
|
-
});
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
-
if (mod && mod.__esModule) return mod;
|
|
22
|
-
var result = {};
|
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
-
__setModuleDefault(result, mod);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
const chai = __importStar(require("chai"));
|
|
29
|
-
const path = __importStar(require("path"));
|
|
30
|
-
const modules_resolver_1 = require("./modules-resolver");
|
|
31
|
-
describe('findPathToModule', () => {
|
|
32
|
-
it('resolves the local tsserver', () => {
|
|
33
|
-
const tsserverPath = (0, modules_resolver_1.findPathToModule)(__dirname, 'typescript/bin/tsserver');
|
|
34
|
-
chai.assert.equal(path.resolve(__dirname, '../node_modules/typescript/bin/tsserver'), tsserverPath);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=modules-resolver.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules-resolver.spec.js","sourceRoot":"","sources":["../src/modules-resolver.spec.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2CAA6B;AAC7B,yDAAsD;AAEtD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,MAAM,YAAY,GAAG,IAAA,mCAAgB,EAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;QAC5E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,yCAAyC,CAAC,EAAE,YAAY,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|