{"name":"lilconfig","version":"2.0.5","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.0.5","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"19e57fd06ccc3848fd1891655b5a447092225b25","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.0.5.tgz","fileCount":4,"integrity":"sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==","signatures":[{"sig":"MEUCICO1qg03Dx5fqDhYWmvZr8N6At2FZ9ax129otK8fKiBQAiEAuJrqdWWr7uylcdEpd+5oxINiyqYGCkJzg2HyN1iStt4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15386,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiO6GYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpwzg//aKvQBUvmJ7GdXNLGyAlk4kYZHPeQv/PsJjEZ/XLbOM8orqS/\r\nrEBh60zLrDy3G9wVwihIJUGOxxj579L7BWUbtTh7lurm1+SdL3VPFImoio0m\r\n1FMx3DYzWB4o7T93YP8jLiOQMC4uzjmCXaoDWTDhK7vE59iMFoCawuHrD3we\r\n56pRS7RMwk+5j/65cvGJ8CePcuTGJZza0wSIisoHu5GYgpLDsaNrNpid2FyN\r\nm3eSnTlmZk7QUrT0DftaIMDi7KNqy/NAfZ7PBdOrimZp6Q/DcoORlvt9tI6X\r\n0Q3kgqm4+m2Vt2Z45MFpJirIM2V6DqQxo9pFqsp/G0vgIs9+64XDBW0FWFw0\r\n2swipsMpmAoJ5aryRK4j5gEMu0ZXVNyTFHFuC7wTtNLZOllkQqu8xgCfrTyz\r\nv6gS5HcTpba5nsDMCEZSRAlywRCOvXUEi99dJt50w++SbzTJ4MEHw25sVa/v\r\n7KddOQly0L8IjKc8iZIN5HilXRRLqrkTX3Ul+ydM+AMh+vi75bVNHnuDStL6\r\n5yoQ837mrglrkYaZ1uvT7r9TAsVWIxlZA9MZwrG5sEiuDBnZFY0ogie6y6qq\r\nqwn9YIGEzRi7rMHLFxdzITdJq9RFn4zEyoZ2wG865pS/tMfrP4UbVuSCrKMw\r\n0uJdFp3DSxnbevsGat1Gh/kNOFRMZ9uuarY=\r\n=Ya6+\r\n-----END PGP SIGNATURE-----\r\n","size":3796,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.0.5.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"7dbde6a570107a7e0cb6144bd2488497de94ce4b","scripts":{"lint":"eslint ./src/*.ts","test":"jest --coverage","build":"tsc --declaration","clean":"rm -rf ./dist","prebuild":"npm run clean","postbuild":"du -h ./dist/*"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"repository":{"url":"git+https://github.com/antonk52/lilconfig.git","type":"git"},"_npmVersion":"8.5.1","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"17.6.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^27.3.1","eslint":"^8.1.0","ts-jest":"^27.0.7","prettier":"^2.4.1","typescript":"^4.4.4","@types/jest":"^27.0.2","@types/node":"^14.17.2","cosmiconfig":"^7.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@typescript-eslint/parser":"^5.3.0","@typescript-eslint/eslint-plugin":"^5.3.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_2.0.5_1648075159938_0.03334484447989028","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":1648075160091,"_cnpm_publish_time":1648075160091,"dist-tags":{"latest":"3.1.5"}}