Socket
Socket
Sign inDemoInstall

@webassemblyjs/ast

Package Overview
Dependencies
17
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-y.7 to 1.0.0-y.8

16

lib/index.js

@@ -43,3 +43,19 @@ "use strict";

exports.elem = elem;
Object.defineProperty(exports, "traverse", {
enumerable: true,
get: function () {
return _traverse.traverse;
}
});
Object.defineProperty(exports, "signatures", {
enumerable: true,
get: function () {
return _signatures.signatures;
}
});
var _traverse = require("./traverse");
var _signatures = require("./signatures");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -46,0 +62,0 @@

11

lib/transform/wast-identifier-to-index/index.js

@@ -8,2 +8,4 @@ "use strict";

var _index = require("../../index");
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -14,5 +16,2 @@

// FIXME(sven): do the same with all block instructions, must be more generic here
var _require = require("../../traverse"),
traverse = _require.traverse;
var t = require("../../index");

@@ -24,3 +23,3 @@

traverse(ast, {
(0, _index.traverse)(ast, {
ModuleImport: function (_ModuleImport) {

@@ -78,3 +77,3 @@ function ModuleImport(_x) {

traverse(ast, {
(0, _index.traverse)(ast, {
Func: function (_Func2) {

@@ -124,3 +123,3 @@ function Func(_x4) {

var params = funcNode.params;
traverse(funcNode, {
(0, _index.traverse)(funcNode, {
Instr: function Instr(instrPath) {

@@ -127,0 +126,0 @@ var instrNode = instrPath.node;

@@ -6,3 +6,2 @@ "use strict";

});
exports.walk = walk;
exports.traverse = traverse;

@@ -9,0 +8,0 @@

{
"name": "@webassemblyjs/ast",
"version": "1.0.0-y.7",
"version": "1.0.0-y.8",
"description": "AST utils for webassemblyjs",

@@ -14,13 +14,16 @@ "keywords": [

"dependencies": {
"@webassemblyjs/wast-parser": "1.0.0-y.7",
"@webassemblyjs/wast-parser": "1.0.0-y.8",
"webassembly-floating-point-hex-parser": "0.1.2",
"webassemblyjs": "1.0.0-y.7"
"webassemblyjs": "1.0.0-y.8"
},
"repository": {
"type": "git",
"url": "https://github.com/xtuc/js-webassembly-interpreter.git"
"url": "https://github.com/xtuc/webassemblyjs.git"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"dump-exports": "^0.1.0"
}
}

@@ -1,3 +0,71 @@

# @webassembly/ast
# @webassemblyjs/ast
> AST utils for webassemblyjs
## Installation
```sh
npm install @webassemblyjs/ast
```
## Usage
### Traverse
```js
import { traverse } from "@webassemblyjs/ast";
traverse(ast, {
Module(path) {
console.log(path.node);
}
});
```
### Instruction signatures
```js
import { signatures } from "@webassemblyjs/ast";
console.log(signatures);
```
### AST Nodes
- function `signature(object, name)`
- function `identifier(value)`
- function `valtype(name)`
- function `stringLiteral(value)`
- function `program(body)`
- function `module(id, fields)`
- function `binaryModule(id, blob)`
- function `quoteModule(id, string)`
- function `moduleExport(name, type, id)`
- function `func(name, params, result, body)`
- function `objectInstruction(id, object, args, namedArgs)`
- function `instruction(id, args, namedArgs)`
- function `loopInstruction(label, resulttype, instr)`
- function `blockInstruction(label, instr, result)`
- function `numberLiteral(rawValue, instructionType)`
- function `callInstruction(index, instrArgs)`
- function `ifInstruction(testLabel, result, test, consequent, alternate)`
- function `withLoc(n, end, start)`
- function `moduleImport(module, name, descr)`
- function `globalImportDescr(valtype, mutability)`
- function `funcParam(valtype, id)`
- function `funcImportDescr(id, params, results)`
- function `table(elementType, limits, name, elements)`
- function `limits(min, max)`
- function `memory(limits, id)`
- function `data(memoryIndex, offset, init)`
- function `global(globalType, init, name)`
- function `globalType(valtype, mutability)`
- function `byteArray(values)`
- function `leadingComment(value)`
- function `blockComment(value)`
- function `indexLiteral(value)`
- function `memIndexLiteral(value)`
- function `typeInstructionFunc(params, result, id)`
- function `callIndirectInstruction(params, results, intrs)`
- function `start(index)`
- function `elem(table, offset, funcs)`

@@ -532,1 +532,4 @@ // @flow

}
export { traverse } from "./traverse";
export { signatures } from "./signatures";
// @flow
import { traverse } from "../../index";
// FIXME(sven): do the same with all block instructions, must be more generic here
const { traverse } = require("../../traverse");
const t = require("../../index");

@@ -7,0 +8,0 @@

@@ -9,6 +9,3 @@ // @flow

export function walk(
n: Node,
cb: (type: string, path: NodePath<Node>) => void
) {
function walk(n: Node, cb: (type: string, path: NodePath<Node>) => void) {
if (n.type === "Program") {

@@ -15,0 +12,0 @@ cb(n.type, createPath(n));

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