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

parse-imports-ts

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-imports-ts - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

21

dist/cjs/parse.js

@@ -51,2 +51,20 @@ "use strict";

}
function parseTsNamedImports(importClause) {
var type = types_1.ImportedPackageType.TypeImport;
typescript_1.default.forEachChild(importClause, function (child) {
if (typescript_1.default.isImportSpecifier(child) && !child.isTypeOnly) {
type = types_1.ImportedPackageType.NormalImport;
}
});
return type;
}
function parseTsImportClause(importClause) {
var type = types_1.ImportedPackageType.NormalImport;
typescript_1.default.forEachChild(importClause, function (child) {
if (typescript_1.default.isNamedImports(child)) {
type = parseTsNamedImports(child);
}
});
return type;
}
function parseTsImportDeclaration(importDeclaration) {

@@ -60,2 +78,5 @@ var result = [];

}
else {
type = parseTsImportClause(child);
}
}

@@ -62,0 +83,0 @@ if (typescript_1.default.isStringLiteral(child)) {

2

dist/cjs/types.js

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

ImportedPackageType[ImportedPackageType["TypeImport"] = 1] = "TypeImport";
})(ImportedPackageType = exports.ImportedPackageType || (exports.ImportedPackageType = {}));
})(ImportedPackageType || (exports.ImportedPackageType = ImportedPackageType = {}));
//# sourceMappingURL=types.js.map

@@ -45,2 +45,20 @@ var __read = (this && this.__read) || function (o, n) {

}
function parseTsNamedImports(importClause) {
var type = ImportedPackageType.TypeImport;
ts.forEachChild(importClause, function (child) {
if (ts.isImportSpecifier(child) && !child.isTypeOnly) {
type = ImportedPackageType.NormalImport;
}
});
return type;
}
function parseTsImportClause(importClause) {
var type = ImportedPackageType.NormalImport;
ts.forEachChild(importClause, function (child) {
if (ts.isNamedImports(child)) {
type = parseTsNamedImports(child);
}
});
return type;
}
function parseTsImportDeclaration(importDeclaration) {

@@ -54,2 +72,5 @@ var result = [];

}
else {
type = parseTsImportClause(child);
}
}

@@ -56,0 +77,0 @@ if (ts.isStringLiteral(child)) {

@@ -5,3 +5,3 @@ export declare enum ImportedPackageType {

}
export declare type ImportedPackage = {
export type ImportedPackage = {
name: string;

@@ -8,0 +8,0 @@ type: ImportedPackageType;

{
"name": "parse-imports-ts",
"version": "1.0.3",
"version": "1.0.4",
"repository": {

@@ -41,7 +41,7 @@ "type": "git",

"ts-node": "^10.7.0",
"typescript": "^4.5.5"
"typescript": "^5.3.3"
},
"peerDependencies": {
"typescript": "^4.5.5"
"typescript": "^5"
}
}

@@ -24,2 +24,26 @@ /* eslint-disable @typescript-eslint/no-use-before-define */

function parseTsNamedImports(
importClause: ts.Node,
): ImportedPackageType {
let type = ImportedPackageType.TypeImport;
ts.forEachChild(importClause, (child: ts.Node) => {
if (ts.isImportSpecifier(child) && !child.isTypeOnly) {
type = ImportedPackageType.NormalImport;
}
});
return type;
}
function parseTsImportClause(
importClause: ts.Node,
): ImportedPackageType {
let type = ImportedPackageType.NormalImport;
ts.forEachChild(importClause, (child: ts.Node) => {
if (ts.isNamedImports(child)) {
type = parseTsNamedImports(child);
}
});
return type;
}
function parseTsImportDeclaration(

@@ -34,2 +58,4 @@ importDeclaration: ts.Node,

type = ImportedPackageType.TypeImport;
} else {
type = parseTsImportClause(child);
}

@@ -36,0 +62,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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