Socket
Socket
Sign inDemoInstall

@webassemblyjs/ast

Package Overview
Dependencies
11
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.4 to 1.2.5

30

lib/traverse.js

@@ -11,12 +11,2 @@ "use strict";

var partialEvaluation = require("webassemblyjs/lib/interpreter/partial-evaluation");
var _require = require("webassemblyjs/lib/interpreter/runtime/values/memory"),
Memory = _require.Memory;
var _require2 = require("webassemblyjs/lib/interpreter/kernel/memory"),
createAllocator = _require2.createAllocator;
var t = require("./index");
function removeNodeInBody(node, fromNode) {

@@ -64,19 +54,2 @@ switch (fromNode.type) {

function evaluate(customNode) {
var n = [node];
if (typeof customNode !== "undefined") {
n = customNode;
}
var memory = new Memory({
initial: 100
});
var allocator = createAllocator(memory);
var code = n; // $FlowIgnore
code.push(t.instruction("end"));
return partialEvaluation.evaluate(allocator, code);
}
return {

@@ -86,4 +59,3 @@ node: node,

replaceWith: replaceWith,
remove: remove,
evaluate: evaluate
remove: remove
};

@@ -90,0 +62,0 @@ }

6

package.json
{
"name": "@webassemblyjs/ast",
"version": "1.2.4",
"version": "1.2.5",
"description": "AST utils for webassemblyjs",

@@ -14,4 +14,4 @@ "keywords": [

"dependencies": {
"@webassemblyjs/wast-parser": "1.2.4",
"webassemblyjs": "1.2.4"
"@webassemblyjs/wast-parser": "1.2.5",
"webassemblyjs": "1.2.5"
},

@@ -18,0 +18,0 @@ "repository": {

@@ -25,21 +25,2 @@ # @webassemblyjs/ast

### Traverse and partial evaluation
```js
import { traverse } from "@webassemblyjs/ast";
traverse(ast, {
Func(path) {
const res = path.evaluate();
}
});
// Or by specified an array of node
traverse(ast, {
Global(path) {
const res = path.evaluate(path.node.init);
}
});
```
### Instruction signatures

@@ -46,0 +27,0 @@

// @flow
const partialEvaluation = require("webassemblyjs/lib/interpreter/partial-evaluation");
const {
Memory
} = require("webassemblyjs/lib/interpreter/runtime/values/memory");
const {
createAllocator
} = require("webassemblyjs/lib/interpreter/kernel/memory");
const t = require("./index");
type Cb = (type: string, path: NodePath<Node>) => void;

@@ -55,19 +45,2 @@

function evaluate(customNode: ?Array<Node>): ?StackLocal {
let n = [node];
if (typeof customNode !== "undefined") {
n = customNode;
}
const memory = new Memory({ initial: 100 });
const allocator = createAllocator(memory);
const code = n;
// $FlowIgnore
code.push(t.instruction("end"));
return partialEvaluation.evaluate(allocator, code);
}
return {

@@ -78,4 +51,3 @@ node,

replaceWith,
remove,
evaluate
remove
};

@@ -82,0 +54,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc