{"id":13469578,"url":"https://github.com/folke/esbuild-runner","last_synced_at":"2025-05-14T04:10:15.129Z","repository":{"id":37700927,"uuid":"319321298","full_name":"folke/esbuild-runner","owner":"folke","description":"⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild","archived":false,"fork":false,"pushed_at":"2025-05-12T18:57:20.000Z","size":377,"stargazers_count":714,"open_issues_count":43,"forks_count":24,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T19:55:04.479Z","etag":null,"topics":["esbuild","esbuild-node","esbuild-runner","esnext","jest","node","nodejs","ts-node","tsnode","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/esbuild-runner","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/folke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2020-12-07T13:01:01.000Z","updated_at":"2025-04-27T10:55:12.000Z","dependencies_parsed_at":"2023-01-30T23:01:03.729Z","dependency_job_id":"2f0a6a24-0b6d-4f3b-867b-275c1fd4a4fd","html_url":"https://github.com/folke/esbuild-runner","commit_stats":{"total_commits":60,"total_committers":6,"mean_commits":10.0,"dds":0.25,"last_synced_commit":"d69bd4e6e99e775ec05b3b6b209b4d1f0d53e43c"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folke%2Fesbuild-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folke%2Fesbuild-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folke%2Fesbuild-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folke%2Fesbuild-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folke","download_url":"https://codeload.github.com/folke/esbuild-runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253814861,"owners_count":21968559,"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":["esbuild","esbuild-node","esbuild-runner","esnext","jest","node","nodejs","ts-node","tsnode","typescript"],"created_at":"2024-07-31T15:01:45.738Z","updated_at":"2025-05-14T04:10:10.085Z","avatar_url":"https://github.com/folke.png","language":"TypeScript","funding_links":[],"categories":["目录","TypeScript","typescript"],"sub_categories":["TypeScript"],"readme":"# :zap: Esbuild Runner (`esr`)\n\nSuper-fast on-the-fly transpilation of modern JS, TypeScript and JSX using [esbuild](https://github.com/evanw/esbuild).\n\n**esr** makes it easy to run arbitrary code or tests without needing to **build** your whole project. It's a great way to improve your development workflow.\n\n## ✨ Usage\n\nThe easiest way to use **esbuild-runner** is to install it globally and use the included `esr` binary.\n\n```shell\n$ esr hello-world.ts\n```\n\nAlternatively, you can _require_ **esbuild-runner** within any nodejs process to include realtime transpilation:\n\n```shell\n$ node -r esbuild-runner/register hello-world.ts\n```\n\nIn order to use **esbuild-runner** with Jest, you need to configure a [Jest transform](https://jestjs.io/docs/en/configuration.html#transform-objectstring-pathtotransformer--pathtotransformer-object) in your `jest.config.js`\n\n```js\nmodule.exports = {\n  transform: {\n    \"\\\\.ts$\": \"esbuild-runner/jest\",\n  },\n}\n```\n\nVSCode Debugging\n\n```JSON\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug with esbuild-runner\",\n      \"program\": \"${workspaceFolder}/hello-world.ts\",\n      \"runtimeArgs\": [\n        \"-r\",\n        \"esbuild-runner/register\"\n      ],\n      \"request\": \"launch\",\n      \"sourceMaps\": true,\n      \"skipFiles\": [\n        \"\u003cnode_internals\u003e/**\"\n      ],\n      \"type\": \"pwa-node\"\n    }\n  ]\n}\n```\n\n## ⚙️ Configuration\n\n`esr` provides two different ways to transpile your code:\n\n- **bundling** _(default)_: this transpiles the script and all its dependencies in typically one invocation of **esbuild**. Dependencies defined in `package.json` or `node_modules` will never be transpiled. Running `esr` will **always** transpile the code. No caching is used.\n- **transform** _(`--cache`)_: this method will invoke **esbuild** for **every source file**, but will cache the result. This means that the initial run will be slower, but after that, only changed source files will be transpiled.\n\n```shell\n$ bin/esr.js --help\nUsage: esr [options] \u003csource-file\u003e [file-options]\n\n  --cache       Transform on a file per file basis and cache code\n  --clearCache  Clear transform cache\n  --help|-h     Display this help message\n\n```\n\nTo customize the options passed to esbuild, you can create an `esbuild-runner.config.js` file in the current directory or one of the ancestor directories.\n\n```js\n// example esbuild-runner.config.js\nmodule.exports = {\n  type: \"bundle\", // bundle or transform (see description above)\n  esbuild: {\n    // Any esbuild build or transform options go here\n    target: \"esnext\",\n  },\n}\n```\n\n## 📦 Installation\n\nSimply install the **esbuild-runner** npm package using your favorite package manager.\n\n- globally ...\n\n```shell\n$ npm install -g esbuild-runner\n```\n\n- ... or locally in your project\n\n```shell\n$ npm add --dev esbuild-runner\n```\n\n## 👋 Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## ⚖ License\n\n[Apache 2.0](https://github.com/folke/esbuild-runner/blob/main/LICENSE)\n\n\u003c!-- markdownlint-disable-file MD014 MD033 --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolke%2Fesbuild-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolke%2Fesbuild-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolke%2Fesbuild-runner/lists"}