{"_id":"@cicara/vite-plugin-yaml","name":"@cicara/vite-plugin-yaml","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@cicara/vite-plugin-yaml","version":"0.0.1","description":"import yaml files as js objects","type":"module","license":"MIT","scripts":{"dev":"tsup --watch src","example:dev":"pnpm -C example run dev","example:build":"pnpm run build && pnpm -C example run build","build":"tsup"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./modules":{"types":"./modules.d.ts"}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","peerDependencies":{"vite":"^2.6.0 || ^3.0.0 || ^4.0.0"},"dependencies":{"@rollup/pluginutils":"5.0.2","yaml":"^2.3.1"},"devDependencies":{"tsup":"6.5.0","typescript":"4.9.4","vite":"4.0.3"},"directories":{"example":"example"},"author":{"name":"hungtcs","email":"hungtcs@outlook.com","url":"https://github.com/hungtcs"},"repository":{"type":"git","url":"git+ssh://git@github.com/hungtcs/vite-plugin-yaml.git"},"keywords":["vite"],"bugs":{"url":"https://github.com/hungtcs/vite-plugin-yaml/issues"},"homepage":"https://github.com/hungtcs/vite-plugin-yaml#readme","gitHead":"31902e2ce2105c0659aa6bc1144c69d51b59b914","_id":"@cicara/vite-plugin-yaml@0.0.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-ELP77ZVPkH3zkJXU2U2SikBwFUXGcfX1c9HXSZ2iXEXjE0Yphf7dCdn08egKl0qGyzkuYCCCXbDbTPdVzSeBew==","shasum":"4c8794aa71eb24997464e6b8efc20646080230d9","tarball":"https://registry.npmjs.org/@cicara/vite-plugin-yaml/-/vite-plugin-yaml-0.0.1.tgz","fileCount":6,"unpackedSize":5679,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC5rLhBTPcIYPqHvZA8+M8kMD3bL4b7J9Ug5Ek6gxZIGAiA5it0Nxdu0TickjbrvmmBkY9hPfQih9lerasGFoCmF9w=="}]},"_npmUser":{"name":"hungtcs","email":"hungtcs@outlook.com"},"maintainers":[{"name":"hungtcs","email":"hungtcs@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-yaml_0.0.1_1686536192332_0.8880207170039245"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-12T02:16:32.283Z","0.0.1":"2023-06-12T02:16:32.498Z","modified":"2023-06-12T02:16:32.644Z"},"maintainers":[{"name":"hungtcs","email":"hungtcs@outlook.com"}],"description":"import yaml files as js objects","homepage":"https://github.com/hungtcs/vite-plugin-yaml#readme","keywords":["vite"],"repository":{"type":"git","url":"git+ssh://git@github.com/hungtcs/vite-plugin-yaml.git"},"author":{"name":"hungtcs","email":"hungtcs@outlook.com","url":"https://github.com/hungtcs"},"bugs":{"url":"https://github.com/hungtcs/vite-plugin-yaml/issues"},"license":"MIT","readme":"[![Pipeline](https://github.com/Modyfi/vite-plugin-yaml/actions/workflows/pipeline.yml/badge.svg)](https://github.com/Modyfi/vite-plugin-yaml/actions/workflows/pipeline.yml)\n\n# 🧹 vite-plugin-yaml\n\nTransforms a YAML file into a JS object.\n\n## 🚀 Install\n\n```\nnpm install -D @modyfi/vite-plugin-yaml\n# or\n# yarn add -D @modyfi/vite-plugin-yaml\n# or\n# pnpm i -D @modyfi/vite-plugin-yaml\n```\n\n## 🦄 Usage\n\nAdd `ViteYAML` to `vite.config.js / vite.config.ts`:\n\n```ts\n// vite.config.js / vite.config.ts\nimport ViteYaml from '@modyfi/vite-plugin-yaml';\n\nexport default {\n  plugins: [\n    ViteYaml(), // you may configure the plugin by passing in an object with the options listed below\n  ],\n};\n```\n\nThen you can simply import yaml files like you would any other file:\n\n```ts\nimport YamlContent from './your.yaml';\n\nconsole.log(YamlContent.example);\n```\n\nDo note that you may have to include the file type in your import.\n\n### 🔦 TypeScript support\n\nThe recommended way to add type definitions for `.yaml` or `.yml` modules is via a `tsconfig.json` file.\n\n```ts\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    ...\n    \"types\": [\n      ...\n      \"@modyfi/vite-plugin-yaml/modules\"\n      ],\n  }\n}\n```\n\nYou may also add type definitions without `tsconfig`:\n\n```ts\n// vite-env.d.ts\n/// <reference types=\"@modyfi/vite-plugin-yaml/modules\" />\n```\n\n## 🐛 Options\n\n```ts\n/**\n * A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on.\n *\n * By default all files are targeted.\n */\ninclude?: FilterPattern;\n/**\n * A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore.\n *\n * By default no files are ignored.\n */\nexclude?: FilterPattern;\n/**\n * Schema used to parse yaml files.\n *\n * @see https://github.com/nodeca/js-yaml/blob/49baadd52af887d2991e2c39a6639baa56d6c71b/README.md#load-string---options-\n */\nschema?: Schema;\n/**\n * A function that will be called for error reporting.\n *\n * Defaults to `console.warn()`.\n */\nonWarning?: (warning: YAMLException) => void;\n```\n","readmeFilename":"README.md"}