{"id":15642845,"url":"https://github.com/danielroe/rollup-plugin-pure","last_synced_at":"2025-04-04T22:05:33.750Z","repository":{"id":65927905,"uuid":"602629099","full_name":"danielroe/rollup-plugin-pure","owner":"danielroe","description":"Annotate functions as pure for Rollup","archived":false,"fork":false,"pushed_at":"2024-10-29T09:25:36.000Z","size":675,"stargazers_count":65,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T11:41:54.490Z","etag":null,"topics":[],"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/danielroe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["danielroe"]}},"created_at":"2023-02-16T16:02:52.000Z","updated_at":"2024-10-28T03:03:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e0cc655-09e0-44b9-97ab-434769721d9f","html_url":"https://github.com/danielroe/rollup-plugin-pure","commit_stats":{"total_commits":261,"total_committers":5,"mean_commits":52.2,"dds":0.07662835249042144,"last_synced_commit":"8c3811d4b3c649d57127f74a69063d827fd08922"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Frollup-plugin-pure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Frollup-plugin-pure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Frollup-plugin-pure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Frollup-plugin-pure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielroe","download_url":"https://codeload.github.com/danielroe/rollup-plugin-pure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"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":"2024-10-03T11:57:46.239Z","updated_at":"2025-04-04T22:05:33.732Z","avatar_url":"https://github.com/danielroe.png","language":"TypeScript","funding_links":["https://github.com/sponsors/danielroe"],"categories":[],"sub_categories":[],"readme":"# `rollup-plugin-pure`\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions][github-actions-src]][github-actions-href]\n[![Codecov][codecov-src]][codecov-href]\n\n\u003e Automatically add `/* #__PURE__ */` annotations before definition functions\n\n- [✨ \u0026nbsp;Changelog](https://github.com/danielroe/rollup-plugin-pure/blob/main/CHANGELOG.md)\n- [▶️ \u0026nbsp;Online playground](https://stackblitz.com/github/danielroe/rollup-plugin-pure/tree/main/playground)\n\n## Features\n\n- ⚡️ avoids end-users bundling unused code\n\n## How it works\n\nDefinition functions (for example, in Vue with `defineComponent`) are increasingly common but do not play nice with tree-shaking. It's not possible to tell whether or not a function call which receives an object can be tree-shaken from a build, as it's possible there might be side effects.\n\nRollup supports `/* @__PURE__ */` annotations to declare this from a library author's point of view, but it can be tricky when we know that _every_ occurrence of a function call is pure.\n\nThis plugin will automatically inject the annotation before any occurrence of the function call, as well as injecting `/* @__NO_SIDE_EFFECTS__ */` annotations in front of function declarations.\n\n## Installation\n\nInstall and add `rollup-plugin-pure` to your Vite or Rollup config.\n\n```bash\npnpm add -D rollup-plugin-pure\n```\n\n```js\nimport { PluginPure } from 'rollup-plugin-pure'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n    PluginPure({\n      functions: ['defineComponent', /^define(Page|Meta)$/],\n      include: [/(?\u003c!im)pure\\.js$/],\n      // exclude: [],\n      // sourcemap: true,\n    }),\n  ],\n})\n```\n\n## 💻 Development\n\n- Clone this repository\n- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`\n- Install dependencies using `pnpm install`\n- Stub module with `pnpm dev:prepare`\n- Run `pnpm dev` to start [playground](./playground) in development mode\n\n## License\n\nMade with ❤️\n\nPublished under the [MIT License](./LICENCE).\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/rollup-plugin-pure?style=flat-square\n[npm-version-href]: https://npmjs.com/package/rollup-plugin-pure\n[npm-downloads-src]: https://img.shields.io/npm/dm/rollup-plugin-pure?style=flat-square\n[npm-downloads-href]: https://npm.chart.dev/rollup-plugin-pure\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/danielroe/rollup-plugin-pure/ci.yml?branch=main\n[github-actions-href]: https://github.com/danielroe/rollup-plugin-pure/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/gh/danielroe/rollup-plugin-pure/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/danielroe/rollup-plugin-pure\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Frollup-plugin-pure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielroe%2Frollup-plugin-pure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Frollup-plugin-pure/lists"}