{"name":"yaml-loader","version":"0.7.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":"^27.5.1","prettier":"^2.1.1"},"engines":{"node":">= 10.14.2"},"gitHead":"3f63c69d87020513f929fa3e9c25c482697b5727","_id":"yaml-loader@0.7.0","_nodeVersion":"17.4.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-mYBg4rQ6F1/4iF+K3ccRjDEEDG7YVHzF5WTUmGJSC9xCBwES7rP3TK6Cdr4Jog0F6Qej8C10VFUOJtDzZ2LYdQ==","shasum":"c4ec0b82d7fe8cd7d3924b46681167d4949b3997","tarball":"http://registry-npm.ywwl.com/yaml-loader/download/yaml-loader-0.7.0.tgz","fileCount":4,"unpackedSize":6155,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICJHoSyPWj5tpDD+0DqbPxjWz4C+VIUYewtGTQxMPGkcAiEA8hzWSaILypwDvtKnP1Q9rmrM9fM8o1/Kwv9Hp/mqC2w="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUUCNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIKw/9HU4sHwfv70T1DRc4GQXSR+wYMqGl8FX2ZqBz2SWN8nG09NHc\r\nPiTzlWP2eCuVLiQNrNrTtKFMmyAYqMs3MGKaWMsscoGZPWpBcEgFTgpVUFSu\r\nAba7E6TnM4iHpWWc9TtKWZzK9aNkDSW8XXtsU6lCswoD8L+b3tzrJr8/dkl+\r\nGGZ0RLowfZto4NNMmgJAKaBPjbooC+w1HG1/Nud/uA3EHEHBxRWyMdSXu6DF\r\nsfHqNHvTNwtgY972auYKZxwxgmMzeobc7e8GEV8Ex7rNFNy0w2i3f+S5IX+j\r\nG/4aqieREMYxCJxMOMvu/jTHEn9F1BT3HU97jlqHKCtbQiRGRJ45ywn79BcX\r\net2EqaMsx3Z1TLBAtWsKEp5YltfS9OhmPPjk8vo+gOZLOEi95IG0ojKb05mk\r\nLQlxfIOUv0GRRXTFLVfZQj4MN10mkzuF+dg2ZA+jYoHJMcV6kT1TT25057Op\r\ntUOqR2brkKKnKlInSLKJFISWE6vE5ga8Il+PTZunKFS+23UA8Y6NlOHQOhCk\r\nBAW1JIbAFNTOE2YEAfBotNeRCikDXCPvTMtrF5mXh4IVo6iqkwGctWdzuAwH\r\nLonP0opVVCCBrPAy8ZZa7xn5OsCAPD/O7Gsf3V1h5jcCGOOynmFrxNj3fHuo\r\nSpaLXSS0UTBr9sHjk/hI7wlNHH3s+C1l9Qc=\r\n=3YL1\r\n-----END PGP SIGNATURE-----\r\n","size":2949,"noattachment":false,"key":"/yaml-loader/-/yaml-loader-0.7.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"okonet","email":"andrey@okonet.ru"},{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-loader_0.7.0_1649492108829_0.32344302754118526"},"_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":1649492108988,"_cnpm_publish_time":1649492108988,"dist-tags":{"latest":"0.9.0"}}