stacks/bun-unconfig
publicClone
Push over the same URL. A password will not work: create a token under access tokens and use it in place of one.
A universal solution for loading configurations in Bun.
- .github
- .vscode
- src
- test
- .eslintignore 18 B
- .eslintrc 43 B
- .gitignore 1.1 KB
- .npmrc 55 B
- build.config.ts 209 B
- index.d.ts.ts 29 B
- LICENSE 1.1 KB
- package.json 1.6 KB
- pnpm-lock.yaml 125.1 KB
- pnpm-workspace.yaml 41 B
- presets.d.ts 31 B
- README.md 1.2 KB
- tsconfig.json 276 B
bun-unconfig
Forked from unconfig
Changes in this fork
- Adds Bun compatibility
Get Started
npm i bun-unconfigunconfig supports loading ts, mjs, js, json by default.
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,
})