{"name":"lilconfig","version":"3.1.0","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@3.1.0","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"aabf03fd46934d0566d75b4b64ce41a2cdea1167","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-3.1.0.tgz","fileCount":5,"integrity":"sha512-p3cz0JV5vw/XeouBU3Ldnp+ZkBjE+n8ydJ4mcwBrOiXXPqNlrzGBqWs9X4MWF7f+iKUBu794Y8Hh8yawiJbCjw==","signatures":[{"sig":"MEUCIE4IPq/yn5+jhSdvgHx68Ougm+dAMFG65jodXdd3BXvHAiEA03cP1qotW5oGwfoBPCbYMtoo93OzkhqiWcpe8eZ0TPU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19813,"size":4943,"noattachment":false,"key":"/lilconfig/-/lilconfig-3.1.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=14"},"funding":"https://github.com/sponsors/antonk52","gitHead":"20f03087709f969ce33472898f25fed3a6f889fe","scripts":{"lint":"eslint ./src/*.ts","test":"NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest --coverage","build":"tsc --declaration","clean":"rm -rf ./dist","prebuild":"npm run clean","postbuild":"du -h ./dist/*"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"deprecated":"This version contains a security issue. Please upgrade to 3.1.1 or later.","repository":{"url":"git+https://github.com/antonk52/lilconfig.git","type":"git"},"_npmVersion":"10.2.4","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"uvu":"^0.5.6","jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"29.1.2","prettier":"^3.2.5","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^14.18.63","cosmiconfig":"^8.3.6","typescript-eslint":"^7.0.1","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_3.1.0_1707946814633_0.5741278984160263","host":"s3://npm-registry-packages"},"readme":"# Lilconfig ⚙️\n[![npm version](https://badge.fury.io/js/lilconfig.svg)](https://badge.fury.io/js/lilconfig)\n[![install size](https://packagephobia.now.sh/badge?p=lilconfig)](https://packagephobia.now.sh/result?p=lilconfig)\n[![Coverage Status](https://coveralls.io/repos/github/antonk52/lilconfig/badge.svg)](https://coveralls.io/github/antonk52/lilconfig)\n\nA zero-dependency alternative to [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) with the same API.\n\n## Installation\n\n```sh\nnpm install lilconfig\n```\n\n## Usage\n\n```js\nimport {lilconfig, lilconfigSync} from 'lilconfig';\n\n// all keys are optional\nconst options = {\n    stopDir: '/Users/you/some/dir',\n    searchPlaces: ['package.json', 'myapp.conf.js'],\n    ignoreEmptySearchPlaces: false\n}\n\nlilconfig(\n    'myapp',\n    options // optional\n).search() // Promise<LilconfigResult>\n\nlilconfigSync(\n    'myapp',\n    options // optional\n).load(pathToConfig) // LilconfigResult\n\n/**\n * LilconfigResult\n * {\n *   config: any; // your config\n *   filepath: string;\n * }\n */\n```\n\n## ESM\n\nESM configs can be loaded with **async API only**. Specifically `js` files in projects with `\"type\": \"module\"` in `package.json` or `mjs` files.\n\n## Difference to `cosmiconfig`\nLilconfig does not intend to be 100% compatible with `cosmiconfig` but tries to mimic it where possible. The key difference is **no** support for yaml files out of the box(`lilconfig` attempts to parse files with no extension as JSON instead of YAML). You can still add the support for YAML files by providing a loader, see an [example](#yaml-loader) below.\n\n### Options difference between the two.\n\n|cosmiconfig option      | lilconfig |\n|------------------------|-----------|\n|cache                   | ✅        |\n|loaders                 | ✅        |\n|ignoreEmptySearchPlaces | ✅        |\n|packageProp             | ✅        |\n|searchPlaces            | ✅        |\n|stopDir                 | ✅        |\n|transform               | ✅        |\n\n## Loaders examples\n\n### Yaml loader\n\nIf you need the YAML support you can provide your own loader\n\n```js\nimport {lilconfig} from 'lilconfig';\nimport yaml from 'yaml';\n\nfunction loadYaml(filepath, content) {\n    return yaml.parse(content);\n}\n\nconst options = {\n    loaders: {\n        '.yaml': loadYaml,\n        '.yml': loadYaml,\n        // loader for files with no extension\n        noExt: loadYaml\n    }\n};\n\nlilconfig('myapp', options)\n    .search()\n    .then(result => {\n        result // {config, filepath}\n    });\n```\n\n## Version correlation\n\n- lilconig v1 → cosmiconfig v6\n- lilconig v2 → cosmiconfig v7\n- lilconig v3 → cosmiconfig v8\n","publish_time":1707946814810,"_cnpm_publish_time":1707946814810,"dist-tags":{"latest":"3.1.5"}}