Socket
Socket
Sign inDemoInstall

pure-index

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pure-index - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

40

bin/fileTraversal/processBatch/traversal.js
import { parse } from '@babel/parser'
import walk from 'babel-walk'

@@ -26,28 +25,31 @@ import { readFile } from '../../utils/index.js'

const visitors = {
ImportDeclaration(node) {
if (node.source.value === pkg.name) {
for (const specifier of node.specifiers) {
const type = specifier.type
for (const node of ast.program.body) {
if (node.type === 'ImportDeclaration' && node.source.value === pkg.name) {
for (const specifier of node.specifiers) {
const type = specifier.type
if (type === 'ImportSpecifier' || type === 'ImportDefaultSpecifier') {
cmd(specifier.imported?.name)
} else if (type === 'ImportNamespaceSpecifier') {
cmd('* as ' + specifier.local.name)
}
if (type === 'ImportSpecifier' || type === 'ImportDefaultSpecifier') {
cmd(specifier.imported?.name)
} else if (type === 'ImportNamespaceSpecifier') {
cmd('* as ' + specifier.local.name)
}
}
},
ExportNamedDeclaration(node) {
if (node.source && node.source.value === pkg.name) {
for (const specifier of node.specifiers) {
cmd(specifier.exported.name)
}
continue
}
if (
node.type === 'ExportNamedDeclaration' &&
node.source &&
node.source.value === pkg.name
) {
for (const specifier of node.specifiers) {
cmd(specifier.exported.name)
}
continue
}
}
walk.ancestor(visitors)(ast)
}
export { traversal }
import { join } from 'node:path'
import parser from '@babel/parser'
import walk from 'babel-walk'

@@ -29,4 +28,4 @@ import { readFile, ObservableSet } from './utils/index.js'

const visitors = {
ExportNamedDeclaration(node) {
for (const node of ast.program.body) {
if (node.type === 'ExportNamedDeclaration') {
if (node.declaration) {

@@ -47,7 +46,6 @@ const declaration = node.declaration

}
continue
}
}
walk.ancestor(visitors)(ast)
return result

@@ -54,0 +52,0 @@ }

{
"name": "pure-index",
"type": "module",
"version": "0.0.24",
"version": "0.0.25",
"description": "Utility for monorepos. It helps to find unused exports from packages.",

@@ -15,3 +15,2 @@ "main": "./bin/index.js",

"@babel/parser": "7.23.6",
"babel-walk": "3.0.0",
"fdir": "6.1.1",

@@ -21,3 +20,3 @@ "lilconfig": "3.0.0",

"nanospinner": "1.1.0",
"picomatch": "^3.0.1"
"picomatch": "3.0.1"
},

@@ -24,0 +23,0 @@ "engines": {

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