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 1.2.2 to 1.3.0

2

bin/dts-bundle-generator.js

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

'Used types will be imported by "import { First, Second } from \'library-name\';".\n' +
'By default all libraries will be imported (except inlined)',
'By default all libraries will be imported (except inlined and libraries from @types)',
coerce: toStringsArray,

@@ -54,0 +54,0 @@ })

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

var prevStatementsCount = collectionResult.statements.length;
updateResult(__assign({}, updateResultCommonParams, { currentModule: module_info_1.getModuleInfo(sourceFile.fileName, criteria), statements: sourceFile.statements }), collectionResult);
var updateFn = sourceFile === rootSourceFile ? updateResultForRootSourceFile : updateResult;
updateFn(__assign({}, updateResultCommonParams, { currentModule: module_info_1.getModuleInfo(sourceFile.fileName, criteria), statements: sourceFile.statements }), collectionResult);
if (collectionResult.statements.length === prevStatementsCount) {

@@ -84,9 +85,2 @@ logger_1.verboseLog("No output for file: " + sourceFile.fileName);

}
for (var _a = 0, _b = rootSourceFile.statements; _a < _b.length; _a++) {
var statement = _b[_a];
// add skipped by `updateResult` `export default` from root file if present
if (ts.isExportAssignment(statement) && !statement.isExportEquals) {
collectionResult.statements.push(statement);
}
}
return generate_output_1.generateOutput(__assign({}, collectionResult, { needStripDefaultKeywordForStatement: function (statement) { return statement.getSourceFile() !== rootSourceFile; }, shouldStatementHasExportKeyword: function (statement) {

@@ -102,3 +96,3 @@ var result = true;

}
else if (typescript_helpers_1.isDeclareGlobalStatement(statement)) {
else if (typescript_helpers_1.isDeclareGlobalStatement(statement) || ts.isExportDeclaration(statement)) {
result = false;

@@ -158,2 +152,21 @@ }

}
function updateResultForRootSourceFile(params, result) {
function isReExportFromImportableModule(statement) {
if (!ts.isExportDeclaration(statement) || statement.moduleSpecifier === undefined || !ts.isStringLiteral(statement.moduleSpecifier)) {
return false;
}
var moduleFileName = resolveModuleFileName(statement.getSourceFile().fileName, statement.moduleSpecifier.text);
return params.getModuleInfo(moduleFileName).type === 2 /* ShouldBeImported */;
}
updateResult(params, result);
// add skipped by `updateResult` exports
for (var _i = 0, _a = params.statements; _i < _a.length; _i++) {
var statement = _a[_i];
var isExportDefault = ts.isExportAssignment(statement) && !statement.isExportEquals;
var isReExportFromImportable = isReExportFromImportableModule(statement);
if (isExportDefault || isReExportFromImportable) {
result.statements.push(statement);
}
}
}
function updateResultForImportedEqExportAssignment(exportAssignment, params, result) {

@@ -160,0 +173,0 @@ var moduleDeclarations = params.getDeclarationsForExportedAssignment(exportAssignment)

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

if (shouldLibraryBeImported(npmLibraryName, typesLibraryName, criteria.importedLibraries)) {
return { type: 2 /* ShouldBeImported */, fileName: originalFileName, libraryName: npmLibraryName, isExternal: true };
return { type: 2 /* ShouldBeImported */, fileName: originalFileName, libraryName: typesLibraryName || npmLibraryName, isExternal: true };
}

@@ -41,0 +41,0 @@ if (typesLibraryName !== null && isLibraryAllowed(typesLibraryName, criteria.allowedTypesLibraries)) {

{
"name": "dts-bundle-generator",
"version": "1.2.2",
"version": "1.3.0",
"description": "DTS Bundle Generator",

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

@@ -76,3 +76,3 @@ [![npm version](https://badge.fury.io/js/dts-bundle-generator.svg)](https://badge.fury.io/js/dts-bundle-generator) [![Build Status](https://travis-ci.org/timocov/dts-bundle-generator.svg?branch=master)](https://travis-ci.org/timocov/dts-bundle-generator)

By default all libraries will be imported (except
inlined) [array]
inlined and libraries from @types) [array]
--external-types Array of the package names from @types to import

@@ -79,0 +79,0 @@ typings from it via triple-slash reference directive.

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