skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

Upgrade `buffer` lib to support Deno #327

Open josephrocca opened 1 year ago

josephrocca commented 1 year ago

There was a fix in NPM buffer package at v5.3.0 which added support for environments like SES and Deno which require you to edit __proto__ via Object.setPrototypeOf (because it is much safer, see here for explanation). The fix basically just replaces all instances of this:

buf.__proto__ = Buffer.prototype

with this:

Object.setPrototypeOf(buf, Buffer.prototype)

IIUC, Skypack is using an older version which doesn't have this fix - but I'm not sure because I don't think the code is open source? So I might be mistaken - perhaps the Buffer package that's in my final bundle is coming from somewhere else - in which case please feel free to close, of course.