{"id":13596288,"url":"https://github.com/marcofugaro/browserslist-to-esbuild","last_synced_at":"2025-04-12T19:48:31.273Z","repository":{"id":71336086,"uuid":"413908137","full_name":"marcofugaro/browserslist-to-esbuild","owner":"marcofugaro","description":"Get esbuild-compatible targets from a browserlist config or project","archived":false,"fork":false,"pushed_at":"2024-04-29T07:59:47.000Z","size":539,"stargazers_count":101,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T19:48:27.658Z","etag":null,"topics":["browsers","browserslist","esbuild","esbuild-plugin","targets"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/marcofugaro.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":"2021-10-05T17:04:15.000Z","updated_at":"2025-04-12T17:25:03.000Z","dependencies_parsed_at":"2024-01-23T10:08:27.061Z","dependency_job_id":"def3d20b-b8c9-4585-b08e-202adb2319ff","html_url":"https://github.com/marcofugaro/browserslist-to-esbuild","commit_stats":{"total_commits":12,"total_committers":3,"mean_commits":4.0,"dds":"0.16666666666666663","last_synced_commit":"23d12558733a2474412c5897c0a64518127bca40"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"sindresorhus/node-module-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fbrowserslist-to-esbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fbrowserslist-to-esbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fbrowserslist-to-esbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fbrowserslist-to-esbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcofugaro","download_url":"https://codeload.github.com/marcofugaro/browserslist-to-esbuild/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625500,"owners_count":21135513,"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":["browsers","browserslist","esbuild","esbuild-plugin","targets"],"created_at":"2024-08-01T16:02:15.757Z","updated_at":"2025-04-12T19:48:31.254Z","avatar_url":"https://github.com/marcofugaro.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# browserslist-to-esbuild\n\n\u003e Use [browserslist](https://github.com/browserslist/browserslist) with [esbuild](https://esbuild.github.io/).\n\nAllows you to use browserslist and pass the correct browsers to esbuild's [target](https://esbuild.github.io/api/#target) option.\n\n## Install\n\nYou have to install the `browserslist` package as well in your project:\n\n```\nnpm install --save-dev browserslist browserslist-to-esbuild\n```\n\nor\n\n```\nyarn add --dev browserslist browserslist-to-esbuild\n```\n\n## Usage\n\nYou can call `browserslistToEsbuild()` directly in your `esbuild.mjs` script, it will look for your browserslist config in either `package.json` or the `.browserslistrc`.\n\nIt will return an esbuild-compatible array of browsers.\n\n```js\nimport { build } from 'esbuild'\nimport browserslistToEsbuild from 'browserslist-to-esbuild'\n\nawait build({\n  entryPoints: ['input.js'],\n  outfile: 'output.js',\n  bundle: true,\n  target: browserslistToEsbuild(), // --\u003e [\"chrome79\", \"edge92\", \"firefox91\", \"safari13.1\"]\n})\n```\n\nOtherwise, you can pass yourself a browserslist string or array to the function.\n\n```js\nbrowserslistToEsbuild('\u003e0.2%, not dead')\n```\n\n## API\n\n### browserslistToEsbuild(browserslistConfig?, options?)\n\n#### browserslistConfig\n\nType: `string | string[] | undefined`\n\nA string or array of strings of browsers [compatible with browserslist](https://github.com/browserslist/browserslist#full-list). If none is passed, a browserslist config is searched in the script running directory.\n\n#### options\n\nType: `object | undefined`\n\nAn object containing the options that will be forwarded to browserslist. You can check out the [browserslist options documentation](https://github.com/browserslist/browserslist?tab=readme-ov-file#js-api) to see all the options available.\n\n## CLI\n\nYou can also use this package on the cli to test out the command in your project.\nIf no argument is passed, the browserslist config is searched in the script running directory.\n\nHere is some example usage:\n\n```bash\n$ npx browserslist-to-esbuild\nchrome109 edge118 firefox115 ios15.6 opera102 safari15.6\n\n$ npx browserslist-to-esbuild '\u003e0.2%, not dead'\nchrome103 edge87 firefox115 ios12.2 opera102 safari14.1\n\n$ npx browserslist-to-esbuild '\u003e0.2%' 'not dead'\nchrome103 edge87 firefox115 ios12.2 opera102 safari14.1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcofugaro%2Fbrowserslist-to-esbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcofugaro%2Fbrowserslist-to-esbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcofugaro%2Fbrowserslist-to-esbuild/lists"}