{"id":15631380,"url":"https://github.com/danielroe/unplugin-purge-polyfills","last_synced_at":"2025-04-08T13:07:32.888Z","repository":{"id":246342017,"uuid":"820804109","full_name":"danielroe/unplugin-purge-polyfills","owner":"danielroe","description":"A tiny plugin to replace package imports with better native code.","archived":false,"fork":false,"pushed_at":"2025-03-31T10:06:04.000Z","size":702,"stargazers_count":212,"open_issues_count":6,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-31T20:56:59.517Z","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":"2024-06-27T08:00:31.000Z","updated_at":"2025-03-31T10:05:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"aeddd9cc-be79-4726-bd2f-ffd964d0e50c","html_url":"https://github.com/danielroe/unplugin-purge-polyfills","commit_stats":{"total_commits":63,"total_committers":4,"mean_commits":15.75,"dds":0.5079365079365079,"last_synced_commit":"8d0987c71e6f5644e5ecb9ab1f0714458bc58b05"},"previous_names":["danielroe/unplugin-purge-polyfills"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Funplugin-purge-polyfills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Funplugin-purge-polyfills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Funplugin-purge-polyfills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Funplugin-purge-polyfills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielroe","download_url":"https://codeload.github.com/danielroe/unplugin-purge-polyfills/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847610,"owners_count":21006100,"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-03T10:40:11.721Z","updated_at":"2025-04-08T13:07:32.857Z","avatar_url":"https://github.com/danielroe.png","language":"TypeScript","funding_links":["https://github.com/sponsors/danielroe"],"categories":[],"sub_categories":[],"readme":"# unplugin-purge-polyfills\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 A tiny plugin to replace package imports with better native code.\n\nThis package is an [unplugin](https://unplugin.unjs.io/) which provides support for a wide range of bundlers.\n\nAt build time, it removes usage of these packages, in favour of directly using native replacements:\n\n- is-number\n- is-plain-object\n- is-primitve\n- is-regexp\n- is-travis\n- is-npm\n- clone-regexp\n- split-lines\n- is-windows\n- is-whitespace\n- is-string\n- is-odd\n- is-even\n- object.entries\n- date\n- array.of\n- number.isnan\n- array.prototype.findindex\n- array.from\n- object-is\n- array-map\n- is-nan\n- function-bind\n- regexp.prototype.flags\n- array.prototype.find\n- object-keys\n- define-properties\n- left-pad\n- pad-left\n- filter-array\n- array-every\n- index-of\n- last-index-of\n- abort-controller\n- array-flatten\n- array-includes\n- has-own\n- has-proto\n- has-symbols\n- object-assign\n- call-bind\n- es-get-iterator\n- es-set-tostringtag\n- is-array-buffer\n- is-boolean-object\n- is-date-object\n- is-negative-zero\n- is-number-object\n- is-primitive\n\nIt is under active development.\n\n## Roadmap\n\n- [ ] investigate tighter integration with https://github.com/SukkaW/nolyfill or https://github.com/es-tooling/module-replacements\n- [ ] implement publish-on-demand infrastructure to apply this plugin to published packages\n\n## Usage\n\nInstall package:\n\n```sh\n# npm\nnpm install --save-dev unplugin-purge-polyfills\n```\n\n```js\nimport { purgePolyfills } from 'unplugin-purge-polyfills'\n\n// rollup.config.js\nexport default {\n  plugins: [\n    purgePolyfills.rollup({ /* options */ }),\n  ],\n}\n```\n\n## Configuration\n\nBy default this unplugin ships with a wide range of polyfills to get rid of, but you can disable these and add your own by providing a `replacements` object:\n\n```js\n// rollup.config.js\nexport default {\n  plugins: [\n    purgePolyfills.rollup({\n      replacements: {\n        'is-string': false, /** do not provide this polyfill */\n        /**\n         * provide a custom polyfill for this import in your codebase\n         * make sure this is correct for every usage\n         */\n        'node.extend': {\n          default: '(obj1, obj2) =\u003e { ...obj2, ...obj1 }'\n        }\n      }\n    }),\n  ],\n}\n```\n\nThe following polyfills are not purged, so you might want to add your own code to do so:\n\n- node.extend\n- extend-shallow\n- xtend\n- defaults\n\n## Projects using or experimenting with `unplugin-purge-polyfill`\n\n- [nuxt/cli](https://github.com/nuxt/cli/pull/439)\n- [unjs/jiti](https://github.com/unjs/jiti/pull/261)\n\n## Credits\n\nThanks to https://github.com/es-tooling/module-replacements and https://github.com/esm-dev/esm.sh for polyfill data. ❤️\n\nInspiration from https://github.com/SukkaW/nolyfill. ❤️\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- Run interactive tests using `pnpm dev`\n\n## License\n\nMade with ❤️\n\nPublished under [MIT License](./LICENCE).\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/unplugin-purge-polyfills?style=flat-square\n[npm-version-href]: https://npmjs.com/package/unplugin-purge-polyfills\n[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-purge-polyfills?style=flat-square\n[npm-downloads-href]: https://npm.chart.dev/unplugin-purge-polyfills\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/danielroe/unplugin-purge-polyfills/ci.yml?branch=main\u0026style=flat-square\n[github-actions-href]: https://github.com/danielroe/unplugin-purge-polyfills/actions/workflows/ci.yml\n[codecov-src]: https://img.shields.io/codecov/c/gh/danielroe/unplugin-purge-polyfills/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/danielroe/unplugin-purge-polyfills\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Funplugin-purge-polyfills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielroe%2Funplugin-purge-polyfills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Funplugin-purge-polyfills/lists"}