pure-index
Advanced tools
Comparing version 0.0.24 to 0.0.25
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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
22292
487
- Removedbabel-walk@3.0.0
- Removed@babel/helper-string-parser@7.24.8(transitive)
- Removed@babel/helper-validator-identifier@7.24.7(transitive)
- Removed@babel/types@7.25.6(transitive)
- Removedbabel-walk@3.0.0(transitive)
- Removedto-fast-properties@2.0.0(transitive)
Updatedpicomatch@3.0.1