New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unconfig

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unconfig - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

36

package.json
{
"name": "unconfig",
"version": "0.2.2",
"version": "0.3.0",
"description": "A universal solution for loading configurations.",

@@ -39,21 +39,18 @@ "keywords": [

],
"dependencies": {
"@antfu/utils": "^0.5.0",
"defu": "^5.0.1",
"jiti": "^1.12.15",
"vitest": "^0.2.7"
},
"devDependencies": {
"@antfu/eslint-config": "^0.11.1",
"@antfu/ni": "^0.11.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.10",
"@antfu/eslint-config": "^0.16.1",
"@antfu/ni": "^0.12.0",
"@types/node": "^17.0.15",
"bumpp": "^7.1.1",
"eslint": "^8.3.0",
"eslint-plugin-jest": "^25.3.0",
"esno": "^0.12.1",
"jest": "^27.3.1",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2",
"unbuild": "^0.5.13"
"eslint": "^8.8.0",
"esno": "^0.14.0",
"typescript": "^4.5.5",
"unbuild": "^0.6.9"
},
"dependencies": {
"@antfu/utils": "^0.3.0",
"defu": "^5.0.0",
"jiti": "^1.12.9"
},
"scripts": {

@@ -65,4 +62,5 @@ "build": "unbuild",

"start": "esno src/index.ts",
"test": "jest"
}
"test": "vitest"
},
"readme": "# unconfig\n\n[![NPM version](https://img.shields.io/npm/v/unconfig?color=a1b858&label=)](https://www.npmjs.com/package/unconfig)\n\nA universal solution for loading configurations.\n\n## Why?\n\nConfiguration is hard, especially when you want to build an ecosystem of your tools. \n\nYou want your tools to be general and easy to use, you allow you config to be defined in a custom field of `package.json`.\n\nYou 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`.\n\nYou want the configs to be agnostic and probably need to be load by IDE, you create new config files like `.myconfigrc`.\n\nYou want the configs to also be flexible and dynamic, you make your config files a JavaScript file, like `my.config.js`.\n\nThen you want users to be able to use ESM and TypeScript, you also make your config accepting `.ts` or `.mjs`.\n\nSo 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...\n\n`unconfig` can't solve this fragmentation entirely, but it's trying to make loading them easier for tool authors.\n\n## Usage\n\n```bash\nnpm i unconfig\n```\n\nFor example, to load config for `my.config`:\n\n```js\nimport { loadConfig } from 'unconfig'\n\nconst { config, filepath } = await loadConfig({\n sources: [\n // load from `unocss.config.xx`\n {\n files: 'my.config',\n // default extensions\n extensions: ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs', 'json', ''],\n },\n // load `my` field in `package.json` if no above config files found\n {\n files: 'package.json',\n extensions: [],\n rewrite(config) {\n return config?.my\n },\n },\n // load inline config from `vite.config`\n {\n files: 'vite.config',\n async rewrite(config) {\n const config = await (typeof config === 'function' ? config() : config)\n return config?.my\n },\n },\n // ...\n ],\n // if false, the only the first matched will be loaded\n // if true, all matched will be loaded and deep merged\n merge: false\n})\n```\n\n`unconfig` supports loading `ts`, `mjs`, `js`, `json` by default.\n\n## Sponsors\n\n<p align=\"center\">\n <a href=\"https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg\">\n <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>\n </a>\n</p>\n\n## License\n\n[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)\n"
}

@@ -52,5 +52,5 @@ # unconfig

},
// load inline config from `nuxt.config`
{
files: 'nuxt.config',
// load inline config from `vite.config`
{
files: 'vite.config',
async rewrite(config) {

@@ -57,0 +57,0 @@ const config = await (typeof config === 'function' ? config() : config)

Sorry, the diff of this file is not supported yet

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