@volar/typescript 2.0.4 → 2.1.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.
|
@@ -33,22 +33,22 @@ function decorateLanguageServiceHost(virtualFiles, languageServiceHost, ts) {
|
|
|
33
33
|
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, languageServiceHost, languagePlugins, fileName => virtualFiles.get(fileName));
|
|
34
34
|
if (resolveModuleNameLiterals) {
|
|
35
35
|
languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, ...rest) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
if (moduleLiterals.every(name => !exts.some(ext => name.text.endsWith(ext)))) {
|
|
37
|
+
return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, ...rest);
|
|
38
|
+
}
|
|
39
|
+
return moduleLiterals.map(moduleLiteral => {
|
|
40
|
+
return resolveModuleName(moduleLiteral.text, containingFile, options, undefined, redirectedReference);
|
|
41
|
+
});
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
if (resolveModuleNames) {
|
|
45
45
|
languageServiceHost.resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
if (moduleNames.every(name => !exts.some(ext => name.endsWith(ext)))) {
|
|
47
|
+
return resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile);
|
|
48
|
+
}
|
|
49
|
+
return moduleNames.map(moduleName => {
|
|
50
|
+
return resolveModuleName(moduleName, containingFile, options, undefined, redirectedReference).resolvedModule;
|
|
51
|
+
});
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ServiceEnvironment, Disposable
|
|
1
|
+
import type { ServiceEnvironment, Disposable } from '@volar/language-service';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
|
-
export declare function createSys(ts: typeof import('typescript'), env: ServiceEnvironment,
|
|
3
|
+
export declare function createSys(ts: typeof import('typescript'), env: ServiceEnvironment, currentDirectory: string): ts.System & {
|
|
4
4
|
version: number;
|
|
5
5
|
sync(): Promise<number>;
|
|
6
6
|
} & Disposable;
|
|
@@ -4,9 +4,8 @@ exports.createSys = void 0;
|
|
|
4
4
|
const path = require("path-browserify");
|
|
5
5
|
const utilities_1 = require("../typescript/utilities");
|
|
6
6
|
let currentCwd = '';
|
|
7
|
-
function createSys(ts, env,
|
|
7
|
+
function createSys(ts, env, currentDirectory) {
|
|
8
8
|
let version = 0;
|
|
9
|
-
const rootPath = projectHost.getCurrentDirectory();
|
|
10
9
|
const sys = ts.sys;
|
|
11
10
|
const root = {
|
|
12
11
|
dirs: new Map(),
|
|
@@ -56,8 +55,8 @@ function createSys(ts, env, projectHost) {
|
|
|
56
55
|
writeFile: sys?.writeFile ?? (() => { }),
|
|
57
56
|
createDirectory: sys?.createDirectory ?? (() => { }),
|
|
58
57
|
exit: sys?.exit ?? (() => { }),
|
|
59
|
-
getExecutingFilePath: sys?.getExecutingFilePath ?? (() =>
|
|
60
|
-
getCurrentDirectory: () =>
|
|
58
|
+
getExecutingFilePath: sys?.getExecutingFilePath ?? (() => currentDirectory + '/__fake__.js'),
|
|
59
|
+
getCurrentDirectory: () => currentDirectory,
|
|
61
60
|
getModifiedTime,
|
|
62
61
|
readFile,
|
|
63
62
|
readDirectory,
|
|
@@ -77,15 +76,15 @@ function createSys(ts, env, projectHost) {
|
|
|
77
76
|
};
|
|
78
77
|
function resolvePath(fsPath) {
|
|
79
78
|
if (sys) {
|
|
80
|
-
if (currentCwd !==
|
|
81
|
-
currentCwd =
|
|
79
|
+
if (currentCwd !== currentDirectory) {
|
|
80
|
+
currentCwd = currentDirectory;
|
|
82
81
|
// https://github.com/vuejs/language-tools/issues/2039
|
|
83
82
|
// https://github.com/vuejs/language-tools/issues/2234
|
|
84
|
-
if (sys.directoryExists(
|
|
83
|
+
if (sys.directoryExists(currentDirectory)) {
|
|
85
84
|
// https://github.com/vuejs/language-tools/issues/2480
|
|
86
85
|
try {
|
|
87
86
|
// @ts-ignore
|
|
88
|
-
process.chdir(
|
|
87
|
+
process.chdir(currentDirectory);
|
|
89
88
|
}
|
|
90
89
|
catch { }
|
|
91
90
|
}
|
|
@@ -184,7 +183,7 @@ function createSys(ts, env, projectHost) {
|
|
|
184
183
|
}
|
|
185
184
|
function readDirectory(dirName, extensions, excludes, includes, depth) {
|
|
186
185
|
dirName = resolvePath(dirName);
|
|
187
|
-
const matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false,
|
|
186
|
+
const matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, currentDirectory, depth, dirPath => {
|
|
188
187
|
dirPath = resolvePath(dirPath);
|
|
189
188
|
readDirectoryWorker(dirPath);
|
|
190
189
|
const dir = getDir(dirPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/typescript",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"directory": "packages/typescript"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.0
|
|
15
|
+
"@volar/language-core": "2.1.0",
|
|
16
16
|
"path-browserify": "^1.0.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "latest",
|
|
20
20
|
"@types/path-browserify": "latest",
|
|
21
|
-
"@volar/language-service": "2.0
|
|
21
|
+
"@volar/language-service": "2.1.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "09e1792f0adafb02caf89a5a45a6fcaaf3177808"
|
|
24
24
|
}
|