{"name":"yaml-loader","version":"0.9.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 --write .","test":"vitest run --coverage"},"prettier":{"semi":false,"singleQuote":true,"trailingComma":"none"},"dependencies":{"javascript-stringify":"^2.0.1","yaml":"^2.0.0"},"devDependencies":{"@vitest/coverage-v8":"^4.0.16","memfs":"^4.51.1","prettier":"^3.7.4","unionfs":"^4.4.0","vitest":"^4.0.16","webpack":"^5.75.0"},"engines":{"node":">= 20"},"gitHead":"1b723a6afbb1a3b23c65a1033217db19de976702","_id":"yaml-loader@0.9.0","_nodeVersion":"25.2.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-N0bPfDR42qCruELfmpF6Q8XnDu1elTULGjvVn7u6rsfDa8WhlmJbjXQRh+x5TGmpOqw8R9qfiUgc3aKP+8Hd4w==","shasum":"4de1f70dd5fb6965c4c126337729c41fd6ad0aba","tarball":"http://registry-npm.ywwl.com/yaml-loader/download/yaml-loader-0.9.0.tgz","fileCount":4,"unpackedSize":6442,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCbO96CeLxZCzm7MsAiSGbgzQ1hmu4PKSZ5gWkhK/f1bQIhAKSxReyJXAi4pyQ1EjNSrt93Rqjy1C+ZxZpMc81Aeb+r"}],"size":3047,"noattachment":false,"key":"/yaml-loader/-/yaml-loader-0.9.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-npm-production","tmp":"tmp/yaml-loader_0.9.0_1766934386556_0.35164062024808085"},"_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.\nAlso 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":1766934386694,"_cnpm_publish_time":1766934386694,"dist-tags":{"latest":"0.9.0"}}