How to use the @webassemblyjs/validation function in @webassemblyjs/validation

To help you get started, we’ve selected a few @webassemblyjs/validation 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 xtuc / webassemblyjs / packages / webassemblyjs / src / compiler / compile / module.js View on Github external
export function createCompiledModule(ast: Program): CompiledModule {
  const exports: Array = [];
  const imports = [];

  let start;

  // Do compile-time ast manipulation in order to remove WAST
  // semantics during execution
  denormalizeTypeReferences(ast);
  wastIdentifierToIndex(ast);

  validateAST(ast);

  t.traverse(ast, {
    ModuleExport({ node }: NodePath) {
      if (node.descr.exportType === "Func") {
        exports.push({
          name: node.name,
          kind: "function"
        });
      }
    },

    Start({ node }: NodePath) {
      if (typeof start !== "undefined") {
        throw new CompileError("Multiple start functions is not allowed");
      }

@webassemblyjs/validation

Module AST validations

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis