@volar/typescript
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -36,8 +36,8 @@ "use strict"; | ||
languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, ...rest) => { | ||
return [ | ||
...resolveModuleNameLiterals(moduleLiterals.filter(name => !exts.some(ext => name.text.endsWith(ext))), containingFile, redirectedReference, options, ...rest), | ||
...moduleLiterals | ||
.filter(name => exts.some(ext => name.text.endsWith(ext))) | ||
.map(name => resolveModuleName(name.text, containingFile, options, undefined, redirectedReference)), | ||
]; | ||
if (moduleLiterals.every(name => !exts.some(ext => name.text.endsWith(ext)))) { | ||
return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, ...rest); | ||
} | ||
return moduleLiterals.map(moduleLiteral => { | ||
return resolveModuleName(moduleLiteral.text, containingFile, options, undefined, redirectedReference); | ||
}); | ||
}; | ||
@@ -47,8 +47,8 @@ } | ||
languageServiceHost.resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile) => { | ||
return [ | ||
...resolveModuleNames(moduleNames.filter(name => !exts.some(ext => name.endsWith(ext))), containingFile, reusedNames, redirectedReference, options, containingSourceFile), | ||
...moduleNames | ||
.filter(name => exts.some(ext => name.endsWith(ext))) | ||
.map(moduleName => resolveModuleName(moduleName, containingFile, options, undefined, redirectedReference).resolvedModule), | ||
]; | ||
if (moduleNames.every(name => !exts.some(ext => name.endsWith(ext)))) { | ||
return resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile); | ||
} | ||
return moduleNames.map(moduleName => { | ||
return resolveModuleName(moduleName, containingFile, options, undefined, redirectedReference).resolvedModule; | ||
}); | ||
}; | ||
@@ -55,0 +55,0 @@ } |
@@ -1,6 +0,6 @@ | ||
import type { ServiceEnvironment, Disposable, TypeScriptProjectHost } from '@volar/language-service'; | ||
import type { ServiceEnvironment, Disposable } from '@volar/language-service'; | ||
import type * as ts from 'typescript'; | ||
export declare function createSys(ts: typeof import('typescript'), env: ServiceEnvironment, projectHost: TypeScriptProjectHost): ts.System & { | ||
export declare function createSys(ts: typeof import('typescript'), env: ServiceEnvironment, currentDirectory: string): ts.System & { | ||
version: number; | ||
sync(): Promise<number>; | ||
} & Disposable; |
@@ -7,5 +7,4 @@ "use strict"; | ||
let currentCwd = ''; | ||
function createSys(ts, env, projectHost) { | ||
function createSys(ts, env, currentDirectory) { | ||
let version = 0; | ||
const rootPath = projectHost.getCurrentDirectory(); | ||
const sys = ts.sys; | ||
@@ -60,4 +59,4 @@ const root = { | ||
exit: sys?.exit ?? (() => { }), | ||
getExecutingFilePath: sys?.getExecutingFilePath ?? (() => rootPath + '/__fake__.js'), | ||
getCurrentDirectory: () => rootPath, | ||
getExecutingFilePath: sys?.getExecutingFilePath ?? (() => currentDirectory + '/__fake__.js'), | ||
getCurrentDirectory: () => currentDirectory, | ||
getModifiedTime, | ||
@@ -82,11 +81,11 @@ readFile, | ||
if (sys) { | ||
if (currentCwd !== rootPath) { | ||
currentCwd = rootPath; | ||
if (currentCwd !== currentDirectory) { | ||
currentCwd = currentDirectory; | ||
// https://github.com/vuejs/language-tools/issues/2039 | ||
// https://github.com/vuejs/language-tools/issues/2234 | ||
if (sys.directoryExists(rootPath)) { | ||
if (sys.directoryExists(currentDirectory)) { | ||
// https://github.com/vuejs/language-tools/issues/2480 | ||
try { | ||
// @ts-ignore | ||
process.chdir(rootPath); | ||
process.chdir(currentDirectory); | ||
} | ||
@@ -190,3 +189,3 @@ catch { } | ||
dirName = resolvePath(dirName); | ||
const matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, rootPath, depth, dirPath => { | ||
const matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, currentDirectory, depth, dirPath => { | ||
dirPath = resolvePath(dirPath); | ||
@@ -193,0 +192,0 @@ readDirectoryWorker(dirPath); |
{ | ||
"name": "@volar/typescript", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.0.4", | ||
"@volar/language-core": "2.1.0", | ||
"path-browserify": "^1.0.1" | ||
@@ -22,5 +22,5 @@ }, | ||
"@types/path-browserify": "latest", | ||
"@volar/language-service": "2.0.4" | ||
"@volar/language-service": "2.1.0" | ||
}, | ||
"gitHead": "b3dc544424c95f8b72e832fbaa0f85a34442389b" | ||
"gitHead": "09e1792f0adafb02caf89a5a45a6fcaaf3177808" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164552
3571
+ Added@volar/language-core@2.1.0(transitive)
+ Added@volar/source-map@2.1.0(transitive)
- Removed@volar/language-core@2.0.4(transitive)
- Removed@volar/source-map@2.0.4(transitive)
Updated@volar/language-core@2.1.0