{"id":13417376,"url":"https://github.com/Modyfi/vite-plugin-yaml","last_synced_at":"2025-03-15T02:31:14.584Z","repository":{"id":39973288,"uuid":"462903857","full_name":"Modyfi/vite-plugin-yaml","owner":"Modyfi","description":"Transform a YAML file to a JS object","archived":false,"fork":false,"pushed_at":"2025-02-23T22:57:02.000Z","size":187,"stargazers_count":81,"open_issues_count":9,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-07T02:49:12.142Z","etag":null,"topics":["vite","vite-plugin","yaml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Modyfi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-23T20:59:46.000Z","updated_at":"2025-02-27T21:11:05.000Z","dependencies_parsed_at":"2024-06-18T14:08:14.252Z","dependency_job_id":"290e6bc7-34a3-40d6-b165-e9de11f6b289","html_url":"https://github.com/Modyfi/vite-plugin-yaml","commit_stats":{"total_commits":25,"total_committers":6,"mean_commits":4.166666666666667,"dds":"0.43999999999999995","last_synced_commit":"d21e82833ff9f70b8dd72afa7625997ea1b11e45"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modyfi%2Fvite-plugin-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modyfi%2Fvite-plugin-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modyfi%2Fvite-plugin-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modyfi%2Fvite-plugin-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Modyfi","download_url":"https://codeload.github.com/Modyfi/vite-plugin-yaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243674794,"owners_count":20329163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vite","vite-plugin","yaml"],"created_at":"2024-07-30T22:00:36.031Z","updated_at":"2025-03-15T02:31:14.257Z","avatar_url":"https://github.com/Modyfi.png","language":"TypeScript","funding_links":[],"categories":["Plugins","yaml"],"sub_categories":["Framework-agnostic Plugins"],"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/// \u003creference types=\"@modyfi/vite-plugin-yaml/modules\" /\u003e\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 boolean to determine if JSON object should be serialized.\n *\n * @see https://www.npmjs.com/package/tosource for the motivation behind serialization of JSON.\n */\nraw?: boolean;\n/**\n * A function that will be called for error reporting.\n *\n * Defaults to `console.warn()`.\n */\nonWarning?: (warning: YAMLException) =\u003e void;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModyfi%2Fvite-plugin-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FModyfi%2Fvite-plugin-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModyfi%2Fvite-plugin-yaml/lists"}