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.6.0-next.19 to 0.6.0-next.20

lib/common/connection.d.ts

2

lib/args.d.ts

@@ -49,2 +49,4 @@ import * as yargs from 'yargs';

writeln(...data: string[]): void;
flush(): Promise<void>;
close(): Promise<void>;
} | undefined;

@@ -51,0 +53,0 @@ };

@@ -85,2 +85,3 @@ import { lsp, Id, Vertex, E, Edge, Project, Document, HoverResult, ReferenceResult, contains, textDocument_definition, textDocument_references, textDocument_diagnostic, textDocument_hover, item, DiagnosticResult, Range, DeclarationRange, ReferenceRange, DocumentSymbolResult, textDocument_documentSymbol, ReferenceTag, DeclarationTag, UnknownTag, DefinitionResult, ImplementationResult, textDocument_implementation, textDocument_typeDefinition, TypeDefinitionResult, FoldingRangeResult, textDocument_foldingRange, RangeBasedDocumentSymbol, DefinitionTag, DefinitionRange, ResultSet, MetaData, Location, EdgeLabels, Moniker, PackageInformation, moniker, packageInformation, MonikerKind, ItemEdgeProperties, Event, EventKind, EventScope, DeclarationResult, textDocument_declaration, next, UniquenessLevel, Uri, attach, Source, Capabilities } from 'lsif-protocol';

emit(element: Vertex | Edge): void;
flush(): Promise<void>;
}

@@ -0,1 +1,17 @@

export declare class LinkedList<V> {
readonly [Symbol.toStringTag] = "LinkedList";
private _head;
private _tail;
private _size;
private _state;
constructor();
clear(): void;
get size(): number;
get head(): V | undefined;
get tail(): V | undefined;
push(value: V): void;
shift(): V | undefined;
values(): IterableIterator<V>;
private removeItem;
}
export declare const enum Touch {

@@ -2,0 +18,0 @@ None = 0,

@@ -6,8 +6,123 @@ "use strict";

* ------------------------------------------------------------------------------------------ */
var _a;
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LRUCache = exports.LinkedMap = void 0;
exports.LRUCache = exports.LinkedMap = exports.LinkedList = void 0;
class LinkedList {
constructor() {
this[_a] = 'LinkedList';
this._head = undefined;
this._tail = undefined;
this._size = 0;
this._state = 0;
}
clear() {
this._head = undefined;
this._tail = undefined;
this._size = 0;
this._state++;
}
get size() {
return this._size;
}
get head() {
return this._head?.value;
}
get tail() {
return this._tail?.value;
}
push(value) {
const item = { value, previous: undefined, next: undefined };
// First time Insert
if (!this._head && !this._tail) {
this._head = item;
}
else if (!this._tail) {
throw new Error('Invalid list');
}
else {
item.previous = this._tail;
this._tail.next = item;
}
this._tail = item;
this._size++;
this._state++;
}
shift() {
if (!this._head && !this._tail) {
return undefined;
}
if (!this._head || !this._tail) {
throw new Error('Invalid list');
}
const item = this._head;
this.removeItem(item);
this._size--;
return item.value;
}
values() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`Linked List got modified during iteration.`);
}
if (current) {
const result = { value: current.value, done: false };
current = current.next;
return result;
}
else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
removeItem(item) {
if (item === this._head && item === this._tail) {
this._head = undefined;
this._tail = undefined;
}
else if (item === this._head) {
// This can only happened if size === 1 which is handle
// by the case above.
if (!item.next) {
throw new Error('Invalid list');
}
item.next.previous = undefined;
this._head = item.next;
}
else if (item === this._tail) {
// This can only happened if size === 1 which is handle
// by the case above.
if (!item.previous) {
throw new Error('Invalid list');
}
item.previous.next = undefined;
this._tail = item.previous;
}
else {
const next = item.next;
const previous = item.previous;
if (!next || !previous) {
throw new Error('Invalid list');
}
next.previous = previous;
previous.next = next;
}
item.next = undefined;
item.previous = undefined;
this._state++;
}
}
exports.LinkedList = LinkedList;
_a = Symbol.toStringTag;
class LinkedMap {
constructor() {
this[_a] = 'LinkedMap';
this[_b] = 'LinkedMap';
this._map = new Map();

@@ -194,3 +309,3 @@ this._head = undefined;

}
[(_a = Symbol.toStringTag, Symbol.iterator)]() {
[(_b = Symbol.toStringTag, Symbol.iterator)]() {
return this.entries();

@@ -197,0 +312,0 @@ }

@@ -5,2 +5,4 @@ export interface Writer {

writeln(...data: string[]): void;
flush(): Promise<void>;
close(): Promise<void>;
}

@@ -12,10 +14,19 @@ export declare class StdoutWriter implements Writer {

writeln(...data: string[]): void;
flush(): Promise<void>;
close(): Promise<void>;
}
export declare class FileWriter implements Writer {
private fd;
constructor(fd: number);
private static BufferSize;
private worker;
private connection;
private buffer;
private bytesAdded;
constructor(fileName: string);
write(...data: string[]): void;
writeEOL(): void;
writeln(...data: string[]): void;
flush(): Promise<void>;
close(): Promise<void>;
private writeBuffer;
private sendBuffer;
}

@@ -9,3 +9,5 @@ "use strict";

const os = require("os");
const fs_1 = require("fs");
const path = require("path");
const worker_threads_1 = require("worker_threads");
const connection_1 = require("./connection");
const __stdout = process.stdout;

@@ -30,7 +32,19 @@ const __eol = os.EOL;

}
flush() {
return Promise.resolve();
}
close() {
return Promise.resolve();
}
}
exports.StdoutWriter = StdoutWriter;
class FileWriter {
constructor(fd) {
this.fd = fd;
constructor(fileName) {
this.worker = new worker_threads_1.Worker(path.join(__dirname, './writerWorker.js'));
this.worker.terminate;
this.connection = new connection_1.Connection(this.worker);
this.connection.listen();
this.connection.sendNotification('open', { fileName });
this.buffer = Buffer.alloc(FileWriter.BufferSize);
this.bytesAdded = 0;
}

@@ -58,10 +72,45 @@ write(...data) {

}
writeBuffer(buffer) {
let offset = 0;
while (offset < buffer.length) {
offset += (0, fs_1.writeSync)(this.fd, buffer, offset);
async flush() {
await this.connection.sendRequest('flush');
}
async close() {
this.sendBuffer(true);
await this.connection.sendRequest('close');
this.worker.terminate();
}
writeBuffer(chunk) {
if (this.buffer === undefined) {
throw new Error('Should never happen');
}
if (chunk.length > FileWriter.BufferSize) {
this.sendBuffer();
this.connection.sendNotification('write', { data: chunk.buffer, length: chunk.length }, chunk.buffer);
}
else if (this.bytesAdded + chunk.length < FileWriter.BufferSize) {
chunk.copy(this.buffer, this.bytesAdded);
this.bytesAdded += chunk.length;
}
else {
this.sendBuffer();
chunk.copy(this.buffer, this.bytesAdded);
this.bytesAdded += chunk.length;
}
}
sendBuffer(end = false) {
if (this.bytesAdded === 0 || this.buffer === undefined) {
return;
}
this.connection.sendNotification('write', { data: this.buffer.buffer, length: this.bytesAdded });
if (!end) {
this.buffer = Buffer.alloc(FileWriter.BufferSize);
this.bytesAdded = 0;
}
else {
this.buffer = undefined;
this.bytesAdded = 0;
}
}
}
exports.FileWriter = FileWriter;
FileWriter.BufferSize = 65536;
//# sourceMappingURL=writer.js.map

3

lib/emitters/emitter.d.ts

@@ -6,3 +6,4 @@ import { Vertex, Edge, Id } from 'lsif-protocol';

emit(element: Vertex | Edge): void;
end(): void;
flush(): Promise<void>;
end(): Promise<void>;
}

@@ -9,0 +10,0 @@ export interface Create {

@@ -246,2 +246,5 @@ "use strict";

},
flush: () => {
return writer.flush();
},
end: () => {

@@ -251,2 +254,3 @@ for (let vertex of vertices.values()) {

}
return writer.close();
}

@@ -253,0 +257,0 @@ };

@@ -17,2 +17,5 @@ "use strict";

},
flush: () => {
return writer.flush();
},
end: () => {

@@ -23,2 +26,3 @@ if (!isFirst) {

writer.writeln(']');
return writer.close();
}

@@ -25,0 +29,0 @@ };

@@ -10,3 +10,4 @@ "use strict";

},
end: () => { }
flush: () => { return writer.flush(); },
end: () => { return writer.close(); }
};

@@ -13,0 +14,0 @@ };

@@ -86,4 +86,8 @@ "use strict";

},
flush: () => {
return writer.flush();
},
end: () => {
writer.write(JSON.stringify(data, undefined, 4));
return writer.close();
}

@@ -90,0 +94,0 @@ };

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

abstract endPartition(shard: Shard): void;
abstract endPartitions(shards: Set<Shard>): void;
abstract endPartitions(shards: Set<Shard['id']>): void;
abstract end(forceSingle?: boolean): void;

@@ -288,3 +288,3 @@ }

manageSymbolData(symbolData: SymbolData): void;
getDocuments(): Set<Document>;
getDocumentShardIds(): Set<Shard['id']>;
begin(): void;

@@ -294,5 +294,5 @@ getProjectData(): ProjectData;

createSymbolData(_symbolId: SymbolId, create: (projectDataManager: ProjectDataManager) => FactoryResult): FactoryResult;
endPartitions(documents: Set<Document>): void;
endPartitions(shardIds: Set<Shard['id']>): void;
abstract end(): void;
protected doEnd(documents: Set<Document> | undefined): void;
protected doEnd(shardIds: Set<Shard['id']> | undefined): void;
protected getName(): string;

@@ -390,2 +390,3 @@ }

emit(element: Vertex | Edge): void;
flush(): Promise<void>;
begin(): void;

@@ -427,3 +428,3 @@ beginProject(tsProject: TSProject, project: Project): void;

}
export declare function lsif(emitter: EmitterContext, languageService: ts.LanguageService, dataManager: DataManager, importMonikers: ImportMonikers, exportMonikers: ExportMonikers | undefined, dependsOn: ProjectInfo[], options: Options): ProjectInfo | number;
export declare function lsif(emitter: EmitterContext, languageService: ts.LanguageService, dataManager: DataManager, importMonikers: ImportMonikers, exportMonikers: ExportMonikers | undefined, dependsOn: ProjectInfo[], options: Options): Promise<ProjectInfo | number>;
export {};

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

};
const result = (0, lsif_1.lsif)(emitter, languageService, dataManager, importMonikers, exportMonikers, dependsOn, lsifOptions);
const result = await (0, lsif_1.lsif)(emitter, languageService, dataManager, importMonikers, exportMonikers, dependsOn, lsifOptions);
if (typeof result !== 'number') {

@@ -491,3 +491,3 @@ options.processed.set(key, result);

else if (options.out) {
writer = new writer_1.FileWriter(fs.openSync(options.out, 'w'));
writer = new writer_1.FileWriter(options.out);
}

@@ -562,2 +562,5 @@ }

emitter.emit(element);
},
flush() {
return emitter.flush();
}

@@ -664,3 +667,3 @@ };

dataManager.end();
emitter.end();
await emitter.end();
logger.end();

@@ -667,0 +670,0 @@ }

{
"name": "lsif-tsc",
"description": "Tool to create an LSIF dump for TypeScript projects.",
"version": "0.6.0-next.19",
"version": "0.6.0-next.20",
"author": "Microsoft Corporation",

@@ -6,0 +6,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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