{"id":27096170,"url":"https://github.com/tiny-md/esbuild-plugin-peggy","last_synced_at":"2025-04-06T09:33:18.390Z","repository":{"id":283806816,"uuid":"952946768","full_name":"tiny-md/esbuild-plugin-peggy","owner":"tiny-md","description":"🔌 Seamlessly load .pegjs or .peggy grammar files in your esbuild pipeline","archived":false,"fork":false,"pushed_at":"2025-04-06T01:57:05.000Z","size":373,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T02:33:44.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiny-md.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tiny-md","mayank1513"],"polar":"mayank1513","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://pages.razorpay.com/mayank1513"]}},"created_at":"2025-03-22T07:58:37.000Z","updated_at":"2025-04-06T01:57:08.000Z","dependencies_parsed_at":"2025-04-06T02:30:52.974Z","dependency_job_id":null,"html_url":"https://github.com/tiny-md/esbuild-plugin-peggy","commit_stats":null,"previous_names":["tiny-md/esbuild-plugin-peggy"],"tags_count":1,"template":false,"template_full_name":"react18-tools/turborepo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-md%2Fesbuild-plugin-peggy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-md%2Fesbuild-plugin-peggy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-md%2Fesbuild-plugin-peggy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-md%2Fesbuild-plugin-peggy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiny-md","download_url":"https://codeload.github.com/tiny-md/esbuild-plugin-peggy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247426975,"owners_count":20937196,"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":[],"created_at":"2025-04-06T09:32:13.210Z","updated_at":"2025-04-06T09:33:18.382Z","avatar_url":"https://github.com/tiny-md.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tiny-md","https://github.com/sponsors/mayank1513","https://polar.sh/mayank1513","https://pages.razorpay.com/mayank1513"],"categories":[],"sub_categories":[],"readme":"# Esbuild Plugin Peggy \u003cimg src=\"https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png\" height=\"40\" alt=\"popper\"/\u003e\n\n[![Test](https://github.com/tiny-md/esbuild-plugin-peggy/actions/workflows/test.yml/badge.svg)](https://github.com/tiny-md/esbuild-plugin-peggy/actions/workflows/test.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/aa896ec14c570f3bb274/maintainability)](https://codeclimate.com/github/tiny-md/esbuild-plugin-peggy/maintainability)\n[![Coverage](https://codecov.io/gh/tiny-md/esbuild-plugin-peggy/graph/badge.svg)](https://codecov.io/gh/tiny-md/esbuild-plugin-peggy)\n[![npm version](https://img.shields.io/npm/v/esbuild-plugin-peggy.svg?colorB=green)](https://www.npmjs.com/package/esbuild-plugin-peggy)\n[![npm downloads](https://img.shields.io/npm/dm/esbuild-plugin-peggy.svg)](https://www.npmjs.com/package/esbuild-plugin-peggy)\n[![Bundle size](https://img.shields.io/bundlephobia/minzip/esbuild-plugin-peggy)](https://bundlephobia.com/package/esbuild-plugin-peggy)\n[![Gitpod Ready](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)\n\n\u003e 🔌 Seamlessly load `.pegjs` or `.peggy` grammar files directly into your esbuild pipeline\n\n---\n\n## ✨ Features\n\n- Compile `.pegjs` / `.peggy` files as ES modules with zero config\n- Fully compatible with both **JavaScript** and **TypeScript**\n- No Node.js-only dependencies get into your codebase — frontend safe!\n- Supports custom parser options and per-file overrides\n- Simple, fast, and modern integration with esbuild\n\n---\n\n## 📦 Installation\n\n```bash\npnpm add esbuild-plugin-peggy\n```\n\n**_or_**\n\n```bash\nnpm install esbuild-plugin-peggy\n```\n\n**_or_**\n\n```bash\nyarn add esbuild-plugin-peggy\n```\n\n---\n\n## 🚀 Usage\n\n```ts\n// esbuild.config.ts\nimport { build } from \"esbuild\";\nimport { peggyPlugin } from \"esbuild-plugin-peggy\";\n\nbuild({\n  entryPoints: [\"src/index.ts\"],\n  bundle: true,\n  outfile: \"dist/bundle.js\",\n  plugins: [peggyPlugin()],\n});\n```\n\nThen in your source code:\n\n```ts\nimport parser from \"./grammar.pegjs\";\n\nconst result = parser.parse(\"your input here\");\n```\n\n---\n\n## ⚙️ Plugin Options\n\nYou can pass either a global config or a list of per-file configs using `ParserBuildOptions` from [peggy](https://github.com/peggyjs/peggy).\n\n### Global options\n\n```ts\npeggyPlugin({\n  allowedStartRules: [\"Expression\"],\n});\n```\n\n### Per-file options\n\n```ts\npeggyPlugin([\n  {\n    pathPattern: /calculator\\.pegjs$/,\n    options: { allowedStartRules: [\"Calc\"] },\n  },\n]);\n```\n\n---\n\n## 📁 Supported File Types\n\n- `.pegjs`\n- `.peggy`\n\n---\n\n## 🛠 Example\n\n```ts\nimport parser from \"./math.pegjs\";\n\nconsole.log(parser.parse(\"2 + 2\")); // 4\n```\n\n---\n\n## ✅ Why Use This?\n\n- Skip manual parser builds — just import and use\n- Compatible with modern tooling and frameworks\n- Great for in-browser parsing and visual tooling\n- Keeps frontend builds clean of Node-only deps\n\n---\n\n\u003e \u003cimg src=\"https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png\" height=\"20\"/\u003e\n\u003e Star this [repository](https://github.com/tiny-md/esbuild-plugin-peggy) and share it with friends.\n\n---\n\n## 📜 License\n\nLicensed under the **MPL-2.0** license.\n© [Mayank Chaudhari](https://github.com/mayank1513)\n\n---\n\n\u003e \u003cimg src=\"https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png\" height=\"20\"/\u003e\n\u003e 📚 Enroll in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsor](https://github.com/sponsors/mayank1513) our work.\n\n---\n\n\u003cp align=\"center\"\u003e\u003csub\u003eMade with 💖 by \u003ca href=\"https://mayank-chaudhari.vercel.app\" target=\"_blank\"\u003eMayank Kumar Chaudhari\u003c/a\u003e\u003c/sub\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-md%2Fesbuild-plugin-peggy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiny-md%2Fesbuild-plugin-peggy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-md%2Fesbuild-plugin-peggy/lists"}