Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@bluwy/unconfig
Advanced tools
A universal solution for loading configurations.
The goal of this fork is to remove importx
as it brings in a large dependency graph. If you're:
__filename
in ESM, etc)In other words, have a very simple config file, then this fork should help reduce the dependencies needed to install in your project. (Sorry Anthony but I wanted to trim it down for my own projects 😅)
This fork is meant to be used as an override. For example:
{
"overrides": {
"unconfig": "npm:@bluwy/unconfig@^0.6.0"
},
"pnpm": {
"overrides": {
"unconfig": "npm:@bluwy/unconfig@^0.6.0"
}
}
}
DO NOT USE THIS FORK DIRECTLY.
Configuration is hard, especially when you want to build an ecosystem of your tools.
You want your tools to be general and easy to use, you allow your config to be defined in a custom field of package.json
.
You want your tools to be easy to integrate, you allow the configs to be defined in other tools' configurations like vite.config.js
or webpack.config.js
.
You want the configs to be agnostic and probably need to be load by IDE, you create new config files like .myconfigrc
.
You want the configs to also be flexible and dynamic, you make your config files a JavaScript file, like my.config.js
.
Then you want users to be able to use ESM and TypeScript, you also make your config accepting .ts
or .mjs
.
So users' project root end up with a lot of config files like .npmrc
, rollup.config.js
, .eslintrc
, tsconfig.json
, jest.config.js
, postcss.config.js
, nuxt.config.js
, vite.config.cjs
, windi.config.ts
, etc. And each of them use different syntax, in JSON, in CJS, in ESM, in TypeScript, in INI, in TOML...
unconfig
can't solve this fragmentation entirely, but it's trying to make loading them easier for tool authors.
npm i unconfig
For example, to load config for my.config
:
import { loadConfig } from 'unconfig'
const { config, sources } = await loadConfig({
sources: [
// load from `my.config.xx`
{
files: 'my.config',
// default extensions
extensions: ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs', 'json', ''],
},
// load `my` field in `package.json` if no above config files found
{
files: 'package.json',
extensions: [],
rewrite(config) {
return config?.my
},
},
// load inline config from `vite.config`
{
files: 'vite.config',
async rewrite(config) {
const resolved = await (typeof config === 'function' ? config() : config)
return resolved?.my
},
},
// ...
],
// if false, the only the first matched will be loaded
// if true, all matched will be loaded and deep merged
merge: false,
})
unconfig
supports loading ts
, mjs
, js
, json
by default.
MIT License © 2021-PRESENT Anthony Fu
FAQs
A universal solution for loading configurations.
The npm package @bluwy/unconfig receives a total of 0 weekly downloads. As such, @bluwy/unconfig popularity was classified as not popular.
We found that @bluwy/unconfig 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.