fastify-autoload icon indicating copy to clipboard operation
fastify-autoload copied to clipboard

feat: Add Bun and Deno to typescript support check

Open Codex- opened this issue 1 year ago • 3 comments

This change allows the Bun and Deno runtimes to use this loader with Fastify base without erroring as seen in #317.

Tests

Node

No regressions, everything passing.

Bun

  • bun run typescript
  • bun run typescript:jest
  • bun run typescript:vitest
  • bun run unit
    • unit.js updated to consume an arg for the runtime
  • The bun equivalent of the loader tests that execute test/typescript/basic.ts cannot be run as a particular function Tap uses has not yet been implemented in Bun
    • NotImplementedError: node:v8 Serializer is not yet implemented in Bun.

Deno

  • deno task typescript
  • Deno implements ServerResponse as a class, while node a function, which causes this error in Fastify.
    • Class constructor ServerResponse cannot be invoked without 'new'
    • This causes the following to fail
      • deno task typescript:jest
      • deno task typescript:vitest
      • deno task unit

While it has already been communicated that Fastify is not actively supporting either Bun or Deno runtimes, despite the results, it would be great to see this check updated to allow their usage at a "ymmv" degree.

Fixes #317

Checklist

Codex- avatar Aug 24 '24 15:08 Codex-

Currently we do not support Bun or Deno on Fastify.

While I understand that is the official stance, as noted in your link, with all of the other supported tooling already included would it really do any harm to simply allow this check to pass for these runtimes?

and I would not accept a PR without tests either.

You beat me to it, I amended my commit with the bun tests I intended to push originally :)

Fastify is simply incompatible with Deno currently, I'm happy to include another test run file to run against deno but it will fail and not add value

Codex- avatar Aug 24 '24 15:08 Codex-

Please merge, this is the only problem I have faced regarding bun support in fastify. For anyone else stumbling on this: Adding FASTIFY_AUTOLOAD_TYPESCRIPT=true to your .env is a temporary fix

MrEAlderson avatar Sep 10 '24 14:09 MrEAlderson

Resolved the conflict but it's failing now, I'll check why when I get home

gurgunday avatar Sep 10 '24 17:09 gurgunday

@gurgunday any news about this?

ilteoood avatar Oct 24 '25 14:10 ilteoood

@ilteoood honestly I totally forgot about this one, you (or the original author) can take it over

gurgunday avatar Oct 24 '25 21:10 gurgunday

The repo is archived. So no way to keep this PR.

Uzlopak avatar Oct 24 '25 22:10 Uzlopak

Superseeded by #480

Uzlopak avatar Oct 25 '25 09:10 Uzlopak