Comparing version 0.2.2 to 0.3.0
{ | ||
"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[](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
8
1
18167
4
9
317
+ Addedvitest@^0.2.7
+ Added@antfu/utils@0.5.2(transitive)
+ Added@esbuild/aix-ppc64@0.25.1(transitive)
+ Added@esbuild/android-arm@0.25.1(transitive)
+ Added@esbuild/android-arm64@0.25.1(transitive)
+ Added@esbuild/android-x64@0.25.1(transitive)
+ Added@esbuild/darwin-arm64@0.25.1(transitive)
+ Added@esbuild/darwin-x64@0.25.1(transitive)
+ Added@esbuild/freebsd-arm64@0.25.1(transitive)
+ Added@esbuild/freebsd-x64@0.25.1(transitive)
+ Added@esbuild/linux-arm@0.25.1(transitive)
+ Added@esbuild/linux-arm64@0.25.1(transitive)
+ Added@esbuild/linux-ia32@0.25.1(transitive)
+ Added@esbuild/linux-loong64@0.25.1(transitive)
+ Added@esbuild/linux-mips64el@0.25.1(transitive)
+ Added@esbuild/linux-ppc64@0.25.1(transitive)
+ Added@esbuild/linux-riscv64@0.25.1(transitive)
+ Added@esbuild/linux-s390x@0.25.1(transitive)
+ Added@esbuild/linux-x64@0.25.1(transitive)
+ Added@esbuild/netbsd-arm64@0.25.1(transitive)
+ Added@esbuild/netbsd-x64@0.25.1(transitive)
+ Added@esbuild/openbsd-arm64@0.25.1(transitive)
+ Added@esbuild/openbsd-x64@0.25.1(transitive)
+ Added@esbuild/sunos-x64@0.25.1(transitive)
+ Added@esbuild/win32-arm64@0.25.1(transitive)
+ Added@esbuild/win32-ia32@0.25.1(transitive)
+ Added@esbuild/win32-x64@0.25.1(transitive)
+ Added@rollup/rollup-android-arm-eabi@4.35.0(transitive)
+ Added@rollup/rollup-android-arm64@4.35.0(transitive)
+ Added@rollup/rollup-darwin-arm64@4.35.0(transitive)
+ Added@rollup/rollup-darwin-x64@4.35.0(transitive)
+ Added@rollup/rollup-freebsd-arm64@4.35.0(transitive)
+ Added@rollup/rollup-freebsd-x64@4.35.0(transitive)
+ Added@rollup/rollup-linux-arm-gnueabihf@4.35.0(transitive)
+ Added@rollup/rollup-linux-arm-musleabihf@4.35.0(transitive)
+ Added@rollup/rollup-linux-arm64-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-arm64-musl@4.35.0(transitive)
+ Added@rollup/rollup-linux-loongarch64-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-powerpc64le-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-riscv64-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-s390x-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-x64-gnu@4.35.0(transitive)
+ Added@rollup/rollup-linux-x64-musl@4.35.0(transitive)
+ Added@rollup/rollup-win32-arm64-msvc@4.35.0(transitive)
+ Added@rollup/rollup-win32-ia32-msvc@4.35.0(transitive)
+ Added@rollup/rollup-win32-x64-msvc@4.35.0(transitive)
+ Added@types/chai@4.3.20(transitive)
+ Added@types/chai-subset@1.3.6(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Addedassertion-error@1.1.0(transitive)
+ Addedchai@4.5.0(transitive)
+ Addedcheck-error@1.0.3(transitive)
+ Addeddeep-eql@4.1.4(transitive)
+ Addedesbuild@0.25.1(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedget-func-name@2.0.2(transitive)
+ Addedlocal-pkg@0.4.3(transitive)
+ Addedloupe@2.3.7(transitive)
+ Addednanoid@3.3.9(transitive)
+ Addedpathval@1.1.1(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.5.3(transitive)
+ Addedrollup@4.35.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedtinypool@0.1.3(transitive)
+ Addedtinyspy@0.2.10(transitive)
+ Addedtype-detect@4.1.0(transitive)
+ Addedvite@6.2.1(transitive)
+ Addedvitest@0.2.8(transitive)
- Removed@antfu/utils@0.3.0(transitive)
- Removed@types/throttle-debounce@2.1.0(transitive)
Updated@antfu/utils@^0.5.0
Updateddefu@^5.0.1
Updatedjiti@^1.12.15