Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bogeychan/elysia-polyfills

Collection of experimental Elysia.js polyfills
https://github.com/bogeychan/elysia-polyfills

deno elysia nodejs polyfills shims

Last synced: 11 days ago
JSON representation

Collection of experimental Elysia.js polyfills

Awesome Lists containing this project

README

        

# @bogeychan/elysia-polyfills

Collection of experimental [Elysia.js](https://elysiajs.com) polyfills:

| Package | [Node.js](https://nodejs.org) (v18.16.0) | [Deno](https://deno.land) (1.36.4#1,3) |
| ---------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------- |
| [elysia](https://npmjs.com/package/elysia) (0.6.19#2) | πŸ”¬ | πŸ”¬ |
| [@elysiajs/cors](https://www.npmjs.com/package/@elysiajs/cors) (0.6.0) | βœ… | βœ… |
| [@elysiajs/html](https://www.npmjs.com/package/@elysiajs/html) (0.6.4) | βœ… | βœ… |
| [@elysiajs/bearer](https://www.npmjs.com/package/@elysiajs/bearer) (0.6.0) | βœ… | βœ… |
| [@elysiajs/cookie](https://www.npmjs.com/package/@elysiajs/cookie) (0.6.1) | βœ… | βœ… |
| [@elysiajs/swagger](https://www.npmjs.com/package/@elysiajs/swagger) (0.6.1) | βœ… | βœ… |
| [@elysiajs/static](https://www.npmjs.com/package/@elysiajs/static) (0.6.0) | βœ… | βœ… |
| ... | ... | ... |

**_Legend_**

πŸ”¬ - Under testing

βœ… - Fully supported

⚠️ - Partial supported

❌ - Unsupported

## 🚩Notes

#1 With release [1.33.0](https://github.com/denoland/deno/releases/tag/v1.33.0), `Deno` introduced a new way to resolve `node_modules` dependencies. You need to update `@bogeychan/elysia-polyfills` to at least version `0.0.7` in order to be compatible.

#2 With version [0.5.15](https://github.com/elysiajs/elysia/issues/50), `Elysia.js` supports `CommonJS`. Therefore, a build step is no longer required. The plugins listed above can be used out of the box for `ESM` and `CommonJS` projects.

#3 With release [1.35.0](https://github.com/denoland/deno/releases/tag/v1.35.0), `Deno` stabilized the `Deno.serve()` API. From now on `Deno.serve()` is used instead of the [Deno Standard Modules](https://github.com/denoland/deno_std).

## Installation

```bash
yarn add @bogeychan/elysia-polyfills
```

## Usage

Checkout the [examples](./examples) folder on Github and follow its setup guide.

**_OR_** use an [Elysia.js scaffold](https://www.npmjs.com/package/create-elysia).

### Node.js

```ts
import '@bogeychan/elysia-polyfills/node/index.js';

import { Elysia } from 'elysia';

new Elysia().get('/', () => ({ hello: 'Node.jsπŸ‘‹' })).listen(8080);
```

Create a new `Node.js` project:

```bash
npm create elysia@latest my-elysia-app --template node-ts
```

### Deno

```ts
import 'npm:@bogeychan/elysia-polyfills/deno/index.js';

import { Elysia } from 'npm:elysia';

new Elysia().get('/', () => ({ hello: 'DenoπŸ‘‹' })).listen(8080);
```

Create a new `Deno` project:

```bash
deno run -r=npm:create-elysia --allow-read --allow-write npm:create-elysia my-elysia-app --template deno
```

## Author

[bogeychan](https://github.com/bogeychan)

## License

[MIT](LICENSE)