{"name":"lilconfig","version":"2.0.3","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.0.3","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"68f3005e921dafbd2a2afb48379986aa6d2579fd","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.0.3.tgz","fileCount":4,"integrity":"sha512-EHKqr/+ZvdKCifpNrJCKxBTgk5XupZA3y/aCPY9mxfgBzmgh93Mt/WqjjQ38oMxXuvDokaKiM3lAgvSH2sjtHg==","signatures":[{"sig":"MEUCIQDwOSrzaGsAILzv3Ng84RKoG6fc2OrG7UqQCb9/rJO6TAIgfxuBKtgmazV0gJkNUhSdZ4Nznnkz43G/rSGYrySn8LY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14634,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvSm7CRA9TVsSAnZWagAA1oIP/1k0DlxywzgvR7h3E9UK\nHAgpliPZ3vlo+CoChbyS/5ARI9UqTBxf/Oa91/NHs6oGWolbgRXvOAPwcQpA\n2ANFyMXzCo5p0zTiFA7Epd7fpOV+9XBLDYVDzgIO5e/RqYeuemn9d2AaMCuB\nEvUKCZhqDVe1Uz6Kf3s0ecmecqMKtRsSJgLCVk4XRu1AzM7b+KMugM/LTU+i\n6hL2Iaat7oucOS0FK/PoYCL4LT+tatX4d/jLGKYx/YJPIM5HHc+aQ0pavqTW\nlRrcpmMG3cTTt1kLKUUemyfbljvOQD22GZjw5EX4LKjwx3zT/pUQ787LuZhB\ne3dg+MmbbsYGTkV08Uw9JcImUB9dUb3QZHYc9H5kQuLv6jkYzHWLCGRPfrhC\njyoe0buU8NceuNJ7XbVPkKmWztJaRYeYMaDeBhFDQ5B14kcOCLPt6kra8YiH\nJQvHILG4R6uUlFMw4PRCjOn38zwsZv2PdQ7Ujt6SeF0/iRz2wQBz4irZOKWh\nEKF3/4cgKmRYV5vtpL/831+30jlY2RYStvTikgTXV6FxDKgUCHc4nzG6arYv\nTjDk1xxU4YH6wRF9peMeVZgIYBH97ylCrOg5QTJSldOf4qnmsRLdEbX0pppZ\n6kTDLYsGAW0MEEwUxquiDdOG8XRVaCee3qjGXGoG2AiONuz/zma2jhVzi5wo\nEft1\r\n=+2iL\r\n-----END PGP SIGNATURE-----\r\n","size":3620,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.0.3.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"c54ebad1a7916c764a423c8221013c63b2d1ce63","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":"6.14.12","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","eslint":"^7.28.0","ts-jest":"^26.5.6","prettier":"^2.3.1","typescript":"^4.3.2","@types/jest":"^26.0.23","@types/node":"^14.17.2","cosmiconfig":"7.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.26.0","@typescript-eslint/eslint-plugin":"^4.26.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_2.0.3_1623009723312_0.13252797450904574","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":1623009723498,"_cnpm_publish_time":1623009723498,"dist-tags":{"latest":"3.1.5"}}