Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webassemblyjs/wasm-gen

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webassemblyjs/wasm-gen - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

lib/encoder/index.js

49

lib/index.js

@@ -1,32 +0,37 @@

var _require = require("@webassemblyjs/wasm-parser"),
decode = _require.decode;
"use strict";
var printText = require("./printers/text");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.encodeNode = encodeNode;
exports.encodeU32 = void 0;
var printMarkdown = require("./printers/markdown");
var encoder = _interopRequireWildcard(require("./encoder"));
var printJavaScript = require("./printers/javascript");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
module.exports = function (buff, _ref) {
var out = _ref.out,
url = _ref.url;
var ast = decode(buff);
function encodeNode(n) {
switch (n.type) {
case "ModuleImport":
// $FlowIgnore: ModuleImport ensure that the node is well formated
return encoder.encodeModuleImport(n);
switch (out) {
case "text":
return printText(ast);
case "SectionMetadata":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeSectionMetadata(n);
case "md":
case "markdown":
return printMarkdown(ast);
case "CallInstruction":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeCallInstruction(n);
case "js":
case "javascript":
return printJavaScript(ast, {
url: url
});
case "ModuleExport":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeModuleExport(n);
default:
throw new Error("Unsupported output: " + out);
throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type));
}
};
}
var encodeU32 = encoder.encodeU32;
exports.encodeU32 = encodeU32;
{
"name": "@webassemblyjs/wasm-gen",
"version": "1.0.0",
"description": "Emit documentation/code for your WASM binary Edit",
"keywords": [
"webassembly",
"javascript",
"wasm",
"binary",
"markdown"
],
"main": "src/index.js",
"version": "1.1.0",
"description": "",
"main": "lib/index.js",
"scripts": {
"test": "mocha"
"test": "echo \"Error: no test specified\" && exit 1"
},

@@ -25,12 +18,7 @@ "repository": {

"license": "GPL-2.0",
"bin": {
"wasmgen": "src/cli.js"
},
"dependencies": {
"@babel/generator": "^7.0.0-beta.40",
"@babel/template": "^7.0.0-beta.40",
"@babel/types": "^7.0.0-beta.40",
"@webassemblyjs/wasm-parser": "1.0.0",
"commander": "^2.14.1"
"@webassemblyjs/ast": "1.1.0",
"@webassemblyjs/helper-leb128": "1.1.0",
"@webassemblyjs/helper-wasm-bytecode": "1.1.0"
}
}

@@ -1,25 +0,30 @@

const { decode } = require("@webassemblyjs/wasm-parser");
// @flow
const printText = require("./printers/text");
const printMarkdown = require("./printers/markdown");
const printJavaScript = require("./printers/javascript");
import * as encoder from "./encoder";
module.exports = function(buff, { out, url }) {
const ast = decode(buff);
export function encodeNode(n: Node): Array<Byte> {
switch (n.type) {
case "ModuleImport":
// $FlowIgnore: ModuleImport ensure that the node is well formated
return encoder.encodeModuleImport(n);
switch (out) {
case "text":
return printText(ast);
case "SectionMetadata":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeSectionMetadata(n);
case "md":
case "markdown":
return printMarkdown(ast);
case "CallInstruction":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeCallInstruction(n);
case "js":
case "javascript":
return printJavaScript(ast, { url });
case "ModuleExport":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeModuleExport(n);
default:
throw new Error("Unsupported output: " + out);
throw new Error(
"Unsupported encoding for node of type: " + JSON.stringify(n.type)
);
}
};
}
export const encodeU32 = encoder.encodeU32;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc