brisa-build / brisa

The Web Platform Framework.
https://brisa.build
MIT License
453 stars 12 forks source link

output to `deno` to be more runtime-agnostic #196

Open aralroca opened 6 months ago

aralroca commented 6 months ago

Brisa was initially built with Bun, and there are Bun APIs that must continue to be used in runtime to go faster, like Bun.serve, but it is necessary to adapt it to be more runtime-agnostic and if the developers want the build can be generated and executed with Deno. To do this it is necessary to indicate the type of output because different module resolution rules and optimizations will be made. We did the same with Node.js in the past (now Node.js is a viable output), before version 1.0 it would be nice to do the same with Deno.

TODO:

aralroca commented 1 month ago

Maybe we can use this: https://srvx.unjs.io/

aralroca commented 20 hours ago

The other is to generate a deno.json with the import-maps to resolve the Node build-in and some mismatches during the build with Bun

Ex:

{
  "imports": {
    "fs/promises": "node:fs/promises",
    "path": "node:path"
  },
  "permissions": {
    "read": true,
    "write": true,
    "run": "inherit"
  }
}
aralroca commented 18 hours ago

FYI: Currently Deno works with output: "node", although it has no optimization since in Node.js the requests and response are transformed in runtime and does not use Deno.serve and only reads the deno.json if it is manually moved inside the build folder.

This is a good sign that soon output: "deno" will be available after adding these optimizations. I have updated the missing points to be done this week and Deno will be available in the next release.