@volar/typescript
Advanced tools
+2
-2
| export * from './lib/common'; | ||
| export * from './lib/node/proxyLanguageService'; | ||
| export * from './lib/node/decorateLanguageServiceHost'; | ||
| export * from './lib/node/decorateProgram'; | ||
| export * from './lib/node/proxyCreateProgram'; | ||
| export * from './lib/node/proxyLanguageService'; | ||
| export * from './lib/protocol/createProject'; | ||
@@ -10,3 +10,3 @@ export * from './lib/protocol/createSys'; | ||
| import type * as ts from 'typescript'; | ||
| import { URI } from 'vscode-uri'; | ||
| import { type URI } from 'vscode-uri'; | ||
| declare module '@volar/language-service' { | ||
@@ -13,0 +13,0 @@ interface ProjectContext { |
+1
-1
@@ -18,8 +18,8 @@ "use strict"; | ||
| __exportStar(require("./lib/common"), exports); | ||
| __exportStar(require("./lib/node/proxyLanguageService"), exports); | ||
| __exportStar(require("./lib/node/decorateLanguageServiceHost"), exports); | ||
| __exportStar(require("./lib/node/decorateProgram"), exports); | ||
| __exportStar(require("./lib/node/proxyCreateProgram"), exports); | ||
| __exportStar(require("./lib/node/proxyLanguageService"), exports); | ||
| __exportStar(require("./lib/protocol/createProject"), exports); | ||
| __exportStar(require("./lib/protocol/createSys"), exports); | ||
| //# sourceMappingURL=index.js.map |
+18
-9
@@ -7,13 +7,22 @@ "use strict"; | ||
| switch (ext) { | ||
| case 'js': return 'javascript'; | ||
| case 'cjs': return 'javascript'; | ||
| case 'mjs': return 'javascript'; | ||
| case 'ts': return 'typescript'; | ||
| case 'cts': return 'typescript'; | ||
| case 'mts': return 'typescript'; | ||
| case 'jsx': return 'javascriptreact'; | ||
| case 'tsx': return 'typescriptreact'; | ||
| case 'json': return 'json'; | ||
| case 'js': | ||
| return 'javascript'; | ||
| case 'cjs': | ||
| return 'javascript'; | ||
| case 'mjs': | ||
| return 'javascript'; | ||
| case 'ts': | ||
| return 'typescript'; | ||
| case 'cts': | ||
| return 'typescript'; | ||
| case 'mts': | ||
| return 'typescript'; | ||
| case 'jsx': | ||
| return 'javascriptreact'; | ||
| case 'tsx': | ||
| return 'typescriptreact'; | ||
| case 'json': | ||
| return 'json'; | ||
| } | ||
| } | ||
| //# sourceMappingURL=common.js.map |
@@ -6,2 +6,3 @@ "use strict"; | ||
| const resolveModuleName_1 = require("../resolveModuleName"); | ||
| const utils_1 = require("./utils"); | ||
| function decorateLanguageServiceHost(ts, language, languageServiceHost) { | ||
@@ -39,9 +40,15 @@ const pluginExtensions = language.plugins | ||
| languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, ...rest) => { | ||
| if (moduleLiterals.every(name => !pluginExtensions.some(ext => name.text.endsWith(ext)))) { | ||
| return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, ...rest); | ||
| const disposeFixup = (0, utils_1.fixupImpliedNodeFormatForFile)(ts, pluginExtensions, containingSourceFile, moduleResolutionCache.getPackageJsonInfoCache(), languageServiceHost, options); | ||
| try { | ||
| if (moduleLiterals.every(name => !pluginExtensions.some(ext => name.text.endsWith(ext)))) { | ||
| return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, ...rest); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| const mode = ts.getModeForUsageLocation(containingSourceFile, moduleLiteral, options); | ||
| return resolveModuleName(moduleLiteral.text, containingFile, options, moduleResolutionCache, redirectedReference, mode); | ||
| }); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| const mode = ts.getModeForUsageLocation(containingSourceFile, moduleLiteral, options); | ||
| return resolveModuleName(moduleLiteral.text, containingFile, options, moduleResolutionCache, redirectedReference, mode); | ||
| }); | ||
| finally { | ||
| disposeFixup?.(); | ||
| } | ||
| }; | ||
@@ -55,3 +62,4 @@ } | ||
| return moduleNames.map(moduleName => { | ||
| return resolveModuleName(moduleName, containingFile, options, moduleResolutionCache, redirectedReference).resolvedModule; | ||
| return resolveModuleName(moduleName, containingFile, options, moduleResolutionCache, redirectedReference) | ||
| .resolvedModule; | ||
| }); | ||
@@ -58,0 +66,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
| import { Language, LanguagePlugin } from '@volar/language-core'; | ||
| import { type Language, type LanguagePlugin } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
@@ -3,0 +3,0 @@ export declare function proxyCreateProgram(ts: typeof import('typescript'), original: typeof ts['createProgram'], create: (ts: typeof import('typescript'), options: ts.CreateProgramOptions) => LanguagePlugin<string>[] | { |
@@ -5,5 +5,6 @@ "use strict"; | ||
| const language_core_1 = require("@volar/language-core"); | ||
| const common_1 = require("../common"); | ||
| const resolveModuleName_1 = require("../resolveModuleName"); | ||
| const decorateProgram_1 = require("./decorateProgram"); | ||
| const common_1 = require("../common"); | ||
| const utils_1 = require("./utils"); | ||
| const arrayEqual = (a, b) => { | ||
@@ -94,3 +95,3 @@ if (a.length !== b.length) { | ||
| const originalHost = options.host; | ||
| const extensions = languagePlugins | ||
| const pluginExtensions = languagePlugins | ||
| .map(plugin => plugin.typescript?.extraFileExtensions.map(({ extension }) => `.${extension}`) ?? []) | ||
@@ -151,3 +152,3 @@ .flat(); | ||
| }; | ||
| if (extensions.length) { | ||
| if (pluginExtensions.length) { | ||
| options.options.allowArbitraryExtensions = true; | ||
@@ -158,12 +159,19 @@ const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, ts.sys.getFileSize, originalHost, language.plugins, fileName => language.scripts.get(fileName)); | ||
| options.host.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, compilerOptions, containingSourceFile, ...rest) => { | ||
| if (resolveModuleNameLiterals && moduleLiterals.every(name => !extensions.some(ext => name.text.endsWith(ext)))) { | ||
| return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, compilerOptions, containingSourceFile, ...rest); | ||
| const disposeFixup = (0, utils_1.fixupImpliedNodeFormatForFile)(ts, pluginExtensions, containingSourceFile, moduleResolutionCache.getPackageJsonInfoCache(), originalHost, compilerOptions); | ||
| try { | ||
| if (resolveModuleNameLiterals | ||
| && moduleLiterals.every(name => !pluginExtensions.some(ext => name.text.endsWith(ext)))) { | ||
| return resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, compilerOptions, containingSourceFile, ...rest); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| const mode = ts.getModeForUsageLocation(containingSourceFile, moduleLiteral, compilerOptions); | ||
| return resolveModuleName(moduleLiteral.text, containingFile, compilerOptions, moduleResolutionCache, redirectedReference, mode); | ||
| }); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| const mode = ts.getModeForUsageLocation(containingSourceFile, moduleLiteral, compilerOptions); | ||
| return resolveModuleName(moduleLiteral.text, containingFile, compilerOptions, moduleResolutionCache, redirectedReference, mode); | ||
| }); | ||
| finally { | ||
| disposeFixup?.(); | ||
| } | ||
| }; | ||
| options.host.resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, compilerOptions, containingSourceFile) => { | ||
| if (resolveModuleNames && moduleNames.every(name => !extensions.some(ext => name.endsWith(ext)))) { | ||
| if (resolveModuleNames && moduleNames.every(name => !pluginExtensions.some(ext => name.endsWith(ext)))) { | ||
| return resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, compilerOptions, containingSourceFile); | ||
@@ -170,0 +178,0 @@ } |
@@ -1,2 +0,2 @@ | ||
| import { Language } from '@volar/language-core'; | ||
| import { type Language } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -28,37 +28,72 @@ "use strict"; | ||
| switch (p) { | ||
| case 'getNavigationTree': return getNavigationTree(language, target[p]); | ||
| case 'getOutliningSpans': return getOutliningSpans(language, target[p]); | ||
| case 'getFormattingEditsForDocument': return getFormattingEditsForDocument(language, target[p]); | ||
| case 'getFormattingEditsForRange': return getFormattingEditsForRange(language, target[p]); | ||
| case 'getFormattingEditsAfterKeystroke': return getFormattingEditsAfterKeystroke(language, target[p]); | ||
| case 'getEditsForFileRename': return getEditsForFileRename(language, target[p]); | ||
| case 'getLinkedEditingRangeAtPosition': return getLinkedEditingRangeAtPosition(language, target[p]); | ||
| case 'prepareCallHierarchy': return prepareCallHierarchy(language, target[p]); | ||
| case 'provideCallHierarchyIncomingCalls': return provideCallHierarchyIncomingCalls(language, target[p]); | ||
| case 'provideCallHierarchyOutgoingCalls': return provideCallHierarchyOutgoingCalls(language, target[p]); | ||
| case 'organizeImports': return organizeImports(language, target[p]); | ||
| case 'getQuickInfoAtPosition': return getQuickInfoAtPosition(language, target[p]); | ||
| case 'getSignatureHelpItems': return getSignatureHelpItems(language, target[p]); | ||
| case 'getDocumentHighlights': return getDocumentHighlights(language, target[p]); | ||
| case 'getApplicableRefactors': return getApplicableRefactors(language, target[p]); | ||
| case 'getEditsForRefactor': return getEditsForRefactor(language, target[p]); | ||
| case 'getCombinedCodeFix': return getCombinedCodeFix(language, target[p]); | ||
| case 'getRenameInfo': return getRenameInfo(language, target[p]); | ||
| case 'getCodeFixesAtPosition': return getCodeFixesAtPosition(language, target[p]); | ||
| case 'getEncodedSemanticClassifications': return getEncodedSemanticClassifications(language, target[p]); | ||
| case 'getSyntacticDiagnostics': return getSyntacticDiagnostics(language, languageService, target[p]); | ||
| case 'getSemanticDiagnostics': return getSemanticDiagnostics(language, languageService, target[p]); | ||
| case 'getSuggestionDiagnostics': return getSuggestionDiagnostics(language, languageService, target[p]); | ||
| case 'getDefinitionAndBoundSpan': return getDefinitionAndBoundSpan(language, target[p]); | ||
| case 'findReferences': return findReferences(language, target[p]); | ||
| case 'getDefinitionAtPosition': return getDefinitionAtPosition(language, target[p]); | ||
| case 'getTypeDefinitionAtPosition': return getTypeDefinitionAtPosition(language, target[p]); | ||
| case 'getImplementationAtPosition': return getImplementationAtPosition(language, target[p]); | ||
| case 'findRenameLocations': return findRenameLocations(language, target[p]); | ||
| case 'getReferencesAtPosition': return getReferencesAtPosition(language, target[p]); | ||
| case 'getCompletionsAtPosition': return getCompletionsAtPosition(language, target[p]); | ||
| case 'getCompletionEntryDetails': return getCompletionEntryDetails(language, target[p]); | ||
| case 'provideInlayHints': return provideInlayHints(language, target[p]); | ||
| case 'getFileReferences': return getFileReferences(language, target[p]); | ||
| case 'getNavigateToItems': return getNavigateToItems(language, target[p]); | ||
| case 'getNavigationTree': | ||
| return getNavigationTree(language, target[p]); | ||
| case 'getOutliningSpans': | ||
| return getOutliningSpans(language, target[p]); | ||
| case 'getFormattingEditsForDocument': | ||
| return getFormattingEditsForDocument(language, target[p]); | ||
| case 'getFormattingEditsForRange': | ||
| return getFormattingEditsForRange(language, target[p]); | ||
| case 'getFormattingEditsAfterKeystroke': | ||
| return getFormattingEditsAfterKeystroke(language, target[p]); | ||
| case 'getEditsForFileRename': | ||
| return getEditsForFileRename(language, target[p]); | ||
| case 'getLinkedEditingRangeAtPosition': | ||
| return getLinkedEditingRangeAtPosition(language, target[p]); | ||
| case 'prepareCallHierarchy': | ||
| return prepareCallHierarchy(language, target[p]); | ||
| case 'provideCallHierarchyIncomingCalls': | ||
| return provideCallHierarchyIncomingCalls(language, target[p]); | ||
| case 'provideCallHierarchyOutgoingCalls': | ||
| return provideCallHierarchyOutgoingCalls(language, target[p]); | ||
| case 'organizeImports': | ||
| return organizeImports(language, target[p]); | ||
| case 'getQuickInfoAtPosition': | ||
| return getQuickInfoAtPosition(language, target[p]); | ||
| case 'getSignatureHelpItems': | ||
| return getSignatureHelpItems(language, target[p]); | ||
| case 'getDocumentHighlights': | ||
| return getDocumentHighlights(language, target[p]); | ||
| case 'getApplicableRefactors': | ||
| return getApplicableRefactors(language, target[p]); | ||
| case 'getEditsForRefactor': | ||
| return getEditsForRefactor(language, target[p]); | ||
| case 'getCombinedCodeFix': | ||
| return getCombinedCodeFix(language, target[p]); | ||
| case 'getRenameInfo': | ||
| return getRenameInfo(language, target[p]); | ||
| case 'getCodeFixesAtPosition': | ||
| return getCodeFixesAtPosition(language, target[p]); | ||
| case 'getEncodedSemanticClassifications': | ||
| return getEncodedSemanticClassifications(language, target[p]); | ||
| case 'getSyntacticDiagnostics': | ||
| return getSyntacticDiagnostics(language, languageService, target[p]); | ||
| case 'getSemanticDiagnostics': | ||
| return getSemanticDiagnostics(language, languageService, target[p]); | ||
| case 'getSuggestionDiagnostics': | ||
| return getSuggestionDiagnostics(language, languageService, target[p]); | ||
| case 'getDefinitionAndBoundSpan': | ||
| return getDefinitionAndBoundSpan(language, target[p]); | ||
| case 'findReferences': | ||
| return findReferences(language, target[p]); | ||
| case 'getDefinitionAtPosition': | ||
| return getDefinitionAtPosition(language, target[p]); | ||
| case 'getTypeDefinitionAtPosition': | ||
| return getTypeDefinitionAtPosition(language, target[p]); | ||
| case 'getImplementationAtPosition': | ||
| return getImplementationAtPosition(language, target[p]); | ||
| case 'findRenameLocations': | ||
| return findRenameLocations(language, target[p]); | ||
| case 'getReferencesAtPosition': | ||
| return getReferencesAtPosition(language, target[p]); | ||
| case 'getCompletionsAtPosition': | ||
| return getCompletionsAtPosition(language, target[p]); | ||
| case 'getCompletionEntryDetails': | ||
| return getCompletionEntryDetails(language, target[p]); | ||
| case 'provideInlayHints': | ||
| return provideInlayHints(language, target[p]); | ||
| case 'getFileReferences': | ||
| return getFileReferences(language, target[p]); | ||
| case 'getNavigateToItems': | ||
| return getNavigateToItems(language, target[p]); | ||
| } | ||
@@ -417,3 +452,4 @@ }; | ||
| .map(span => { | ||
| const { textSpan } = (0, transform_1.transformSpan)(language, span.fileName ?? highlights.fileName, span.textSpan, false, language_core_1.isHighlightEnabled) ?? {}; | ||
| const { textSpan } = (0, transform_1.transformSpan)(language, span.fileName ?? highlights.fileName, span.textSpan, false, language_core_1.isHighlightEnabled) | ||
| ?? {}; | ||
| if (textSpan) { | ||
@@ -503,3 +539,3 @@ return { | ||
| canRename: false, | ||
| localizedErrorMessage: "Cannot rename" | ||
| localizedErrorMessage: 'Cannot rename', | ||
| }; | ||
@@ -566,3 +602,3 @@ } | ||
| spans: [], | ||
| endOfLineState: 0 | ||
| endOfLineState: 0, | ||
| }; | ||
@@ -576,3 +612,3 @@ } | ||
| spans: [], | ||
| endOfLineState: 0 | ||
| endOfLineState: 0, | ||
| }; | ||
@@ -786,3 +822,4 @@ } | ||
| for (const entry of result.entries) { | ||
| entry.replacementSpan = entry.replacementSpan && (0, transform_1.transformTextSpan)(sourceScript, language, serviceScript, entry.replacementSpan, false, language_core_1.isCompletionEnabled)?.[1]; | ||
| entry.replacementSpan = entry.replacementSpan | ||
| && (0, transform_1.transformTextSpan)(sourceScript, language, serviceScript, entry.replacementSpan, false, language_core_1.isCompletionEnabled)?.[1]; | ||
| } | ||
@@ -789,0 +826,0 @@ result.optionalReplacementSpan = result.optionalReplacementSpan |
| import type { CodeInformation, SourceScript } from '@volar/language-core'; | ||
| import { Language } from '@volar/language-core'; | ||
| import { type Language } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
@@ -4,0 +4,0 @@ import type { TypeScriptServiceScript } from '../..'; |
@@ -55,3 +55,3 @@ "use strict"; | ||
| start: diagnostic.start, | ||
| length: diagnostic.length | ||
| length: diagnostic.length, | ||
| }, true, data => (0, language_core_1.shouldReportDiagnostics)(data, String(diagnostic.source), String(diagnostic.code))) ?? []; | ||
@@ -105,3 +105,4 @@ const actualDiagnosticFile = sourceSpanFileName | ||
| fileChanges.textChanges.forEach(c => { | ||
| const { fileName, textSpan } = transformSpan(language, fileChanges.fileName, c.span, fallbackToAnyMatch, filter) ?? {}; | ||
| const { fileName, textSpan } = transformSpan(language, fileChanges.fileName, c.span, fallbackToAnyMatch, filter) | ||
| ?? {}; | ||
| if (fileName && textSpan) { | ||
@@ -113,3 +114,3 @@ (changesPerFile[fileName] ?? (changesPerFile[fileName] = [])).push({ ...c, span: textSpan }); | ||
| else { | ||
| const list = (changesPerFile[fileChanges.fileName] ?? (changesPerFile[fileChanges.fileName] = [])); | ||
| const list = changesPerFile[fileChanges.fileName] ?? (changesPerFile[fileChanges.fileName] = []); | ||
| fileChanges.textChanges.forEach(c => { | ||
@@ -128,3 +129,3 @@ list.push(c); | ||
| isNewFile: newFiles.has(fileName), | ||
| textChanges: changesPerFile[fileName] | ||
| textChanges: changesPerFile[fileName], | ||
| }); | ||
@@ -131,0 +132,0 @@ } |
| import type { Language, SourceScript } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
| import type { TypeScriptServiceScript } from '../..'; | ||
| export declare function getServiceScript(language: Language<string>, fileName: string): [serviceScript: TypeScriptServiceScript, targetScript: SourceScript<string>, sourceScript: SourceScript<string>] | [serviceScript: undefined, sourceScript: SourceScript<string>, sourceScript: SourceScript<string>] | [serviceScript: undefined, sourceScript: undefined, targetScript: undefined]; | ||
| export declare function fixupImpliedNodeFormatForFile(ts: typeof import('typescript'), pluginExtensions: string[], sourceFile: ts.SourceFile, packageJsonInfoCache: ts.PackageJsonInfoCache, host: ts.ModuleResolutionHost, options: ts.CompilerOptions): (() => undefined) | undefined; |
+14
-0
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getServiceScript = getServiceScript; | ||
| exports.fixupImpliedNodeFormatForFile = fixupImpliedNodeFormatForFile; | ||
| function getServiceScript(language, fileName) { | ||
@@ -28,2 +29,15 @@ const sourceScript = language.scripts.get(fileName); | ||
| } | ||
| function fixupImpliedNodeFormatForFile(ts, pluginExtensions, sourceFile, packageJsonInfoCache, host, options) { | ||
| if (sourceFile.impliedNodeFormat !== undefined || !pluginExtensions.some(ext => sourceFile.fileName.endsWith(ext))) { | ||
| return; | ||
| } | ||
| // https://github.com/microsoft/TypeScript/blob/669c25c091ad4d32298d0f33b0e4e681d46de3ea/src/compiler/program.ts#L1354 | ||
| const validExts = [ts.Extension.Dts, ts.Extension.Ts, ts.Extension.Tsx, ts.Extension.Js, ts.Extension.Jsx]; | ||
| if (validExts.some(ext => sourceFile.fileName.endsWith(ext))) { | ||
| return; | ||
| } | ||
| const asTs = sourceFile.fileName + ts.Extension.Ts; | ||
| sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile?.(asTs, packageJsonInfoCache, host, options); | ||
| return () => sourceFile.impliedNodeFormat = undefined; | ||
| } | ||
| //# sourceMappingURL=utils.js.map |
@@ -1,2 +0,2 @@ | ||
| import { Language } from '@volar/language-core'; | ||
| import { type Language } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
@@ -3,0 +3,0 @@ import type { TypeScriptExtraServiceScript } from '../..'; |
@@ -6,4 +6,8 @@ "use strict"; | ||
| const path = require("path-browserify"); | ||
| const utils_1 = require("../node/utils"); | ||
| const resolveModuleName_1 = require("../resolveModuleName"); | ||
| function createLanguageServiceHost(ts, sys, language, asScriptId, projectHost) { | ||
| const pluginExtensions = language.plugins | ||
| .map(plugin => plugin.typescript?.extraFileExtensions.map(ext => '.' + ext.extension) ?? []) | ||
| .flat(); | ||
| const scriptVersions = new language_core_1.FileMap(sys.useCaseSensitiveFileNames); | ||
@@ -36,6 +40,4 @@ let lastProjectVersion; | ||
| const exts = new Set(extensions); | ||
| for (const languagePlugin of language.plugins) { | ||
| for (const ext of languagePlugin.typescript?.extraFileExtensions ?? []) { | ||
| exts.add('.' + ext.extension); | ||
| } | ||
| for (const ext of pluginExtensions) { | ||
| exts.add(ext); | ||
| } | ||
@@ -47,3 +49,3 @@ extensions = [...exts]; | ||
| const options = projectHost.getCompilationSettings(); | ||
| if (language.plugins.some(language => language.typescript?.extraFileExtensions.length)) { | ||
| if (pluginExtensions.length) { | ||
| options.allowNonTsExtensions ??= true; | ||
@@ -130,15 +132,22 @@ if (!options.allowNonTsExtensions) { | ||
| } | ||
| if (language.plugins.some(plugin => plugin.typescript?.extraFileExtensions.length)) { | ||
| if (pluginExtensions.length) { | ||
| // TODO: can this share between monorepo packages? | ||
| const moduleCache = ts.createModuleResolutionCache(languageServiceHost.getCurrentDirectory(), languageServiceHost.useCaseSensitiveFileNames?.() ? s => s : s => s.toLowerCase(), languageServiceHost.getCompilationSettings()); | ||
| const moduleResolutionCache = ts.createModuleResolutionCache(languageServiceHost.getCurrentDirectory(), languageServiceHost.useCaseSensitiveFileNames?.() ? s => s : s => s.toLowerCase(), languageServiceHost.getCompilationSettings()); | ||
| const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, sys.getFileSize, languageServiceHost, language.plugins, fileName => language.scripts.get(asScriptId(fileName))); | ||
| let lastSysVersion = 'version' in sys ? sys.version : undefined; | ||
| languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, sourceFile) => { | ||
| if ('version' in sys && lastSysVersion !== sys.version) { | ||
| lastSysVersion = sys.version; | ||
| moduleCache.clear(); | ||
| languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile) => { | ||
| const disposeFixup = (0, utils_1.fixupImpliedNodeFormatForFile)(ts, pluginExtensions, containingSourceFile, moduleResolutionCache.getPackageJsonInfoCache(), languageServiceHost, options); | ||
| try { | ||
| if ('version' in sys && lastSysVersion !== sys.version) { | ||
| lastSysVersion = sys.version; | ||
| moduleResolutionCache.clear(); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| const mode = ts.getModeForUsageLocation(containingSourceFile, moduleLiteral, options); | ||
| return resolveModuleName(moduleLiteral.text, containingFile, options, moduleResolutionCache, redirectedReference, mode); | ||
| }); | ||
| } | ||
| return moduleLiterals.map(moduleLiteral => { | ||
| return resolveModuleName(moduleLiteral.text, containingFile, options, moduleCache, redirectedReference, sourceFile.impliedNodeFormat); | ||
| }); | ||
| finally { | ||
| disposeFixup?.(); | ||
| } | ||
| }; | ||
@@ -148,9 +157,10 @@ languageServiceHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference, options) => { | ||
| lastSysVersion = sys.version; | ||
| moduleCache.clear(); | ||
| moduleResolutionCache.clear(); | ||
| } | ||
| return moduleNames.map(moduleName => { | ||
| return resolveModuleName(moduleName, containingFile, options, moduleCache, redirectedReference).resolvedModule; | ||
| return resolveModuleName(moduleName, containingFile, options, moduleResolutionCache, redirectedReference) | ||
| .resolvedModule; | ||
| }); | ||
| }; | ||
| languageServiceHost.getModuleResolutionCache = () => moduleCache; | ||
| languageServiceHost.getModuleResolutionCache = () => moduleResolutionCache; | ||
| } | ||
@@ -157,0 +167,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
| import type { LanguageServiceEnvironment, Disposable } from '@volar/language-service'; | ||
| import type { Disposable, LanguageServiceEnvironment } from '@volar/language-service'; | ||
| import type * as ts from 'typescript'; | ||
@@ -3,0 +3,0 @@ import { URI } from 'vscode-uri'; |
@@ -5,4 +5,4 @@ "use strict"; | ||
| const path = require("path-browserify"); | ||
| const vscode_uri_1 = require("vscode-uri"); | ||
| const utilities_1 = require("../typescript/utilities"); | ||
| const vscode_uri_1 = require("vscode-uri"); | ||
| let currentCwd = ''; | ||
@@ -29,19 +29,21 @@ function createSys(sys, env, getCurrentDirectory, uriConverter) { | ||
| const dir = getDir(dirName, fileExists); | ||
| dir.files.set(normalizeFileId(baseName), fileExists ? { | ||
| name: baseName, | ||
| stat: { | ||
| type: 1, | ||
| ctime: Date.now(), | ||
| mtime: Date.now(), | ||
| size: -1, | ||
| }, | ||
| requestedStat: false, | ||
| requestedText: false, | ||
| } : { | ||
| name: baseName, | ||
| stat: undefined, | ||
| text: undefined, | ||
| requestedStat: true, | ||
| requestedText: true, | ||
| }); | ||
| dir.files.set(normalizeFileId(baseName), fileExists | ||
| ? { | ||
| name: baseName, | ||
| stat: { | ||
| type: 1, | ||
| ctime: Date.now(), | ||
| mtime: Date.now(), | ||
| size: -1, | ||
| }, | ||
| requestedStat: false, | ||
| requestedText: false, | ||
| } | ||
| : { | ||
| name: baseName, | ||
| stat: undefined, | ||
| text: undefined, | ||
| requestedStat: true, | ||
| requestedText: true, | ||
| }); | ||
| } | ||
@@ -138,3 +140,3 @@ }); | ||
| } | ||
| return file.stat ? new Date(file.stat.mtime) : new Date(0); | ||
| return file.stat ? new Date(file.stat.mtime) : new Date(-1); | ||
| } | ||
@@ -141,0 +143,0 @@ function fileExists(fileName) { |
@@ -1,2 +0,2 @@ | ||
| import { Language, LanguagePlugin } from '@volar/language-core/lib/types'; | ||
| import { type Language, type LanguagePlugin } from '@volar/language-core/lib/types'; | ||
| import type * as ts from 'typescript'; | ||
@@ -3,0 +3,0 @@ export declare const externalFiles: WeakMap<ts.server.Project, string[]>; |
@@ -0,3 +1,3 @@ | ||
| import type { Language, LanguagePlugin } from '@volar/language-core'; | ||
| import type * as ts from 'typescript'; | ||
| import type { Language, LanguagePlugin } from '@volar/language-core'; | ||
| export declare let getLanguagePlugins: (ts: typeof import('typescript'), options: ts.CreateProgramOptions) => LanguagePlugin<string>[] | { | ||
@@ -4,0 +4,0 @@ languagePlugins: LanguagePlugin<string>[]; |
@@ -98,3 +98,3 @@ "use strict"; | ||
| } | ||
| function replace(text, ...[search, replace]) { | ||
| function replace(text, search, replace) { | ||
| const before = text; | ||
@@ -101,0 +101,0 @@ text = text.replace(search, replace); |
@@ -1,2 +0,2 @@ | ||
| import { Comparer, Comparison, SortedReadonlyArray } from "./corePublic"; | ||
| import { type Comparer, Comparison, type SortedReadonlyArray } from './corePublic'; | ||
| /** | ||
@@ -3,0 +3,0 @@ * Iterates through `array` by index and performs the callback on each element of array until the callback |
@@ -235,5 +235,5 @@ "use strict"; | ||
| function toFileNameLowerCase(x) { | ||
| return fileNameLowerCaseRegExp.test(x) ? | ||
| x.replace(fileNameLowerCaseRegExp, toLowerCase) : | ||
| x; | ||
| return fileNameLowerCaseRegExp.test(x) | ||
| ? x.replace(fileNameLowerCaseRegExp, toLowerCase) | ||
| : x; | ||
| } | ||
@@ -267,7 +267,11 @@ function equateValues(a, b) { | ||
| function compareComparableValues(a, b) { | ||
| return a === b ? 0 /* Comparison.EqualTo */ : | ||
| a === undefined ? -1 /* Comparison.LessThan */ : | ||
| b === undefined ? 1 /* Comparison.GreaterThan */ : | ||
| a < b ? -1 /* Comparison.LessThan */ : | ||
| 1 /* Comparison.GreaterThan */; | ||
| return a === b | ||
| ? 0 /* Comparison.EqualTo */ | ||
| : a === undefined | ||
| ? -1 /* Comparison.LessThan */ | ||
| : b === undefined | ||
| ? 1 /* Comparison.GreaterThan */ | ||
| : a < b | ||
| ? -1 /* Comparison.LessThan */ | ||
| : 1 /* Comparison.GreaterThan */; | ||
| } | ||
@@ -274,0 +278,0 @@ /** |
@@ -13,6 +13,6 @@ export declare const versionMajorMinor = "4.9"; | ||
| export interface SortedReadonlyArray<T> extends ReadonlyArray<T> { | ||
| " __sortedArrayBrand": any; | ||
| ' __sortedArrayBrand': any; | ||
| } | ||
| export interface SortedArray<T> extends Array<T> { | ||
| " __sortedArrayBrand": any; | ||
| ' __sortedArrayBrand': any; | ||
| } | ||
@@ -19,0 +19,0 @@ /** Common read methods for ES6 Map/Set. */ |
@@ -6,3 +6,3 @@ "use strict"; | ||
| // If changing the text in this section, be sure to test `configurePrerelease` too. | ||
| exports.versionMajorMinor = "4.9"; | ||
| exports.versionMajorMinor = '4.9'; | ||
| // The following is baselined as a literal template type without intervention | ||
@@ -15,7 +15,11 @@ /** The version of the TypeScript compiler release */ | ||
| (function (NativeCollections) { | ||
| const globals = typeof globalThis !== "undefined" ? globalThis : | ||
| const globals = typeof globalThis !== 'undefined' | ||
| ? globalThis | ||
| // @ts-ignore node global | ||
| typeof global !== "undefined" ? global : | ||
| typeof self !== "undefined" ? self : | ||
| undefined; | ||
| : typeof global !== 'undefined' | ||
| // @ts-ignore node global | ||
| ? global | ||
| : typeof self !== 'undefined' | ||
| ? self | ||
| : undefined; | ||
| /** | ||
@@ -28,5 +32,7 @@ * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). | ||
| // eslint-disable-next-line local/no-in-operator | ||
| const constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; | ||
| const constructor = typeof gMap !== 'undefined' && 'entries' in gMap.prototype && new gMap([[0, 0]]).size === 1 | ||
| ? gMap | ||
| : undefined; | ||
| if (!constructor) { | ||
| throw new Error("No compatible Map implementation found."); | ||
| throw new Error('No compatible Map implementation found.'); | ||
| } | ||
@@ -43,5 +49,7 @@ return constructor; | ||
| // eslint-disable-next-line local/no-in-operator | ||
| const constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; | ||
| const constructor = typeof gSet !== 'undefined' && 'entries' in gSet.prototype && new gSet([0]).size === 1 | ||
| ? gSet | ||
| : undefined; | ||
| if (!constructor) { | ||
| throw new Error("No compatible Set implementation found."); | ||
| throw new Error('No compatible Set implementation found.'); | ||
| } | ||
@@ -48,0 +56,0 @@ return constructor; |
@@ -1,2 +0,2 @@ | ||
| import { Path } from "./types"; | ||
| import { type Path } from './types'; | ||
| /** | ||
@@ -3,0 +3,0 @@ * Internally, we represent paths as strings with '/' as the directory separator. |
+28
-26
@@ -19,5 +19,5 @@ "use strict"; | ||
| */ | ||
| exports.directorySeparator = "/"; | ||
| const altDirectorySeparator = "\\"; | ||
| const urlSchemeSeparator = "://"; | ||
| exports.directorySeparator = '/'; | ||
| const altDirectorySeparator = '\\'; | ||
| const urlSchemeSeparator = '://'; | ||
| const backslashRegExp = /\\/g; | ||
@@ -39,3 +39,3 @@ //// Path Tests | ||
| function hasExtension(fileName) { | ||
| return (0, core_1.stringContains)(getBaseFileName(fileName), "."); | ||
| return (0, core_1.stringContains)(getBaseFileName(fileName), '.'); | ||
| } | ||
@@ -61,4 +61,4 @@ function fileExtensionIs(path, extension) { | ||
| function isVolumeCharacter(charCode) { | ||
| return (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) || | ||
| (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */); | ||
| return (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) | ||
| || (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */); | ||
| } | ||
@@ -119,4 +119,4 @@ function getFileUrlVolumeSeparatorEnd(url, start) { | ||
| const authority = path.slice(authorityStart, authorityEnd); | ||
| if (scheme === "file" && (authority === "" || authority === "localhost") && | ||
| isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) { | ||
| if (scheme === 'file' && (authority === '' || authority === 'localhost') | ||
| && isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) { | ||
| const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2); | ||
@@ -188,3 +188,3 @@ if (volumeSeparatorEnd !== -1) { | ||
| if (rootLength === path.length) { | ||
| return ""; | ||
| return ''; | ||
| } | ||
@@ -195,8 +195,10 @@ // return the trailing portion of the path starting after the last (non-terminal) directory | ||
| const name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(exports.directorySeparator) + 1)); | ||
| const extension = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(name, extensions, ignoreCase) : undefined; | ||
| const extension = extensions !== undefined && ignoreCase !== undefined | ||
| ? getAnyExtensionFromPath(name, extensions, ignoreCase) | ||
| : undefined; | ||
| return extension ? name.slice(0, name.length - extension.length) : name; | ||
| } | ||
| function tryGetExtensionFromPath(path, extension, stringEqualityComparer) { | ||
| if (!(0, core_1.startsWith)(extension, ".")) { | ||
| extension = "." + extension; | ||
| if (!(0, core_1.startsWith)(extension, '.')) { | ||
| extension = '.' + extension; | ||
| } | ||
@@ -211,4 +213,4 @@ if (path.length >= extension.length && path.charCodeAt(path.length - extension.length) === 46 /* CharacterCodes.dot */) { | ||
| function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) { | ||
| if (typeof extensions === "string") { | ||
| return tryGetExtensionFromPath(path, extensions, stringEqualityComparer) || ""; | ||
| if (typeof extensions === 'string') { | ||
| return tryGetExtensionFromPath(path, extensions, stringEqualityComparer) || ''; | ||
| } | ||
@@ -221,3 +223,3 @@ for (const extension of extensions) { | ||
| } | ||
| return ""; | ||
| return ''; | ||
| } | ||
@@ -231,7 +233,7 @@ function getAnyExtensionFromPath(path, extensions, ignoreCase) { | ||
| const baseFileName = getBaseFileName(path); | ||
| const extensionIndex = baseFileName.lastIndexOf("."); | ||
| const extensionIndex = baseFileName.lastIndexOf('.'); | ||
| if (extensionIndex >= 0) { | ||
| return baseFileName.substring(extensionIndex); | ||
| } | ||
| return ""; | ||
| return ''; | ||
| } | ||
@@ -276,3 +278,3 @@ function pathComponents(path, rootLength) { | ||
| */ | ||
| function getPathComponents(path, currentDirectory = "") { | ||
| function getPathComponents(path, currentDirectory = '') { | ||
| path = combinePaths(currentDirectory, path); | ||
@@ -292,3 +294,3 @@ return pathComponents(path, getRootLength(path)); | ||
| if (pathComponents.length === 0) { | ||
| return ""; | ||
| return ''; | ||
| } | ||
@@ -303,3 +305,3 @@ const root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]); | ||
| function normalizeSlashes(path) { | ||
| return path.indexOf("\\") !== -1 | ||
| return path.indexOf('\\') !== -1 | ||
| ? path.replace(backslashRegExp, exports.directorySeparator) | ||
@@ -322,8 +324,8 @@ : path; | ||
| } | ||
| if (component === ".") { | ||
| if (component === '.') { | ||
| continue; | ||
| } | ||
| if (component === "..") { | ||
| if (component === '..') { | ||
| if (reduced.length > 1) { | ||
| if (reduced[reduced.length - 1] !== "..") { | ||
| if (reduced[reduced.length - 1] !== '..') { | ||
| reduced.pop(); | ||
@@ -397,3 +399,3 @@ continue; | ||
| // Some paths only require cleanup of `/./` or leading `./` | ||
| const simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, ""); | ||
| const simplified = path.replace(/\/\.\//g, '/').replace(/^\.\//, ''); | ||
| if (simplified !== path) { | ||
@@ -425,7 +427,7 @@ path = simplified; | ||
| function containsPath(parent, child, currentDirectory, ignoreCase) { | ||
| if (typeof currentDirectory === "string") { | ||
| if (typeof currentDirectory === 'string') { | ||
| parent = combinePaths(currentDirectory, parent); | ||
| child = combinePaths(currentDirectory, child); | ||
| } | ||
| else if (typeof currentDirectory === "boolean") { | ||
| else if (typeof currentDirectory === 'boolean') { | ||
| ignoreCase = currentDirectory; | ||
@@ -432,0 +434,0 @@ } |
@@ -13,4 +13,4 @@ "use strict"; | ||
| const wildcardCharCodes = [42 /* CharacterCodes.asterisk */, 63 /* CharacterCodes.question */]; | ||
| const commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"]; | ||
| const implicitExcludePathRegexPattern = `(?!(${commonPackageFolders.join("|")})(/|$))`; | ||
| const commonPackageFolders = ['node_modules', 'bower_components', 'jspm_packages']; | ||
| const implicitExcludePathRegexPattern = `(?!(${commonPackageFolders.join('|')})(/|$))`; | ||
| const filesMatcher = { | ||
@@ -23,3 +23,3 @@ /** | ||
| */ | ||
| singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*", | ||
| singleAsteriskRegexFragment: '([^./]|(\\.(?!min\\.js$))?)*', | ||
| /** | ||
@@ -30,6 +30,6 @@ * Regex for the ** wildcard. Matches any number of subdirectories. When used for including | ||
| doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`, | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment) | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment), | ||
| }; | ||
| const directoriesMatcher = { | ||
| singleAsteriskRegexFragment: "[^/]*", | ||
| singleAsteriskRegexFragment: '[^/]*', | ||
| /** | ||
@@ -40,8 +40,8 @@ * Regex for the ** wildcard. Matches any number of subdirectories. When used for including | ||
| doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`, | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment) | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment), | ||
| }; | ||
| const excludeMatcher = { | ||
| singleAsteriskRegexFragment: "[^/]*", | ||
| doubleAsteriskRegexFragment: "(/.+?)?", | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment) | ||
| singleAsteriskRegexFragment: '[^/]*', | ||
| doubleAsteriskRegexFragment: '(/.+?)?', | ||
| replaceWildcardCharacter: match => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment), | ||
| }; | ||
@@ -51,3 +51,3 @@ const wildcardMatchers = { | ||
| directories: directoriesMatcher, | ||
| exclude: excludeMatcher | ||
| exclude: excludeMatcher, | ||
| }; | ||
@@ -59,5 +59,5 @@ function getRegularExpressionForWildcard(specs, basePath, usage) { | ||
| } | ||
| const pattern = patterns.map(pattern => `(${pattern})`).join("|"); | ||
| const pattern = patterns.map(pattern => `(${pattern})`).join('|'); | ||
| // If excluding, match "foo/bar/baz...", but if including, only allow "foo". | ||
| const terminator = usage === "exclude" ? "($|/)" : "$"; | ||
| const terminator = usage === 'exclude' ? '($|/)' : '$'; | ||
| return `^(${pattern})${terminator}`; | ||
@@ -79,7 +79,7 @@ } | ||
| function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter }) { | ||
| let subpattern = ""; | ||
| let subpattern = ''; | ||
| let hasWrittenComponent = false; | ||
| const components = (0, path_1.getNormalizedPathComponents)(spec, basePath); | ||
| const lastComponent = (0, core_1.last)(components); | ||
| if (usage !== "exclude" && lastComponent === "**") { | ||
| if (usage !== 'exclude' && lastComponent === '**') { | ||
| return undefined; | ||
@@ -91,12 +91,12 @@ } | ||
| if (isImplicitGlob(lastComponent)) { | ||
| components.push("**", "*"); | ||
| components.push('**', '*'); | ||
| } | ||
| let optionalCount = 0; | ||
| for (let component of components) { | ||
| if (component === "**") { | ||
| if (component === '**') { | ||
| subpattern += doubleAsteriskRegexFragment; | ||
| } | ||
| else { | ||
| if (usage === "directories") { | ||
| subpattern += "("; | ||
| if (usage === 'directories') { | ||
| subpattern += '('; | ||
| optionalCount++; | ||
@@ -107,4 +107,4 @@ } | ||
| } | ||
| if (usage !== "exclude") { | ||
| let componentPattern = ""; | ||
| if (usage !== 'exclude') { | ||
| let componentPattern = ''; | ||
| // The * and ? wildcards should not match directories or files that start with . if they | ||
@@ -114,7 +114,7 @@ // appear first in a component. Dotted directories and files can be included explicitly | ||
| if (component.charCodeAt(0) === 42 /* CharacterCodes.asterisk */) { | ||
| componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?"; | ||
| componentPattern += '([^./]' + singleAsteriskRegexFragment + ')?'; | ||
| component = component.substr(1); | ||
| } | ||
| else if (component.charCodeAt(0) === 63 /* CharacterCodes.question */) { | ||
| componentPattern += "[^./]"; | ||
| componentPattern += '[^./]'; | ||
| component = component.substr(1); | ||
@@ -141,3 +141,3 @@ } | ||
| while (optionalCount > 0) { | ||
| subpattern += ")?"; | ||
| subpattern += ')?'; | ||
| optionalCount--; | ||
@@ -148,3 +148,3 @@ } | ||
| function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { | ||
| return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; | ||
| return match === '*' ? singleAsteriskRegexFragment : match === '?' ? '[^/]' : '\\' + match; | ||
| } | ||
@@ -157,11 +157,11 @@ /** @param path directory of the tsconfig.json */ | ||
| return { | ||
| includeFilePatterns: (0, core_1.map)(getRegularExpressionsForWildcards(includes, absolutePath, "files"), pattern => `^${pattern}$`), | ||
| includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), | ||
| includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), | ||
| excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), | ||
| basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames) | ||
| includeFilePatterns: (0, core_1.map)(getRegularExpressionsForWildcards(includes, absolutePath, 'files'), pattern => `^${pattern}$`), | ||
| includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, 'files'), | ||
| includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, 'directories'), | ||
| excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, 'exclude'), | ||
| basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames), | ||
| }; | ||
| } | ||
| function getRegexFromPattern(pattern, useCaseSensitiveFileNames) { | ||
| return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i"); | ||
| return new RegExp(pattern, useCaseSensitiveFileNames ? '' : 'i'); | ||
| } | ||
@@ -173,5 +173,8 @@ /** @param path directory of the tsconfig.json */ | ||
| const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); | ||
| const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(pattern => getRegexFromPattern(pattern, useCaseSensitiveFileNames)); | ||
| const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames); | ||
| const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames); | ||
| const includeFileRegexes = patterns.includeFilePatterns | ||
| && patterns.includeFilePatterns.map(pattern => getRegexFromPattern(pattern, useCaseSensitiveFileNames)); | ||
| const includeDirectoryRegex = patterns.includeDirectoryPattern | ||
| && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames); | ||
| const excludeRegex = patterns.excludePattern | ||
| && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames); | ||
| // Associate an array of results with each include regex. This keeps results in order of the "include" order. | ||
@@ -221,4 +224,4 @@ // If there are no "includes", then just put everything in results[0]. | ||
| const absoluteName = (0, path_1.combinePaths)(absolutePath, current); | ||
| if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && | ||
| (!excludeRegex || !excludeRegex.test(absoluteName))) { | ||
| if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) | ||
| && (!excludeRegex || !excludeRegex.test(absoluteName))) { | ||
| visitDirectory(name, absoluteName, depth); | ||
@@ -225,0 +228,0 @@ } |
+4
-4
| { | ||
| "name": "@volar/typescript", | ||
| "version": "2.4.23", | ||
| "version": "2.4.24", | ||
| "license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
| "dependencies": { | ||
| "@volar/language-core": "2.4.23", | ||
| "@volar/language-core": "2.4.24", | ||
| "path-browserify": "^1.0.1", | ||
@@ -23,5 +23,5 @@ "vscode-uri": "^3.0.8" | ||
| "@types/path-browserify": "latest", | ||
| "@volar/language-service": "2.4.23" | ||
| "@volar/language-service": "2.4.24" | ||
| }, | ||
| "gitHead": "9b06fb744475622284870f6cc4e638dc7747daef" | ||
| "gitHead": "a5c7cf5d1afa5c3780a48866d17680c223891e42" | ||
| } |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
216449
1.85%4624
2.41%9
12.5%+ Added
+ Added
- Removed
- Removed
Updated