-
Notifications
You must be signed in to change notification settings - Fork 24
Closed as not planned
Labels
stalePRs or issues that have been stalePRs or issues that have been stale
Description
Perhaps adding an additional safeguard on the transform output could increase trust in the shipped base64 wasm file
PoC on top of the package public API (but embedding that inside the package might avoid double conversion)
const transformedBuf = Buffer.from(transformed)
if (sourceBuf.length !== transformedBuf.length) throw new Error('length mismatch')
for (let i = 0; i < transformedBuf.length; i++) {
// should match either the source buffer or spaces or semicolon: https://github.com/swc-project/swc/issues/9331
const val = transformedBuf[i]
if (val !== sourceBuf[i] && val !== 0x20 && val !== 0x3b) throw new Error('result mismatch')
}
That seems to work on simple examples, I wonder how something like this (minus the extra buffer<->string conversions) would affect perf
Metadata
Metadata
Assignees
Labels
stalePRs or issues that have been stalePRs or issues that have been stale