{"id":18245978,"url":"https://github.com/rolldown/rolldown-plugin-node-polyfills","last_synced_at":"2025-04-04T14:31:10.863Z","repository":{"id":252749090,"uuid":"841337775","full_name":"rolldown/rolldown-plugin-node-polyfills","owner":"rolldown","description":"Polyfill Node.js built-ins for Rolldown","archived":false,"fork":false,"pushed_at":"2024-08-12T08:11:01.000Z","size":302,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T19:39:15.909Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rolldown.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-08-12T07:53:17.000Z","updated_at":"2025-03-07T00:17:07.000Z","dependencies_parsed_at":"2024-08-12T09:24:30.146Z","dependency_job_id":null,"html_url":"https://github.com/rolldown/rolldown-plugin-node-polyfills","commit_stats":null,"previous_names":["rolldown/rolldown-plugin-node-polyfills"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolldown%2Frolldown-plugin-node-polyfills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolldown%2Frolldown-plugin-node-polyfills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolldown%2Frolldown-plugin-node-polyfills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolldown%2Frolldown-plugin-node-polyfills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rolldown","download_url":"https://codeload.github.com/rolldown/rolldown-plugin-node-polyfills/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247193956,"owners_count":20899401,"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-11-05T09:23:48.133Z","updated_at":"2025-04-04T14:31:10.452Z","avatar_url":"https://github.com/rolldown.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @rolldown/plugin-node-polyfills\n\nThis is a node polyfills plugin for [Rolldown](https://rolldown.rs/), largely based on the original [rollup-plugin-polyfill-node](https://github.com/FredKSchott/rollup-plugin-polyfill-node) by @fks, which is in turn a fork of [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills).\n\nThe reason for a Rolldown-specific version is because Rolldown natively supports [esbuild-style `inject` option](https://esbuild.github.io/api/#inject), which removes the need for [@rollup/plugin-inject](https://github.com/rollup/plugins/tree/master/packages/inject#readme), which is used to inject polyfills for globals like `Buffer`. Rolldown's native `inject` is many times more efficient than a plugin because it completely avoids extra AST parse and traversals.\n\n## Quickstart\n\n```\nnpm install --save-dev @rolldown/plugin-node-polyfills\n```\n\n```js\nimport { rolldown } from 'rolldown'\nimport nodePolyfills from '@rolldown/plugin-node-polyfills'\n\nrolldown({\n  entry: 'main.js',\n  plugins: [nodePolyfills()]\n})\n```\n\n## Node.js Builtin Support Table\n\nThe following modules include ES6 specific version which allow you to do named imports in addition to the default import and should work fine if you only use this plugin.\n\n- process*\n- events\n- stream*\n- util*\n- path\n- buffer*\n- querystring\n- url*\n- string_decoder*\n- punycode\n- http*†\n- https*†\n- os*\n- assert*\n- constants\n- timers*\n- console*‡\n- vm*§\n- zlib*\n- tty\n- domain\n- dns∆\n- dgram∆\n- child_process∆\n- cluster∆\n- module∆\n- net∆\n- readline∆\n- repl∆\n- tls∆\n- fs˚\n- crypto˚\n- perf_hooks˚ - **New:* just an empty shim for now, but would love help building a true polyfill!*\n\n\n† the http and https modules are actually the same and don't differentiate based on protocol\n\n‡ default export only, because it's console, seriously just use the global\n\n§ vm does not have all corner cases and has less of them in a web worker\n\n∆ not shimmed, just returns mock\n\n˚ shimmed, but too complex to polyfill fully. Avoid if at all possible. Some bugs and partial support expected. \n\nNot all included modules bundle equally, streams (and by extension anything that requires it like http) are a mess of circular references that are pretty much impossible to tree-shake out, similarly url methods are actually a shortcut to a url object so those methods don't tree shake out very well, punycode, path, querystring, events, util, and process tree shake very well especially if you do named imports.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolldown%2Frolldown-plugin-node-polyfills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frolldown%2Frolldown-plugin-node-polyfills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolldown%2Frolldown-plugin-node-polyfills/lists"}