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

dts-bundle-generator

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dts-bundle-generator - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

2

bin/dts-bundle-generator.js

@@ -125,3 +125,3 @@ #!/usr/bin/env node

}
else if (args.verbose) { // tslint:disable-line:unnecessary-else
else if (args.verbose) {
logger_1.enableVerbose();

@@ -128,0 +128,0 @@ }

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

var result = true;
if (ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isFunctionDeclaration(statement)) {
if (ts.isClassDeclaration(statement)
|| ts.isEnumDeclaration(statement)
|| ts.isFunctionDeclaration(statement)
|| ts.isVariableStatement(statement)) {
var isStatementFromRootFile = statement.getSourceFile() === rootSourceFile;

@@ -274,3 +277,3 @@ var exportType = typescript_1.getExportTypeForDeclaration(rootFileExports, typeChecker, statement);

}
else if (ts.isVariableStatement(node)) { // tslint:disable-line:unnecessary-else
else if (ts.isVariableStatement(node)) {
return node.declarationList.declarations.some(function (declaration) {

@@ -277,0 +280,0 @@ return isNodeUsed(declaration, rootFileExports, typesUsageEvaluator, typeChecker);

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

}
else if (a.text < b.text) { // tslint:disable-line:unnecessary-else
else if (a.text < b.text) {
return -1;

@@ -96,3 +96,3 @@ }

}
else if (isNodeExported && !shouldNodeBeExported) { // tslint:disable-line:unnecessary-else
else if (isNodeExported && !shouldNodeBeExported) {
return nodeText.slice('export '.length);

@@ -99,0 +99,0 @@ }

@@ -124,6 +124,31 @@ "use strict";

function getExportTypeForDeclaration(exportedSymbols, typeChecker, declaration) {
if (declaration.name === undefined) {
if (ts.isVariableStatement(declaration)) {
if (declaration.declarationList.declarations.length === 0) {
return null;
}
var firstDeclarationExportType_1 = getExportTypeForName(exportedSymbols, typeChecker, declaration.declarationList.declarations[0].name);
var allDeclarationsHaveSameExportType = declaration.declarationList.declarations.every(function (variableDecl) {
// all declaration should have the same export type
// TODO: for now it's not supported to have different type of exports
return getExportTypeForName(exportedSymbols, typeChecker, variableDecl.name) === firstDeclarationExportType_1;
});
if (!allDeclarationsHaveSameExportType) {
// log warn?
return null;
}
return firstDeclarationExportType_1;
}
return getExportTypeForName(exportedSymbols, typeChecker, declaration.name);
}
exports.getExportTypeForDeclaration = getExportTypeForDeclaration;
function getExportTypeForName(exportedSymbols, typeChecker, name) {
if (name === undefined) {
return null;
}
var declarationSymbol = typeChecker.getSymbolAtLocation(declaration.name);
if (ts.isArrayBindingPattern(name) || ts.isObjectBindingPattern(name)) {
// TODO: binding patterns in variable declarations are not supported for now
// see https://github.com/microsoft/TypeScript/issues/30598 also
return null;
}
var declarationSymbol = typeChecker.getSymbolAtLocation(name);
var exportedSymbol = exportedSymbols.find(function (rootExport) { return rootExport.symbol === declarationSymbol; });

@@ -135,2 +160,1 @@ if (exportedSymbol === undefined) {

}
exports.getExportTypeForDeclaration = getExportTypeForDeclaration;

@@ -37,6 +37,6 @@ "use strict";

// print red
console.error("\u001B[31m" + message + "\u001B[0m");
console.error("\u001B[0;31m" + message + "\u001B[0m");
break;
case 2 /* Warning */:
console.warn(message);
console.warn("\u001B[1;33m" + message + "\u001B[0m");
break;

@@ -43,0 +43,0 @@ case 1 /* Normal */:

{
"name": "dts-bundle-generator",
"version": "3.0.0",
"version": "3.1.0",
"description": "DTS Bundle Generator",

@@ -5,0 +5,0 @@ "main": "bundle-generator.js",

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