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.1.2-y.0 to 1.1.2-y.1

48

lib/encoder/index.js

@@ -13,5 +13,7 @@ "use strict";

exports.encodeUTF8Vec = encodeUTF8Vec;
exports.encodeLimits = encodeLimits;
exports.encodeModuleImport = encodeModuleImport;
exports.encodeSectionMetadata = encodeSectionMetadata;
exports.encodeCallInstruction = encodeCallInstruction;
exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction;
exports.encodeModuleExport = encodeModuleExport;

@@ -86,2 +88,18 @@ exports.encodeTypeInstruction = encodeTypeInstruction;

function encodeLimits(n) {
var out = [];
if (typeof n.max === "number") {
out.push(0x01);
out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof
out.push.apply(out, _toConsumableArray(encodeU32(n.max)));
} else {
out.push(0x00);
out.push.apply(out, _toConsumableArray(encodeU32(n.min)));
}
return out;
}
function encodeModuleImport(n) {

@@ -105,16 +123,15 @@ var out = [];

{
out.push(0x02); // $FlowIgnore: Memory ensure that these props exists
out.push(0x02); // $FlowIgnore
if (typeof n.descr.limits.max === "number") {
out.push(0x01); // $FlowIgnore: Memory ensure that these props exists
out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
break;
}
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.min))); // $FlowIgnore: Memory ensure that these props exists
case "Table":
{
out.push(0x01);
out.push(0x70); // element type
// $FlowIgnore
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.max)));
} else {
out.push(0x00); // $FlowIgnore: Memory ensure that these props exists
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.min)));
}
out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
break;

@@ -171,2 +188,11 @@ }

function encodeCallIndirectInstruction(n) {
var out = [];
assertNotIdentifierNode(n.index);
out.push(0x11); // $FlowIgnore
out.push.apply(out, _toConsumableArray(encodeU32(n.index.value)));
return out;
}
function encodeModuleExport(n) {

@@ -173,0 +199,0 @@ var out = [];

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

case "CallIndirectInstruction":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeCallIndirectInstruction(n);
case "TypeInstruction":

@@ -29,0 +33,0 @@ return encoder.encodeTypeInstruction(n);

{
"name": "@webassemblyjs/wasm-gen",
"version": "1.1.2-y.0",
"version": "1.1.2-y.1",
"description": "",

@@ -19,6 +19,6 @@ "main": "lib/index.js",

"dependencies": {
"@webassemblyjs/ast": "1.1.2-y.0",
"@webassemblyjs/helper-leb128": "1.1.2-y.0",
"@webassemblyjs/helper-wasm-bytecode": "1.1.2-y.0"
"@webassemblyjs/ast": "1.1.2-y.1",
"@webassemblyjs/helper-leb128": "1.1.2-y.1",
"@webassemblyjs/helper-wasm-bytecode": "1.1.2-y.1"
}
}

@@ -60,2 +60,19 @@ // @flow

export function encodeLimits(n: Limit): Array<Byte> {
const out = [];
if (typeof n.max === "number") {
out.push(0x01);
out.push(...encodeU32(n.min));
// $FlowIgnore: ensured by the typeof
out.push(...encodeU32(n.max));
} else {
out.push(0x00);
out.push(...encodeU32(n.min));
}
return out;
}
export function encodeModuleImport(n: ModuleImport): Array<Byte> {

@@ -81,16 +98,16 @@ const out = [];

// $FlowIgnore: Memory ensure that these props exists
if (typeof n.descr.limits.max === "number") {
out.push(0x01);
// $FlowIgnore
out.push(...encodeLimits(n.descr.limits));
// $FlowIgnore: Memory ensure that these props exists
out.push(...encodeU32(n.descr.limits.min));
// $FlowIgnore: Memory ensure that these props exists
out.push(...encodeU32(n.descr.limits.max));
} else {
out.push(0x00);
break;
}
// $FlowIgnore: Memory ensure that these props exists
out.push(...encodeU32(n.descr.limits.min));
}
case "Table": {
out.push(0x01);
out.push(0x70); // element type
// $FlowIgnore
out.push(...encodeLimits(n.descr.limits));
break;

@@ -156,2 +173,14 @@ }

export function encodeCallIndirectInstruction(n: CallInstruction): Array<Byte> {
const out = [];
assertNotIdentifierNode(n.index);
out.push(0x11);
// $FlowIgnore
out.push(...encodeU32(n.index.value));
return out;
}
export function encodeModuleExport(n: ModuleExport): Array<Byte> {

@@ -158,0 +187,0 @@ const out = [];

@@ -19,2 +19,6 @@ // @flow

case "CallIndirectInstruction":
// $FlowIgnore: SectionMetadata ensure that the node is well formated
return encoder.encodeCallIndirectInstruction(n);
case "TypeInstruction":

@@ -21,0 +25,0 @@ return encoder.encodeTypeInstruction(n);

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