{"id":13678130,"url":"https://github.com/rspack-contrib/rsbuild-plugin-toml","last_synced_at":"2025-09-07T16:41:33.355Z","repository":{"id":246751839,"uuid":"822073029","full_name":"rspack-contrib/rsbuild-plugin-toml","owner":"rspack-contrib","description":"An Rsbuild plugin to import TOML files and convert them to JavaScript objects.","archived":false,"fork":false,"pushed_at":"2025-04-01T05:37:55.000Z","size":93,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-03T08:03:16.379Z","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-30T08:32:02.000Z","updated_at":"2025-04-01T05:37:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd6d819d-4499-446d-bb04-44b4f21a6906","html_url":"https://github.com/rspack-contrib/rsbuild-plugin-toml","commit_stats":null,"previous_names":["rspack-contrib/rsbuild-plugin-toml"],"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-toml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-toml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-toml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-toml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspack-contrib","download_url":"https://codeload.github.com/rspack-contrib/rsbuild-plugin-toml/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.435Z","updated_at":"2025-04-14T10:20:44.384Z","avatar_url":"https://github.com/rspack-contrib.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"readme":"# @rsbuild/plugin-toml\n\nAn Rsbuild plugin to import TOML files and convert them to JavaScript objects.\n\n\u003e [TOML](https://toml.io/) is a semantically explicit, easy-to-read configuration file format.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/@rsbuild/plugin-toml\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/@rsbuild/plugin-toml?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-toml -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\n// rsbuild.config.ts\nimport { pluginToml } from \"@rsbuild/plugin-toml\";\n\nexport default {\n  plugins: [pluginToml()],\n};\n```\n\n## Example\n\nSuppose the project has the following code in `example.toml`:\n\n```toml title=\"example.toml\"\nhello = \"world\"\n\n[foo]\nbar = \"baz\"\n```\n\nAfter using the TOML plugin, you can reference it as follows:\n\n```js\nimport example from \"./example.toml\";\n\nconsole.log(example.hello); // 'world';\nconsole.log(example.foo); // { bar: 'baz' };\n```\n\n## Options\n\n### esModule\n\nBy default, `@rsbuild/plugin-toml` generates JS modules that use the ES modules syntax. If you want to generate a CommonJS module, you can set the `esModule` option to `false`.\n\n- Type: `boolean`\n- Default: `true`\n- Example:\n\n```js\npluginToml({\n  esModule: false,\n});\n```\n\n## Type Declaration\n\nWhen you import TOML files in TypeScript code, please create a `src/env.d.ts` file in your project and add the type declarations.\n\n```ts title=\"src/env.d.ts\"\ndeclare module \"*.toml\" {\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-toml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-toml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-toml/lists"}