{"id":13678120,"url":"https://github.com/rspack-contrib/rsbuild-plugin-yaml","last_synced_at":"2025-09-10T18:37:20.101Z","repository":{"id":246724838,"uuid":"822131925","full_name":"rspack-contrib/rsbuild-plugin-yaml","owner":"rspack-contrib","description":"An Rsbuild plugin to import YAML files and convert them into JavaScript objects.","archived":false,"fork":false,"pushed_at":"2025-04-01T05:36:14.000Z","size":75,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T01:18:40.067Z","etag":null,"topics":["rsbuild","rsbuild-plugin","rspack"],"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/rspack-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-06-30T11:17:58.000Z","updated_at":"2025-04-01T05:36:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa0d317a-24ed-4405-9996-fd1eeda2803e","html_url":"https://github.com/rspack-contrib/rsbuild-plugin-yaml","commit_stats":null,"previous_names":["rspack-contrib/rsbuild-plugin-yaml"],"tags_count":3,"template":false,"template_full_name":"rspack-contrib/rsbuild-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspack-contrib","download_url":"https://codeload.github.com/rspack-contrib/rsbuild-plugin-yaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860005,"owners_count":21173343,"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":["rsbuild","rsbuild-plugin","rspack"],"created_at":"2024-08-02T13:00:50.325Z","updated_at":"2025-04-14T10:20:39.842Z","avatar_url":"https://github.com/rspack-contrib.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"readme":"# @rsbuild/plugin-yaml\n\nImport YAML files and convert them into JavaScript objects.\n\n\u003e [YAML](https://yaml.org/) is a data serialization language commonly used for writing configuration files.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/@rsbuild/plugin-yaml\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/@rsbuild/plugin-yaml?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"license\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall:\n\n```bash\nnpm add @rsbuild/plugin-yaml -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\n// rsbuild.config.ts\nimport { pluginYaml } from \"@rsbuild/plugin-yaml\";\n\nexport default {\n  plugins: [pluginYaml()],\n};\n```\n\n## Example\n\nSuppose the project has the following code in `example.yaml`:\n\n```yaml title=\"example.yaml\"\nhello = \"world\"\n\n[foo]\nbar = \"baz\"\n```\n\nAfter using the YAML plugin, you can reference it as follows:\n\n```js\nimport example from \"./example.yaml\";\n\nconsole.log(example.hello); // 'world';\nconsole.log(example.foo); // { bar: 'baz' };\n```\n\n## Type Declaration\n\nWhen you import YAML files in TypeScript code, please create a `src/env.d.ts` file in your project and add the corresponding type declarations.\n\n```ts\ndeclare module \"*.yml\" {\n  const content: Record\u003cstring, any\u003e;\n  export default content;\n}\ndeclare module \"*.yaml\" {\n  const content: Record\u003cstring, any\u003e;\n  export default content;\n}\n```\n\n## License\n\n[MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-yaml/lists"}