{"name":"yaml-loader","version":"0.8.0","license":"MIT","description":"YAML loader for Webpack","keywords":["yaml","webpack","loader","json"],"contributors":[{"name":"Andrey Okonetchnikov","email":"andrey@okonet.ru"},{"name":"Eemeli Aro","email":"eemeli@gmail.com"}],"homepage":"https://github.com/eemeli/yaml-loader","bugs":{"url":"https://github.com/eemeli/yaml-loader/issues"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-loader.git"},"main":"index.js","scripts":{"prettier":"prettier --ignore-path .gitignore --write .","test":"jest --coverage"},"prettier":{"semi":false,"singleQuote":true,"trailingComma":"none"},"dependencies":{"javascript-stringify":"^2.0.1","loader-utils":"^2.0.0","yaml":"^2.0.0"},"devDependencies":{"jest":"^28.0.0","prettier":"^2.1.1"},"engines":{"node":">= 12.13"},"gitHead":"e8b10cbc0ed12b34b397625e1d4d48b1110b70df","_id":"yaml-loader@0.8.0","_nodeVersion":"17.8.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-LjeKnTzVBKWiQBeE2L9ssl6WprqaUIxCSNs5tle8PaDydgu3wVFXTbMfsvF2MSErpy9TDVa092n4q6adYwJaWg==","shasum":"c839325e3fdee082b3768b2a21fe34fde5d96f61","tarball":"http://registry-npm.ywwl.com/yaml-loader/download/yaml-loader-0.8.0.tgz","fileCount":4,"unpackedSize":6336,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICmmY5VQ01pscCzXK0LlLalvBxccNgRAIF+Gw30hSoe0AiA0xg3JVWm3Ij7jWj9y3z3xcEXsbTB3Zdnu2AfmjaXFDg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiZ4iKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpv/Q/7Bq8yWn2hMCxHq3VPCq7H0uFpQ0NC+JZt56ywuUXZWs9ElOEf\r\nzGa2vMicUahcBkfZCdETbghcgBm4hjGPYNNcah17nvHS17HQcP1b213JUPez\r\nJJKWYVOic/4q5qjMMyDxjcCw22E1qsb/Y8WH8y1h3qBQ6x/cMdqU6eCPda+r\r\nl2OlGTNvxql99FBQfUAeY4FLAdf36U4SZq/KhCrlGdYPH6wmftKu5P3LtxnF\r\ngRhOIrYWGgVtEH1sACaLME5I4HK8mVqqq+JYMSMR2WSkr876UM4yLPd+niu0\r\nbxwKw3cfn2Mg+GOt2MlC+2D6O/VyQizFu4RFnXpxVG5VrjL6z5G3HP4ywaVS\r\n4ku32+L+xrFFwqOR6B4EcUNwWOUd3k5TF+BkDvrS2Ao5szFdrfYDGj4vvYLz\r\ngxDGM3aWUaXFewFUCSN+kRoVATgAv7+3E4oW6eodbV0GgN+dzzlZKLq6gCNx\r\nYJ0pUVJWjp9x1h6yJjO21i9xhmlaa2f84Z+R3egyuAlBhUKs/MbCAnRfA4yh\r\nPGrV9Tl4NIH8EEVcyLWkKBzewJIvnBZZy2jHzehsnytLQFzghb+UbIny5aXE\r\n5cKd++3k1n7eQ9PXr5UBwxD1vnDbi0hOUQ/gJprfOH3hKqZJAq+DFMrUq63u\r\noA0jgsJmI7V37qjURvdx+UG+0iAfZSmlE9I=\r\n=Hnd/\r\n-----END PGP SIGNATURE-----\r\n","size":2995,"noattachment":false,"key":"/yaml-loader/-/yaml-loader-0.8.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"okonet","email":"andrey@okonet.dev"},{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-loader_0.8.0_1650952330127_0.7129559263605774"},"_hasShrinkwrap":false,"readme":"# yaml-loader for Webpack\n\nYAML loader for [Webpack](https://webpack.js.org/). Allows importing YAML files as JS objects. Uses [`yaml`](https://www.npmjs.com/package/yaml) internally.\n\n## Installation\n\n```sh\nnpm install --save-dev yaml-loader\n```\n\n## Usage\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ya?ml$/,\n        use: 'yaml-loader'\n      }\n    ]\n  }\n}\n```\n\n```yaml\n# file.yaml\n---\nconfig:\n  js:\n    key: test\nhello: world\n```\n\n```js\n// application.js\nimport file from './file.yaml'\n\nfile.hello === 'world'\n```\n\n## Options\n\nIn addition to all [`yaml` options](https://eemeli.org/yaml/#options) used by its parsing methods,\nthe loader supports the following additional options:\n\n### `asJSON`\n\nIf enabled, the loader output is stringified JSON rather than stringified JavaScript. For Webpack v4, you'll need to set the rule to have `type: \"json\"`. Also useful for chaining with other loaders that expect JSON input.\n\n### `asStream`\n\nIf enabled, parses the source file as a stream of YAML documents. With this, the output will always be an array, with entries for each document. If set, `namespace` is ignored.\n\nTo use this option for only some YAML files, it's probably easiest to use a query parameter and match that using [Rule.resourceQuery](https://webpack.js.org/configuration/module/#ruleresourcequery):\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ya?ml$/,\n        oneOf: [\n          {\n            resourceQuery: /stream/,\n            options: { asStream: true },\n            loader: 'yaml-loader'\n          },\n          { loader: 'yaml-loader' }\n        ]\n      }\n    ]\n  }\n}\n```\n\nThen, importing `./foo.yaml` will expect it to contain only one document, but `./bar.yaml?stream` may contain multiple documents.\n\n### `namespace`\n\nAllows for exposing a sub-tree of the source document:\n\n```js\nimport jsCfg from './file.yaml?namespace=config.js'\n\njsCfg.key === 'test'\n```\n\nThe `namespace` should be a series of keys, dot separated. Note that any `options` object in your `webpack.config.js` rule will be superseded by a `?query`.\n\n## License\n\n[MIT](http://www.opensource.org/licenses/mit-license.php)\n","publish_time":1650952330309,"_cnpm_publish_time":1650952330309,"dist-tags":{"latest":"0.9.0"}}