{"name":"yaml-loader","version":"0.8.1","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","memfs":"^3.4.13","prettier":"^2.1.1","unionfs":"^4.4.0","webpack":"^5.75.0"},"engines":{"node":">= 14"},"_id":"yaml-loader@0.8.1","gitHead":"2b90e2f746df48526629d2653ac5d8cb376e8ef6","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-BCEndnUoi3BaZmePkwGGe93txRxLgMhBa/gE725v1/GHnura8QvNs7c4+4C1yyhhKoj3Dg63M7IqhA++15j6ww==","shasum":"034f901147073cfc307cdcce8bd44c1547e60ba1","tarball":"http://registry-npm.ywwl.com/yaml-loader/download/yaml-loader-0.8.1.tgz","fileCount":4,"unpackedSize":6588,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDkTQohITFBI2W9zb98kWA6U+3EOIt1fCXazh8hvuW8gIhAMyh1+eLXAFyWvaXE97iZOF4Di2txG0eqQesMTOWSIFU"}],"size":3110,"noattachment":false,"key":"/yaml-loader/-/yaml-loader-0.8.1.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.1_1708524160556_0.3654719740591006"},"_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":1708524160765,"_cnpm_publish_time":1708524160765,"dist-tags":{"latest":"0.9.0"}}