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

lsif-tsc

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lsif-tsc - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

2

lib/lsif.d.ts

@@ -115,3 +115,3 @@ import * as ts from 'typescript';

}
export declare function lsif(languageService: ts.LanguageService, options: Options, dependsOn: ProjectInfo[], emitter: Emitter, idGenerator: () => Id, tsConfigFile: string | undefined): ProjectInfo;
export declare function lsif(languageService: ts.LanguageService, options: Options, dependsOn: ProjectInfo[], emitter: Emitter, idGenerator: () => Id, tsConfigFile: string | undefined): ProjectInfo | undefined;
export {};

@@ -840,19 +840,20 @@ "use strict";

getDeclarationNodes(symbol, location) {
if (location === undefined) {
throw new Error(`Transient resolver needs declaration node`);
if (this.isUnionOrIntersection(symbol, location)) {
return [location];
}
return [location];
else {
return super.getDeclarationNodes(symbol, location);
}
}
getSourceFiles(symbol, location) {
if (location === undefined) {
throw new Error(`Transient resolver needs declaration node`);
if (this.isUnionOrIntersection(symbol, location)) {
return [location.getSourceFile()];
}
return [location.getSourceFile()];
else {
return super.getSourceFiles(symbol, location);
}
}
resolve(sourceFile, id, symbol, location, scope) {
if (location === undefined) {
throw new Error(`Transient resolver needs declaration node`);
}
let type = this.typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (type.isUnionOrIntersection() && type.types.length > 0) {
let type = this.getUnionOrIntersectionType(symbol, location);
if (type !== undefined && type.types.length > 0) {
let datas = [];

@@ -872,2 +873,16 @@ for (let typeElem of type.types) {

}
isUnionOrIntersection(symbol, location) {
if (location === undefined) {
return false;
}
let type = this.typeChecker.getTypeOfSymbolAtLocation(symbol, location);
return type.isUnionOrIntersection();
}
getUnionOrIntersectionType(symbol, location) {
if (location === undefined) {
return undefined;
}
let type = this.typeChecker.getTypeOfSymbolAtLocation(symbol, location);
return type.isUnionOrIntersection() ? type : undefined;
}
}

@@ -981,3 +996,2 @@ class DataManager {

this.recordDocumentSymbol = [];
this.externalLibraryImports = new Map();
this.dependentOutDirs = [];

@@ -995,5 +1009,2 @@ for (let info of dependsOn) {

let compilerOptions = this.program.getCompilerOptions();
if (compilerOptions.outDir !== undefined) {
this.outDir = tss.makeAbsolute(compilerOptions.outDir, configLocation);
}
if (compilerOptions.rootDir !== undefined) {

@@ -1003,4 +1014,10 @@ this.rootDir = tss.makeAbsolute(compilerOptions.rootDir, configLocation);

else {
// Try to compute the root directories.
this.rootDir = tss.Program.getCommonSourceDirectory(this.program);
}
if (compilerOptions.outDir !== undefined) {
this.outDir = tss.makeAbsolute(compilerOptions.outDir, configLocation);
}
else {
this.outDir = this.rootDir;
}
this.dataManager = new DataManager(this, this.project);

@@ -1015,19 +1032,3 @@ this.symbols = new Symbols(this.typeChecker);

visitProgram() {
// Make a first pass to collect all know external libray imports
for (let sourceFile of this.program.getSourceFiles()) {
let resolvedModules = tss.getResolvedModules(sourceFile);
if (resolvedModules !== undefined) {
resolvedModules.forEach((resolvedModule) => {
if (resolvedModule === undefined) {
return;
}
if (resolvedModule.isExternalLibraryImport === true) {
if (!this.externalLibraryImports.has(resolvedModule.resolvedFileName)) {
this.externalLibraryImports.set(resolvedModule.resolvedFileName, resolvedModule);
}
}
});
}
}
for (let sourceFile of this.program.getSourceFiles()) {
// let start = Date.now();

@@ -1149,22 +1150,4 @@ this.visit(sourceFile);

isFullContentIgnored(sourceFile) {
if (sourceFile.isDeclarationFile) {
return true;
}
let fileName = sourceFile.fileName;
if (path.basename(fileName) === 'index.js') {
return false;
}
if (path.extname(fileName) !== '.js') {
return false;
}
let dirName;
let parent = path.dirname(fileName);
do {
dirName = parent;
if (path.basename(dirName) === 'node_modules') {
return true;
}
parent = path.dirname(dirName);
} while (parent !== dirName);
return false;
return tss.Program.isSourceFileDefaultLibrary(this.program, sourceFile) ||
tss.Program.isSourceFileFromExternalLibrary(this.program, sourceFile);
}

@@ -1310,6 +1293,5 @@ visitModuleDeclaration(node) {

let document = this.vertex.document(sourceFile.fileName, sourceFile.text);
let resolvedModule = this.externalLibraryImports.get(sourceFile.fileName);
let monikerPath;
let library = false;
if (resolvedModule !== undefined) {
if (tss.Program.isSourceFileFromExternalLibrary(this.program, sourceFile)) {
library = true;

@@ -1316,0 +1298,0 @@ monikerPath = tss.computeMonikerPath(this.projectRoot, sourceFile.fileName);

@@ -43,1 +43,6 @@ import * as ts from 'typescript';

export declare const EmitBoundaries: Set<number>;
export declare namespace Program {
function getCommonSourceDirectory(program: ts.Program): string;
function isSourceFileFromExternalLibrary(program: ts.Program, sourceFile: ts.SourceFile): boolean;
function isSourceFileDefaultLibrary(program: ts.Program, sourceFile: ts.SourceFile): boolean;
}

@@ -319,2 +319,29 @@ /* --------------------------------------------------------------------------------------------

]);
var Program;
(function (Program) {
function getCommonSourceDirectory(program) {
let interal = program;
if (typeof interal.getCommonSourceDirectory !== 'function') {
throw new Error(`Program is missing getCommonSourceDirectory`);
}
return interal.getCommonSourceDirectory();
}
Program.getCommonSourceDirectory = getCommonSourceDirectory;
function isSourceFileFromExternalLibrary(program, sourceFile) {
let interal = program;
if (typeof interal.isSourceFileFromExternalLibrary !== 'function') {
throw new Error(`Program is missing isSourceFileFromExternalLibrary`);
}
return interal.isSourceFileFromExternalLibrary(sourceFile);
}
Program.isSourceFileFromExternalLibrary = isSourceFileFromExternalLibrary;
function isSourceFileDefaultLibrary(program, sourceFile) {
let interal = program;
if (typeof interal.isSourceFileFromExternalLibrary !== 'function') {
throw new Error(`Program is missing isSourceFileDefaultLibrary`);
}
return interal.isSourceFileDefaultLibrary(sourceFile);
}
Program.isSourceFileDefaultLibrary = isSourceFileDefaultLibrary;
})(Program = exports.Program || (exports.Program = {}));
//# sourceMappingURL=typescripts.js.map
{
"name": "lsif-tsc",
"description": "Tool to create an LSIF dump for TypeScript projects.",
"version": "0.4.1",
"version": "0.4.2",
"author": "Microsoft Corporation",

@@ -29,3 +29,2 @@ "license": "MIT",

"@types/minimist": "^1.2.0",
"@types/node": "^10.14.3",
"@types/uuid": "^3.4.4",

@@ -32,0 +31,0 @@ "@types/npm": "^2.0.30"

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