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.23 to 0.0.24

bin/fileTraversal/getFiles.js

21

bin/fileTraversal/index.js

@@ -1,10 +0,4 @@

import { execSync } from 'node:child_process'
import { join } from 'node:path'
import fg from 'fast-glob'
import { processBatch } from './processBatch/index.js'
import { getFiles } from './getFiles.js'
const getRepoRoot = () =>
execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim()
/**

@@ -29,15 +23,8 @@ * @param {{

const fileTraversal = async ({ config, pkg, cmd }) => {
const files = await getFiles({ config, pkg })
const tokens = [`from '${pkg.name}'`, `from "${pkg.name}"`]
const repoRoot = getRepoRoot()
const source = join(repoRoot, '**', '*.{ts,tsx}')
const ignore = [
...[...config.exclude].map(x => join('**', x, '**')),
pkg.path ? join(pkg.path, '**') : ''
]
let batch = []
for await (const entry of fg.stream(source, { ignore })) {
batch.push(entry)
for (const file of files) {
batch.push(file)

@@ -44,0 +31,0 @@ if (batch.length >= config.batch.default) {

@@ -17,2 +17,3 @@ import { join } from 'node:path'

--entry, -e path to the package index file. relative to the package directory
--collect-usages, -u outputs a list of all unique uses of the package
`,

@@ -19,0 +20,0 @@ {

@@ -14,3 +14,5 @@ import cp from 'node:child_process'

return promisify(cp.exec)(`${params.cmd} --prefix ${prefix}`)
return promisify(cp.exec)(
`${params.cmd} ${params.noPrefix ? '' : `--prefix ${prefix}`}`
)
}
{
"name": "pure-index",
"type": "module",
"version": "0.0.23",
"version": "0.0.24",
"description": "Utility for monorepos. It helps to find unused exports from packages.",

@@ -16,6 +16,7 @@ "main": "./bin/index.js",

"babel-walk": "3.0.0",
"fast-glob": "3.3.2",
"fdir": "6.1.1",
"lilconfig": "3.0.0",
"meow": "13.0.0",
"nanospinner": "1.1.0"
"nanospinner": "1.1.0",
"picomatch": "^3.0.1"
},

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

# 🌿 Pure Index
Pure Index is utility for monorepos. It helps to find unused exports from packages.
Pure Index is utility for monorepos. It helps to find unused exports from packages or get a list of all unique uses of any package.

@@ -104,4 +104,6 @@ ## Motivation

- `--entry, -e` — sets specific value for _entry_
### `--entry, -e`
Sets specific value for _entry_
```diff

@@ -116,2 +118,16 @@ "scripts": {

### `--collect-usages, -u`
Outputs a list of all unique uses of the package.
```sh
npx pure-index --collect-usages my-package
npx pure-index -u my-package
npx pure-index --collect-usages react-spring
npx pure-index -u react-spring
```
Useful if the package index file contains `export *` syntax. Or to search for all uses of an external package. [More info](#export-)
## Tips

@@ -140,1 +156,7 @@

3. there is an instant exit with success as soon as the size of _exports Set_ is equal to zero
## Limitations
### export \*
Pure Index when getting a list of exports does not parse `export *` to find out what is exported from there. For projects with this syntax, it may result in an inability to use the library. But Pure Index can help with replacing `export *`. Just run it with the [--collect-usages flag](#--collect-usages--u) and replace `export *` with named exports.
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