What is @webassemblyjs/helper-code-frame?
The @webassemblyjs/helper-code-frame npm package is designed to help generate code frames in WebAssembly files. This is particularly useful for debugging and error reporting, where you need to highlight specific parts of the code to the user.
Generate code frames
This feature allows developers to generate a code frame from a WebAssembly source code. It highlights a specific part of the code based on the provided location, which is useful for pinpointing errors or important sections in the code.
const { codeFrameFromSource } = require('@webassemblyjs/helper-code-frame');
const wasmSource = '...';
const location = { start: { line: 1, column: 5 }, end: { line: 1, column: 10 } };
const frame = codeFrameFromSource(wasmSource, location);
console.log(frame);