@webassemblyjs/wasm-gen
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3
0
12236
5
300
2
1
0
1
+ Added@webassemblyjs/ast@1.1.0
+ Added@webassemblyjs/ast@1.1.0(transitive)
+ Added@webassemblyjs/helper-leb128@1.1.0(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.1.0(transitive)
+ Added@webassemblyjs/wasm-parser@1.1.0(transitive)
+ Added@webassemblyjs/wast-parser@1.1.0(transitive)
+ Addedleb@0.3.0(transitive)
+ Addedwebassemblyjs@1.1.0(transitive)
- Removed@babel/generator@^7.0.0-beta.40
- Removed@babel/template@^7.0.0-beta.40
- Removed@babel/types@^7.0.0-beta.40
- Removed@webassemblyjs/wasm-parser@1.0.0
- Removedcommander@^2.14.1
- Removed@babel/generator@7.26.2(transitive)
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@webassemblyjs/ast@1.0.0(transitive)
- Removed@webassemblyjs/wasm-parser@1.0.0(transitive)
- Removed@webassemblyjs/wast-parser@1.0.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedwebassemblyjs@1.0.0(transitive)