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

dependency-injection-cat

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-injection-cat - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

typescript-helpers/node-source-descriptor/ExternalExportDeclaration.d.ts

2

package.json
{
"name": "dependency-injection-cat",
"version": "0.0.11",
"version": "0.0.12",
"main": "index.js",

@@ -5,0 +5,0 @@ "types": "index.d.ts",

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

var ExportDeclarationWithoutClauseAndModuleSpecifier_1 = require("./ExportDeclarationWithoutClauseAndModuleSpecifier");
var ExternalExportDeclaration_1 = require("./ExternalExportDeclaration");
//TODO Add support for default imports/exports

@@ -95,2 +96,37 @@ function getNodeSourceDescriptorDeep(sourceFile, nameToFind) {

}
//Trying to find node in external exports
var externalExports = exportDeclarations.filter(ExternalExportDeclaration_1.isExternalExportDeclaration);
var externalNamespaceExport = externalExports.find(function (it) {
if (ts.isNamespaceExport(it.exportClause)) {
return it.exportClause.name.getText() === splittedNameToFind[0];
}
return false;
});
if (externalNamespaceExport !== undefined) {
var modulePath = removeQuotesFromString_1.removeQuotesFromString(externalNamespaceExport.moduleSpecifier.getText());
var resolvedPath = PathResolverCache_1.PathResolverCache.getAbsolutePathWithExtension(sourceFile.fileName, modulePath);
if (!path_1.default.isAbsolute(resolvedPath)) {
throw new Error("\n DI container does not support export * as Something from 'node-module'\n " + externalNamespaceExport.getText() + "\n in " + sourceFile.fileName + "\n ");
}
var newSourceFile = SourceFilesCache_1.SourceFilesCache.getSourceFileByPath(resolvedPath);
return getNodeSourceDescriptorDeep(newSourceFile, splittedNameToFind[1]);
}
var externalNamedExports = externalExports.filter(ExternalExportDeclaration_1.isNamedExternalExportsDeclaration);
var externalExportClauseElements = lodash_1.flatten(externalNamedExports.map(function (it) { return it.exportClause.elements; }));
var externalExportSpecifier = externalExportClauseElements.find(function (it) { return it.name.getText() === splittedNameToFind[0]; });
if (externalExportSpecifier !== undefined) {
var externalExportNameToFind = externalExportSpecifier.propertyName
? tslib_1.__spreadArrays([
externalExportSpecifier.propertyName.getText()
], splittedNameToFind.slice(1)).join('.')
: splittedNameToFind.join('.');
var exportExpression = externalExportSpecifier.parent.parent;
var modulePath = removeQuotesFromString_1.removeQuotesFromString(exportExpression.moduleSpecifier.getText());
var resolvedPath = PathResolverCache_1.PathResolverCache.getAbsolutePathWithExtension(sourceFile.fileName, modulePath);
if (!path_1.default.isAbsolute(resolvedPath)) {
throw new Error("\n DI container does not support export * as Something from 'node-module'\n " + exportExpression.getText() + "\n in " + sourceFile.fileName + "\n ");
}
var newSourceFile = SourceFilesCache_1.SourceFilesCache.getSourceFileByPath(resolvedPath);
return getNodeSourceDescriptorDeep(newSourceFile, externalExportNameToFind);
}
//Trying to find in export * from '' declarations

@@ -103,3 +139,3 @@ var exportAllStatements = exportDeclarations.filter(ExportDeclarationWithoutClauseAndModuleSpecifier_1.isExportDeclarationWithoutClauseAndWithModuleSpecifier);

if (!path_1.default.isAbsolute(resolvedPath)) {
throw new Error("\n DI container does not support \"export * from 'node-module'\n " + it.getText() + "\n in " + sourceFile.fileName + "\n ");
throw new Error("\n DI container does not support export * from 'node-module'\n " + it.getText() + "\n in " + sourceFile.fileName + "\n ");
}

@@ -106,0 +142,0 @@ var newSourceFile = SourceFilesCache_1.SourceFilesCache.getSourceFileByPath(resolvedPath);

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