Provide package as a "default library" which only includes types
supported by our runtime.
Use TextEncoder and TextDecoder types matching the web standard to
reduce risk of issues with NPM libraries.
Wrap Date in a proxy, rather than subclass, to match native behavior
when called without new.
Avoid use of classes for global extensions, for globals which aren't
originally using classes.
Type internal runtime globals, but strip them on compilation.
Use declaration merging to keep user-defined host function signatures.
Note I renamed the js-runtime-prelude package to @extism/js-pdk, as it will need to be published to get the types out. Let me know, if it should be named differently.
@nilslice This PR targets your branch currently, I don't know if that's how you'd prefer this delivered. Let me know if I should just target main instead. :)
There's some leftover "todo: validate" from that PR as well in memory.ts. I left those in as I'm unsure what should be validated?
This is a continuation of @nilslice's awesome work in https://github.com/extism/js-pdk/pull/60.
Differences are:
new
.Note I renamed the js-runtime-prelude package to @extism/js-pdk, as it will need to be published to get the types out. Let me know, if it should be named differently.
@nilslice This PR targets your branch currently, I don't know if that's how you'd prefer this delivered. Let me know if I should just target main instead. :)
There's some leftover "todo: validate" from that PR as well in
memory.ts
. I left those in as I'm unsure what should be validated?