{"name":"lilconfig","version":"1.0.0","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@1.0.0","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"dist":{"shasum":"d9cdaa97f237472f7f368ca23d8ae49b53af73a6","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-1.0.0.tgz","fileCount":4,"integrity":"sha512-Htbenp03fa9rAnrTTv0yg9MbsABM4/z+2XMdWCxtXNqGj5xaSJu5FpdVHKa8atVd35m71CPtlEF42UC3GYGZJw==","signatures":[{"sig":"MEYCIQCaQX45VXCna+2j6eJ5UGHjVAZCVcW9JS5q4BL9NVOpfAIhAMUEw+ryrizyBCW8JIfcj2cMkOFhsWheAXlOi2DlZOAE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14332,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfHMryCRA9TVsSAnZWagAAkN0P/10X82s8rqVjzgN8BEwQ\nCOVsQ422X0Sy1+xyVe/E/XJdVHToNv+V+VmwUzEXj47MdtDGnVBJSAtcK7PF\no+4QRuVqzmiErXrAHYgaWRARwdF/iBEbvJ63OSngo/qcuxEOEgO2/sjUB4If\nFCXW+Jbe4OiT8dYclEHHDS/HASydihI7H8d2Xn84S4KdZSY/br0UmFnwA+ye\nDfconIDJVvVCKGvBbD38xZVX2KvBZ/hLNFC0TNcvRRVlm3QrZJzjjfDSfzg8\ncOJIU4avm70oXCrBbL8KKWfXwQ3Ezo5s05a8BR86ZpsNVimvfMCiCyJMztWV\nNCB0OldCM1odZ0aChAHlgSgnH8GgqAnavjuRhREX4yGo0L38cRzjPMQbnhg5\nXgK6UmDTTztdfLTxhqM4tiOeM6LMGTI4Gn3uLblXNbG1HTvTp7Wc8xyLgLMH\ntfjhkTJ1gkhb7P5RNajyZOf3akMcqUwxNjhkvvUL0Sj/xnd3QSpa3fTaB0mQ\nOVJ5dhaMFbzlaMt/OUu3DasHe8enzs0lt9RF5zg5UmjlEcKMcgBtbx6j6PCn\nDHDv/9Mpw8bor4H8/NktjA4YB1Muvbh7gdnIJajj1aRycWf7ZTIUl7d00xOO\nZhkcl3bA5k6+g+kf2ObRCBGaCW2R3wQU+mVWJInD5xTF7mLVpIlG9WLMKN7o\nemOa\r\n=TUPM\r\n-----END PGP SIGNATURE-----\r\n","size":3546,"noattachment":false,"key":"/lilconfig/-/lilconfig-1.0.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=8"},"gitHead":"1d0ab18b3be11fc7172c4213e5be7f2e684a8962","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"},"_npmVersion":"6.14.5","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^26.1.0","eslint":"^7.5.0","ts-jest":"^26.1.3","prettier":"^2.0.5","typescript":"^3.9.7","@types/jest":"^26.0.5","@types/node":"^14.0.23","cosmiconfig":"^6.0.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","@typescript-eslint/parser":"^3.7.0","@typescript-eslint/eslint-plugin":"^3.7.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_1.0.0_1595722481719_0.12083321751193288","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":1595722481901,"_cnpm_publish_time":1595722481901,"dist-tags":{"latest":"3.1.5"}}