{"id":21565120,"url":"https://github.com/cfware/fastify-babel","last_synced_at":"2025-04-10T13:08:23.056Z","repository":{"id":57233262,"uuid":"134597825","full_name":"cfware/fastify-babel","owner":"cfware","description":"Fastify plugin for processing Javascript with babel.","archived":false,"fork":false,"pushed_at":"2023-10-15T21:05:32.000Z","size":71,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T03:01:58.003Z","etag":null,"topics":["babel","fastify","fastify-plugin"],"latest_commit_sha":null,"homepage":null,"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/cfware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"tidelift":"npm/fastify-babel"}},"created_at":"2018-05-23T16:31:55.000Z","updated_at":"2022-10-29T21:52:12.000Z","dependencies_parsed_at":"2024-06-21T16:53:17.820Z","dependency_job_id":"95c71cc1-acb8-4a99-a49d-8377be3f5f87","html_url":"https://github.com/cfware/fastify-babel","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Ffastify-babel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Ffastify-babel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Ffastify-babel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Ffastify-babel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfware","download_url":"https://codeload.github.com/cfware/fastify-babel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248224359,"owners_count":21068073,"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":["babel","fastify","fastify-plugin"],"created_at":"2024-11-24T10:18:29.165Z","updated_at":"2025-04-10T13:08:23.030Z","avatar_url":"https://github.com/cfware.png","language":"JavaScript","readme":"# fastify-babel [![NPM Version][npm-image]][npm-url]\n\nFastify Babel plugin for development servers\n\n### Never load this plugin on production servers\n\nThe purpose of this module is for running a test HTTP server directly from\nsources.  Babel transformations are not async and all additional requests are\nblocked while transformation is in process.\n\nYou should always use a build step to install pre-transformed files to production\nservers.\n\n### Install fastify-babel\n\nThis module requires node.js 10 or above.  It is should normally be used\nwith `fastify-static \u003e= 0.12.0`.  This module requires the local filename\nto be in `payload.filename`.\n\n```sh\nnpm i --save-dev fastify-babel @babel/core\n```\n\n## Usage\n\n```js\n'use strict';\n\nconst path = require('path');\nconst fastify = require('fastify')();\nconst fastifyStatic = require('fastify-static');\nconst fastifyBabel = require('fastify-babel');\n\nfastify\n\t.register(fastifyStatic, {\n\t\troot: path.join(__dirname, 'html/myapp'),\n\t\tprefix: '/myapp',\n\t})\n\t.register(fastifyStatic, {\n\t\troot: path.join(__dirname, 'node_modules'),\n\t\tprefix: '/node_modules',\n\t\tdecorateReply: false,\n\t})\n\t.register(fastifyBabel, {\n\t\tbabelrc: {\n\t\t\tplugins: ['bare-import-rewrite'],\n\t\t},\n\t})\n\t.listen(3000, '127.0.0.1', err =\u003e {\n\t\tif (err) {\n\t\t\tthrow err;\n\t\t}\n\t\tconsole.log(`server listening at http://127.0.0.1:${fastify.server.address().port}/`);\n\t});\n```\n\nIn addition to `fastify-babel` this example requires `fastify-static` and\n`babel-plugin-bare-import-rewrite`.\n\n## Options\n\n### `babelrc`\n\nAn object provided directly to babel for each request that is processed.\nDefault is empty.\n\n### `babelTypes`\n\nA `RegExp` object used to match the `Content-Type` header.  Only replies with\nmatching header will be processed by babel.  Default `/(java|ecma)script/`.\n\n### `maskError`\n\nSetting this to `false` will allow the full error message to be displayed.  By\ndefault errors are masked to prevent disclosure of server details.\n\n### `cache`\n\nA Map-like object for caching transform results.  This object must have support\nfor both `get` and `set` methods.\n\n### `cacheHashSalt`\n\nA string used to salt the hash of source content.\n\n## `fastify-babel` for enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of `fastify-babel` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-fastify-babel?utm_source=npm-fastify-babel\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo)\n\n[npm-image]: https://img.shields.io/npm/v/fastify-babel.svg\n[npm-url]: https://npmjs.org/package/fastify-babel\n","funding_links":["https://tidelift.com/funding/github/npm/fastify-babel","https://tidelift.com/subscription/pkg/npm-fastify-babel?utm_source=npm-fastify-babel\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfware%2Ffastify-babel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfware%2Ffastify-babel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfware%2Ffastify-babel/lists"}