Replace the obsolete internal compat flags module#4630
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
d1a6a85 to
a7e4f36
Compare
Use the globalThis.Cloudflare instead.
33d1482 to
d11efc3
Compare
| @@ -0,0 +1,3 @@ | |||
| declare namespace Cloudflare { | |||
| const compatibilityFlags: Record<string, boolean>; | |||
| } | |||
There was a problem hiding this comment.
@penalosa ... it should be possible to generate this directly from the compat flags capnp definitions, both for internal and external use. If you can help guide I can do the work ;-)
the structure is simple...
declare namespace Cloudflare {
const compatibilityFlags: {
readonly foo: boolean,
//...
};
}
Where there is one readonly foo: boolean entry for every enable flag in the capnp.
There was a problem hiding this comment.
What about adding a js script, that uses capnp-es, to tools folder that updates flags.d.TS and we import that file in here?
There was a problem hiding this comment.
Yeah something like that should work. I don't think it's worth blocking on it tho. This is something we can incrementally improve on.
There was a problem hiding this comment.
Going to mark this resolved so I can merge but will unresolve it after so we don't forget ;-)
Use the globalThis.Cloudflare instead.
As a follow-up todo for later, we should look at automatically generating types from the compat flag definitions so that
globalThis.Cloudflarecan be more than just aRecord<string, boolean | undefined>/cc @penalosa