New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hono/bun-transpiler

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/bun-transpiler

Bun Transpiler Middleware for Hono

0.2.0
latest
Source
npm
Version published
Weekly downloads
6
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Bun Transpiler middleware for Hono

The Bun Transpiler middleware is a Hono middleware designed to transpile content such as TypeScript or TSX. You can place your script written in TypeScript in a directory and serve it using serveStatic. When you apply this middleware, your script will automatically be served transpiled into JavaScript code.

This middleware works only with Bun.

Usage

Installation

npm i @hono/bun-transpiler

Example

import { Hono } from 'hono'
import { serveStatic } from 'hono/bun'
import { bunTranspiler } from '@hono/bun-transpiler'

const app = new Hono()

app.get('/static/:scriptName{.+.tsx?}', bunTranspiler())
app.get('/static/*', serveStatic({ root: './' }))

export default app

Notes

  • This middleware does not have a cache feature. If you want to cache the transpiled code, use Cache Middleware or your own custom middleware.

Author

Florian Kapaun https://github.com/floriankapaun

Heavily inspired by esbuild-transpiler by Andres C. Rodriguez and Yusuke Wada.

License

MIT

FAQs

Package last updated on 11 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts