{"id":13799733,"url":"https://github.com/seamapi/ava-typescript-worker","last_synced_at":"2026-03-12T09:47:06.561Z","repository":{"id":57685001,"uuid":"484086476","full_name":"seamapi/ava-typescript-worker","owner":"seamapi","description":"🪄 register shared TypeScript workers with AVA","archived":false,"fork":false,"pushed_at":"2025-02-10T19:59:26.000Z","size":353,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-11T10:15:54.082Z","etag":null,"topics":["ava","esbuild","typescript","worker"],"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/seamapi.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}},"created_at":"2022-04-21T14:34:51.000Z","updated_at":"2025-01-31T12:53:11.000Z","dependencies_parsed_at":"2024-01-02T23:41:38.130Z","dependency_job_id":"6e1c5f50-3e29-4e0f-9436-9e98e39acd34","html_url":"https://github.com/seamapi/ava-typescript-worker","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2857142857142857,"last_synced_commit":"603703d151d1e7d6a32d695adfa441ec1fb5bd73"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/seamapi/ava-typescript-worker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fava-typescript-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fava-typescript-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fava-typescript-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fava-typescript-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seamapi","download_url":"https://codeload.github.com/seamapi/ava-typescript-worker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fava-typescript-worker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007457,"owners_count":26084313,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ava","esbuild","typescript","worker"],"created_at":"2024-08-04T00:01:05.557Z","updated_at":"2025-10-11T14:30:43.240Z","avatar_url":"https://github.com/seamapi.png","language":"TypeScript","readme":"# ava-typescript-worker\n\n[AVA](https://github.com/avajs/ava) has a really cool feature called [shared workers](https://github.com/avajs/ava/blob/843644b10fa2d3a9e6449f6022c40119c22fc9cf/docs/recipes/shared-workers.md).\n\nBut when using TypeScript and AVA with on-the-fly transpilation with something like [tsx](https://www.npmjs.com/package/tsx), loaded worker files are not transpiled--meaning you're limited to just using Javascript.\n\nThis library fixes that and allows you to register and load TypeScript workers.\n\n## Installation\n\n```bash\nnpm install ava-typescript-worker --save-dev\n```\n\nor\n\n```bash\nyarn add ava-typescript-worker --dev\n```\n\n## Usage\n\nFor the most part, shared workers behave identically with a few differences.\n\nHere's an example of what a worker might look like:\n\n`test.ts`:\n\n```typescript\nimport test from \"ava\"\nimport { registerSharedTypeScriptWorker } from \"ava-typescript-worker\"\nimport path from \"path\"\n\nconst worker = registerSharedTypeScriptWorker({\n  filename: path.resolve(\"echo.worker.ts\"),\n})\n\ntest(\"is worker available\", async (t) =\u003e {\n  await worker.available()\n  t.pass()\n})\n```\n\n`echo.worker.ts`:\n\n```typescript\nimport { SharedWorker } from \"ava/plugin\"\n\nconst echo = async (protocol: SharedWorker.Protocol) =\u003e {\n  for await (const msg of protocol.subscribe()) {\n    msg.reply(msg.data)\n  }\n}\n\nexport default echo\n```\n\nNotice that:\n\n- `supportedProtocols` cannot be passed as an option to `registerSharedTypeScriptWorker()`\n- Workers don't need to do protocol negotiation with `await negotiateProtocol([\"ava-4\"]).ready()`\n\nThis is because TypeScript files are loaded through a Javascript \"proxy\" loader, which handles protocol negotiations out of necessity.\n","funding_links":[],"categories":["Official Projects","Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fava-typescript-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseamapi%2Fava-typescript-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fava-typescript-worker/lists"}