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

ts-runtime

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-runtime - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

3

package.json
{
"name": "ts-runtime",
"version": "0.1.6",
"version": "0.1.7",
"description": "Runtime type checks for TypeScript",

@@ -30,2 +30,3 @@ "main": "index.js",

"pretty-time": "^0.2.0",
"regenerator-runtime": "^0.10.5",
"rimraf": "^2.6.1",

@@ -32,0 +33,0 @@ "typescript": "^2.4.0"

@@ -446,2 +446,3 @@ # ts-runtime

- No reflection of mapped types, indexed access types and type operators yet.
- No support for string enums.
- readonly or class visibility modifiers are not asserted.

@@ -448,0 +449,0 @@ - No declaration merging.

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

private scanned;
private identifiers;
private skip;

@@ -26,2 +27,3 @@ private AllowedDeclarations;

getDeclarations(): TsrDeclaration[];
getIdentifiers(sf: ts.SourceFile): Set<string>;
isAllowedDeclarationSymbol(symbol: ts.Symbol): boolean;

@@ -28,0 +30,0 @@ hasDeclarations(symbol: ts.Symbol): boolean;

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

this.scanned = new Set();
this.identifiers = new Map();
this.skip = [

@@ -72,2 +73,5 @@ ts.SyntaxKind.NamedImports,

}
getIdentifiers(sf) {
return this.identifiers.get(this.getAliasedNode(sf));
}
isAllowedDeclarationSymbol(symbol) {

@@ -116,2 +120,9 @@ return symbol && symbol.flags && ((symbol.flags & this.AllowedDeclarations) && !(symbol.flags & this.DisallowedDeclaratins));

scanNode(node) {
if (ts.isIdentifier(node)) {
const sf = node.getSourceFile();
if (!this.identifiers.has(sf)) {
this.identifiers.set(sf, new Set());
}
this.identifiers.get(sf).add(node.text);
}
if (!this.shouldScan(node)) {

@@ -183,3 +194,3 @@ return;

this.scanner.isAllowedDeclarationSymbol(this.symbol) &&
(this.isReference || util.isPartOfTypeNode(this.enclosing));
(util.isPartOfTypeNode(this.enclosing) || (this.isReference && this.enclosing.getSourceFile().isDeclarationFile));
}

@@ -186,0 +197,0 @@ return this._isTsrDeclaration;

@@ -106,11 +106,4 @@ "use strict";

function writeTempFiles(result) {
const printerOptions = {
removeComments: false
};
const printHandlers = {
substituteNode(hint, node) {
return node;
}
};
const printer = ts.createPrinter(printerOptions, printHandlers);
const printHandlers = {};
const printer = ts.createPrinter(undefined, printHandlers);
for (let transformed of result.transformed) {

@@ -144,3 +137,10 @@ const filePath = toTempPath(transformed.fileName);

const location = path.join(outDir, filename);
const printer = ts.createPrinter();
const printHandlers = {
substituteNode(hint, node) {
node.parent = undefined;
node.flags = ts.NodeFlags.Synthesized;
return node;
}
};
const printer = ts.createPrinter(undefined, printHandlers);
let sf = ts.createSourceFile(filename, '', options.compilerOptions.target, true, ts.ScriptKind.TS);

@@ -147,0 +147,0 @@ const expressions = [];

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