![pnpm 9.5 Introduces Catalogs: Shareable Dependency Version Specifiers](https://cdn.sanity.io/images/cgdhsj6q/production/c06a5b74512bcc6da29d38cef96a454fa947810d-1024x1024.webp?w=400&fit=max&auto=format)
Security News
pnpm 9.5 Introduces Catalogs: Shareable Dependency Version Specifiers
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
path-minifier
Advanced tools
Readme
🔥 Minify the path list while preserving semantics
This is a utility to reduce the number of characters in a path listing while maintaining the semantics of the directory structure and file names. It was created primarily to reduce the number of tokens used when passing directory information to LLM (e.g. ChatGPT, GPT-4).
npm i path-minifier
Returns a string
list of paths with reduced size by passing the list of paths as a string[]
.
import { minify } from 'path-minifier'
const minified = minify([
'README.md',
'package.json',
'src/index.js',
'src/lib.js'
// ...
])
By default, the output automatically selects the format with the least number of characters.
This behavior can be overridden with the options
argument.
const minified = minify(
[
// ...
],
{
/** 'object' | 'json' | 'indented-list' | 'auto'(default) */
format: 'json'
}
)
Output as a JS object.
Single files are output as strings, multiple files as arrays, and directories as objects.
Can be used to convert to any string format using JSON.stringify
or similar.
const obj = [
'README.md',
'package.json',
{
src: ['index.js', '...']
}
]
Outputs object
as an unformatted JSON string.
The larger the size of the directory, the more characters it tends to reduce.
["README.md", "package.json", { "src": ["index.js", "..."] }]
Output as indented-list
Outputs the directory structure as a list of indented filenames without escaping.
Provides smaller output size for small directories and irregular nested structures.
Indentation is done with \t
.
README.md
package.json
src
index.js
...
Automatically selects the output with the fewest number of haracters and returns the value as a string.
[!IMPORTANT] The
auto
option selects the output format based on the length of the string, which may not be proportional to the length of the LLM token. See the interactive demo for a description of this behavior.
FAQs
Unknown package
We found that path-minifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 9.5 introduces a Catalogs feature, enabling shareable dependency version specifiers, reducing merge conflicts and improving support for monorepos.
Security News
A threat actor on BreachForums is selling an unverified npm vulnerability for account takeover, but npm has not officially confirmed the existence of this security concern.
Security News
Cyber insurance rates are dropping as the market matures, according to a new report projecting global premiums to reach $43 billion by 2030, driven by international market uptake and growth in the SME sector.