Open cosbgn opened 1 year ago
I would love to support Edge runtimes! Do you have a solid way of detecting a package that doesn't support it?
Not really, I think the easiest is just to use wrangler dev
locally and see if an error comes up.
So far I've learned that:
import { Buffer } from 'node:buffer'
)nodejs_compat
flag helps a lot, can easily be activated on cloudflare and active by default on vercel-edgeeval(), new Function(), setTimeout([string]), and setInterval([string])
can't be used.Do you have an example code snippet for oas
that's not working with wrangler dev
? Would be helpful to see and debug. I know we only use ajv
in oas/reducer
, which isn't exported from any main export, and only really exists in this repository because it's used in https://github.com/readmeio/rdme
This is the started wrangler which fails on npm run start
: https://github.com/cosbgn/oas-edge
Ah gotcha, so its failing on oas-normalize
likely then. Moving that off ajv
is going to be a lot of work because we'll have to move @readme/openapi-parser and then rewrite @readme/better-ajv-errors as well. 😓
oas-normalize
would be great as well, but it's failing also without it, only with oas
check the new commit without normalize: https://github.com/cosbgn/oas-edge/blob/main/src/index.js
Woof, ok I see now.
As a feature request, it would be amazing if this library could work on
cloudflare workers
,deno
,vercel-edge
,netlify-edge
and other edge runtimes.These runtimes are gaining a lot of popularity lately, but unfortunately can't be used with this library. I guess this is also due to dependancies like
ajv
, but there are some edge ready alternatives like@cfworker/json-schema
.Thanks for considering it.