Last active
October 17, 2024 09:06
-
-
Save hi-ogawa/411f2ad04d7701d1391974d22b217502 to your computer and use it in GitHub Desktop.
generate a link to evanw's source-map-visualization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/oxc-project/oxc/blob/a6487482bc053797f7f1a42f5793fafbd9a47114/crates/oxc_codegen/examples/sourcemap.rs#L34-L44 | |
function generate(code, mapJson) { | |
const hashRaw = `${code.length}\0${code}${mapJson.length}\0${mapJson}`; | |
// const hash = btoa(hashRaw); | |
const hash = Buffer.from(hashRaw, "utf-8").toString("base64"); | |
return `https://evanw.github.io/source-map-visualization/#` + hash; | |
} | |
console.log(generate(result.code, JSON.stringify(result.map))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment