Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@volar/typescript

Package Overview
Dependencies
Maintainers
0
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volar/typescript - npm Package Compare versions

Comparing version 2.4.0-alpha.5 to 2.4.0-alpha.6

2

lib/node/decorateLanguageServiceHost.js

@@ -31,3 +31,3 @@ "use strict";

if (pluginExtensions.length) {
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, languageServiceHost, language.plugins, fileName => language.scripts.get(fileName));
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, ts.sys.getFileSize, languageServiceHost, language.plugins, fileName => language.scripts.get(fileName));
const getCanonicalFileName = languageServiceHost.useCaseSensitiveFileNames?.()

@@ -34,0 +34,0 @@ ? (fileName) => fileName

@@ -147,3 +147,3 @@ "use strict";

options.options.allowArbitraryExtensions = true;
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, originalHost, language.plugins, fileName => language.scripts.get(fileName));
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, ts.sys.getFileSize, originalHost, language.plugins, fileName => language.scripts.get(fileName));
const resolveModuleNameLiterals = originalHost.resolveModuleNameLiterals;

@@ -150,0 +150,0 @@ const resolveModuleNames = originalHost.resolveModuleNames;

@@ -12,2 +12,3 @@ "use strict";

let tsFileRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames);
let tsFileDirRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames);
let extraScriptRegistry = new language_core_1.FileMap(sys.useCaseSensitiveFileNames);

@@ -70,2 +71,9 @@ let lastTsVirtualFileSnapshots = new Set();

},
directoryExists(directoryName) {
sync();
if (tsFileDirRegistry.has(directoryName)) {
return true;
}
return sys.directoryExists(directoryName);
},
fileExists(fileName) {

@@ -124,3 +132,3 @@ return getScriptVersion(fileName) !== '';

const moduleCache = ts.createModuleResolutionCache(languageServiceHost.getCurrentDirectory(), languageServiceHost.useCaseSensitiveFileNames?.() ? s => s : s => s.toLowerCase(), languageServiceHost.getCompilationSettings());
const resolveModuleName = (0, resolveModuleName_1.createResolveModuleName)(ts, languageServiceHost, language.plugins, fileName => language.scripts.get(asScriptId(fileName)));
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;

@@ -196,4 +204,10 @@ languageServiceHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, sourceFile) => {

tsFileRegistry.clear();
tsFileDirRegistry.clear();
for (const fileName of tsFileNamesSet) {
tsFileRegistry.set(fileName, true);
const parts = fileName.split('/');
for (let i = 1; i < parts.length; i++) {
const dirName = parts.slice(0, i).join('/');
tsFileDirRegistry.set(dirName, true);
}
}

@@ -200,0 +214,0 @@ }

import type { LanguageServiceEnvironment, Disposable } from '@volar/language-service';
import type * as ts from 'typescript';
import { URI } from 'vscode-uri';
export declare function createSys(sys: ts.System | undefined, env: LanguageServiceEnvironment, getCurrentDirectory: () => string, uriConverter: {
export declare function createSys(sys: ts.System | undefined, { fs, onDidChangeWatchedFiles }: LanguageServiceEnvironment, getCurrentDirectory: () => string, uriConverter: {
asUri(fileName: string): URI;

@@ -6,0 +6,0 @@ asFileName(uri: URI): string;

@@ -8,3 +8,3 @@ "use strict";

let currentCwd = '';
function createSys(sys, env, getCurrentDirectory, uriConverter) {
function createSys(sys, { fs, onDidChangeWatchedFiles }, getCurrentDirectory, uriConverter) {
let version = 0;

@@ -19,3 +19,3 @@ const caseSensitive = sys?.useCaseSensitiveFileNames ?? false;

const promises = new Set();
const fileWatcher = env.onDidChangeWatchedFiles?.(({ changes }) => {
const fileWatcher = onDidChangeWatchedFiles?.(({ changes }) => {
version++;

@@ -113,3 +113,3 @@ for (const change of changes) {

dir.exists = false;
const result = env.fs?.stat(uriConverter.asUri(dirName));
const result = fs?.stat(uriConverter.asUri(dirName));
if (typeof result === 'object' && 'then' in result) {

@@ -155,3 +155,3 @@ const promise = result;

function handleStat(fileName, file) {
const result = env.fs?.stat(uriConverter.asUri(fileName));
const result = fs?.stat(uriConverter.asUri(fileName));
if (typeof result === 'object' && 'then' in result) {

@@ -229,3 +229,3 @@ const promise = result;

const uri = uriConverter.asUri(fileName);
const result = env.fs?.readFile(uri, encoding);
const result = fs?.readFile(uri, encoding);
if (typeof result === 'object' && 'then' in result) {

@@ -255,3 +255,3 @@ const promise = result;

dir.requestedRead = true;
const result = env.fs?.readDirectory(uriConverter.asUri(dirName || '.'));
const result = fs?.readDirectory(uriConverter.asUri(dirName || '.'));
if (typeof result === 'object' && 'then' in result) {

@@ -278,3 +278,3 @@ const promise = result;

if (fileType === 64) {
const stat = env.fs?.stat(uriConverter.asUri(dirName + '/' + name));
const stat = fs?.stat(uriConverter.asUri(dirName + '/' + name));
if (typeof stat === 'object' && 'then' in stat) {

@@ -281,0 +281,0 @@ const promise = stat;

import type { LanguagePlugin, SourceScript } from '@volar/language-core';
import type * as ts from 'typescript';
export declare function createResolveModuleName<T>(ts: typeof import('typescript'), host: ts.ModuleResolutionHost, languagePlugins: LanguagePlugin<any>[], getSourceScript: (fileName: string) => SourceScript<T> | undefined): (moduleName: string, containingFile: string, compilerOptions: ts.CompilerOptions, cache?: ts.ModuleResolutionCache, redirectedReference?: ts.ResolvedProjectReference, resolutionMode?: ts.ResolutionMode) => ts.ResolvedModuleWithFailedLookupLocations;
export declare function createResolveModuleName<T>(ts: typeof import('typescript'), getFileSize: ((fileName: string) => number) | undefined, host: ts.ModuleResolutionHost, languagePlugins: LanguagePlugin<any>[], getSourceScript: (fileName: string) => SourceScript<T> | undefined): (moduleName: string, containingFile: string, compilerOptions: ts.CompilerOptions, cache?: ts.ModuleResolutionCache, redirectedReference?: ts.ResolvedProjectReference, resolutionMode?: ts.ResolutionMode) => ts.ResolvedModuleWithFailedLookupLocations;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createResolveModuleName = createResolveModuleName;
function createResolveModuleName(ts, host, languagePlugins, getSourceScript) {
function createResolveModuleName(ts, getFileSize, host, languagePlugins, getSourceScript) {
const toSourceFileInfo = new Map();

@@ -84,3 +84,3 @@ const moduleResolutionHost = {

if (host.fileExists(fileName)) {
const fileSize = ts.sys.getFileSize?.(fileName) ?? host.readFile(fileName)?.length ?? 0;
const fileSize = getFileSize?.(fileName) ?? host.readFile(fileName)?.length ?? 0;
return fileSize < 4 * 1024 * 1024;

@@ -87,0 +87,0 @@ }

{
"name": "@volar/typescript",
"version": "2.4.0-alpha.5",
"version": "2.4.0-alpha.6",
"license": "MIT",

@@ -15,3 +15,3 @@ "files": [

"dependencies": {
"@volar/language-core": "2.4.0-alpha.5",
"@volar/language-core": "2.4.0-alpha.6",
"path-browserify": "^1.0.1",

@@ -23,5 +23,5 @@ "vscode-uri": "^3.0.8"

"@types/path-browserify": "latest",
"@volar/language-service": "2.4.0-alpha.5"
"@volar/language-service": "2.4.0-alpha.6"
},
"gitHead": "bef4f4bf123264f3b0ce3da11adf1e0da387ce6d"
"gitHead": "7e6c0b8fb66d09037b3540bbac2c4d976b1110ce"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc