🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

quicktype-typescript-input

Package Overview
Dependencies
Maintainers
2
Versions
301
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quicktype-typescript-input - npm Package Compare versions

Comparing version

to
0.0.19

3

dist/index.d.ts
import { JSONSchemaSourceData } from "quicktype-core";
export declare function schemaForTypeScriptSources(sourceFileNames: string[]): JSONSchemaSourceData;
export declare function schemaForTypeScriptSources(sources: {
[fileName: string]: string;
}): JSONSchemaSourceData;

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

const quicktype_core_1 = require("quicktype-core");
const EncodedDefaultTypeScriptLibrary_1 = require("./EncodedDefaultTypeScriptLibrary");
const settings = {

@@ -20,68 +19,9 @@ required: true,

strictNullChecks: true,
typeRoots: []
typeRoots: [],
rootDir: "."
};
const libFileName = "lib.d.ts";
let libSource = undefined;
function getLibSource() {
if (libSource === undefined) {
libSource = quicktype_core_1.inflateBase64(EncodedDefaultTypeScriptLibrary_1.encodedDefaultTypeScriptLibrary);
}
return libSource;
}
class CompilerHost {
constructor(_options, _sources) {
this._sources = _sources;
}
fileExists(fileName) {
if (fileName === libFileName)
return true;
return Object.prototype.hasOwnProperty.call(this._sources, fileName);
}
readFile(fileName) {
if (fileName === libFileName) {
return getLibSource();
}
return this._sources[fileName];
}
getSourceFile(fileName, languageVersion, _onError, _shouldCreateNewSourceFile) {
const sourceText = this.readFile(fileName);
return sourceText !== undefined ? ts.createSourceFile(fileName, sourceText, languageVersion) : undefined;
}
getDefaultLibFileName(_options) {
return libFileName;
}
writeFile(fileName) {
return quicktype_core_1.panic(`writeFile should not be called by the TypeScript compiler. Filename ${fileName}`);
}
getCurrentDirectory() {
return ".";
}
getDirectories(_path) {
return [];
}
getCanonicalFileName(fileName) {
if (this.useCaseSensitiveFileNames()) {
return fileName.toLowerCase();
}
return fileName;
}
useCaseSensitiveFileNames() {
return false;
}
getNewLine() {
return "\n";
}
}
function schemaForTypeScriptSources(sources) {
let fileNames;
let host;
if (Array.isArray(sources)) {
fileNames = sources;
host = ts.createCompilerHost(compilerOptions);
}
else {
fileNames = Object.getOwnPropertyNames(sources);
host = new CompilerHost(compilerOptions, sources);
}
const program = ts.createProgram(fileNames, compilerOptions, host);
// FIXME: We're stringifying and then parsing this schema again. Just pass around
// the schema directly.
function schemaForTypeScriptSources(sourceFileNames) {
const program = ts.createProgram(sourceFileNames, compilerOptions);
const diagnostics = ts.getPreEmitDiagnostics(program);

@@ -88,0 +28,0 @@ const error = diagnostics.find(d => d.category === ts.DiagnosticCategory.Error);

6

package.json
{
"name": "quicktype-typescript-input",
"version": "0.0.18",
"version": "0.0.19",
"description": "Package for using TypeScript as an input language to quicktype",

@@ -16,3 +16,3 @@ "license": "Apache-2.0",

"dependencies": {
"quicktype-core": "^6.1.8",
"quicktype-core": "^6.1.9",
"typescript": "~3.2.1",

@@ -29,4 +29,4 @@ "@mark.probst/typescript-json-schema": "~0.32.0"

"config": {
"commit": "4523ba79ed0103e4d456538e6651451422c30977"
"commit": "8d72dcdda02e81cdfcb77107e1607180f5a8f719"
}
}