How to use the @webassemblyjs/helper-wasm-section.removeSections function in @webassemblyjs/helper-wasm-section

To help you get started, we’ve selected a few @webassemblyjs/helper-wasm-section examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wasm-edit / esm / apply.js View on Github external
function applyDelete(ast, uint8Buffer, node) {
  var deltaElements = -1; // since we removed an element

  assertHasLoc(node);
  var sectionName = getSectionForNode(node);

  if (sectionName === "start") {
    var sectionMetadata = getSectionMetadata(ast, "start");
    /**
     * The start section only contains one element,
     * we need to remove the whole section
     */

    uint8Buffer = removeSections(ast, uint8Buffer, "start");

    var _deltaBytes = -(sectionMetadata.size.value + 1)
    /* section id */
    ;

    return {
      uint8Buffer: uint8Buffer,
      deltaBytes: _deltaBytes,
      deltaElements: deltaElements
    };
  } // replacement is nothing


  var replacement = [];
  uint8Buffer = overrideBytesInBuffer(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that
  node.loc.start.column, // $FlowIgnore: assertHasLoc ensures that
github flaviuse / mern-authentication / client / node_modules / @webassemblyjs / wasm-edit / esm / apply.js View on Github external
function applyDelete(ast, uint8Buffer, node) {
  var deltaElements = -1; // since we removed an element

  assertHasLoc(node);
  var sectionName = getSectionForNode(node);

  if (sectionName === "start") {
    var sectionMetadata = getSectionMetadata(ast, "start");
    /**
     * The start section only contains one element,
     * we need to remove the whole section
     */

    uint8Buffer = removeSections(ast, uint8Buffer, "start");

    var _deltaBytes = -(sectionMetadata.size.value + 1)
    /* section id */
    ;

    return {
      uint8Buffer: uint8Buffer,
      deltaBytes: _deltaBytes,
      deltaElements: deltaElements
    };
  } // replacement is nothing


  var replacement = [];
  uint8Buffer = overrideBytesInBuffer(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that
  node.loc.start.column, // $FlowIgnore: assertHasLoc ensures that
github xtuc / webassemblyjs / packages / wasm-edit / src / apply.js View on Github external
function applyDelete(ast: Program, uint8Buffer: Uint8Array, node: Node): State {
  const deltaElements = -1; // since we removed an element

  assertHasLoc(node);

  const sectionName = getSectionForNode(node);

  if (sectionName === "start") {
    const sectionMetadata = getSectionMetadata(ast, "start");

    /**
     * The start section only contains one element,
     * we need to remove the whole section
     */
    uint8Buffer = removeSections(ast, uint8Buffer, "start");

    const deltaBytes = -(sectionMetadata.size.value + 1); /* section id */

    return { uint8Buffer, deltaBytes, deltaElements };
  }

  // replacement is nothing
  const replacement = [];

  uint8Buffer = overrideBytesInBuffer(
    uint8Buffer,
    // $FlowIgnore: assertHasLoc ensures that
    node.loc.start.column,
    // $FlowIgnore: assertHasLoc ensures that
    node.loc.end.column,
    replacement
github xtuc / webassemblyjs / packages / wasm-strip / src / index.js View on Github external
export default function strip(bin: ArrayBuffer): ArrayBuffer {
  const ast = decode(bin, decoderOpts);

  let uint8Buffer = new Uint8Array(bin);

  uint8Buffer = removeSections(ast, uint8Buffer, "custom");

  return uint8Buffer.buffer;
}