Socket
Socket
Sign inDemoInstall

@webassemblyjs/helper-wasm-section

Package Overview
Dependencies
17
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.1-0 to 1.7.1

11

esm/create.js

@@ -5,9 +5,5 @@ 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); }

import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer";
import constants from "@webassemblyjs/helper-wasm-bytecode";
import * as t from "@webassemblyjs/ast";
var t = require("@webassemblyjs/ast");
var debug = require("debug")("webassemblyjs:wasm:createsection");
var constants = require("@webassemblyjs/helper-wasm-bytecode");
function findLastSection(ast, forSection) {

@@ -53,7 +49,5 @@ var targetSectionId = constants.sections[forSection]; // $FlowIgnore: metadata can not be empty

end = start;
debug("create empty section=%s first", section);
} else {
start = lastSection.startOffset + lastSection.size.value + 1;
end = start;
debug("create empty section=%s after=%s start=%d end=%d", section, lastSection.section, start, end);
} // section id

@@ -108,3 +102,2 @@

t.shiftSection(ast, path.node, deltaBytes);
debug("shift section section=%s detla=%d", path.node.section, deltaBytes);
}

@@ -111,0 +104,0 @@ }

import { traverse, getSectionMetadata, shiftSection } from "@webassemblyjs/ast";
import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer";
var debug = require("debug")("webassemblyjs:wasm:removesection");
export function removeSection(ast, uint8Buffer, section) {

@@ -33,3 +30,2 @@ var sectionMetadata = getSectionMetadata(ast, section);

shiftSection(ast, path.node, delta);
debug("shift section section=%s detla=%d", section, delta);
}

@@ -36,0 +32,0 @@ }

import { encodeU32 } from "@webassemblyjs/wasm-gen";
import { getSectionMetadata, traverse, shiftSection } from "@webassemblyjs/ast";
import { overrideBytesInBuffer } from "@webassemblyjs/helper-buffer";
var debug = require("debug")("webassemblyjs:wasm:resizesection");
export function resizeSectionByteSize(ast, uint8Buffer, section, deltaBytes) {

@@ -52,7 +49,5 @@ var sectionMetadata = getSectionMetadata(ast, section);

shiftSection(ast, path.node, deltaBytes);
debug("shift section section=%s detla=%d", path.node.section, deltaBytes);
}
}
});
debug("resize byte size section=%s newValue=%s start=%d end=%d", section, newSectionSize, start, end);
return overrideBytesInBuffer(uint8Buffer, start, end, newBytes);

@@ -84,4 +79,3 @@ }

sectionMetadata.vectorOfSize.loc.end.column = start + newBytes.length;
debug("resize vec size section=%s detla=%d newValue=%s", section, deltaElements, newValue);
return overrideBytesInBuffer(uint8Buffer, start, end, newBytes);
}

17

lib/create.js

@@ -12,12 +12,14 @@ "use strict";

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); }
var _helperWasmBytecode = _interopRequireDefault(require("@webassemblyjs/helper-wasm-bytecode"));
var t = require("@webassemblyjs/ast");
var t = _interopRequireWildcard(require("@webassemblyjs/ast"));
var debug = require("debug")("webassemblyjs:wasm:createsection");
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; } }
var constants = require("@webassemblyjs/helper-wasm-bytecode");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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); }
function findLastSection(ast, forSection) {
var targetSectionId = constants.sections[forSection]; // $FlowIgnore: metadata can not be empty
var targetSectionId = _helperWasmBytecode.default.sections[forSection]; // $FlowIgnore: metadata can not be empty

@@ -35,3 +37,3 @@ var moduleSections = ast.body[0].metadata.sections;

var sectionId = constants.sections[section.section];
var sectionId = _helperWasmBytecode.default.sections[section.section];

@@ -62,7 +64,5 @@ if (targetSectionId > lastId && targetSectionId < sectionId) {

end = start;
debug("create empty section=%s first", section);
} else {
start = lastSection.startOffset + lastSection.size.value + 1;
end = start;
debug("create empty section=%s after=%s start=%d end=%d", section, lastSection.section, start, end);
} // section id

@@ -117,3 +117,2 @@

t.shiftSection(ast, path.node, deltaBytes);
debug("shift section section=%s detla=%d", path.node.section, deltaBytes);
}

@@ -120,0 +119,0 @@ }

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

var debug = require("debug")("webassemblyjs:wasm:removesection");
function removeSection(ast, uint8Buffer, section) {

@@ -42,3 +40,2 @@ var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section);

(0, _ast.shiftSection)(ast, path.node, delta);
debug("shift section section=%s detla=%d", section, delta);
}

@@ -45,0 +42,0 @@ }

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

var debug = require("debug")("webassemblyjs:wasm:resizesection");
function resizeSectionByteSize(ast, uint8Buffer, section, deltaBytes) {

@@ -63,7 +61,5 @@ var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section);

(0, _ast.shiftSection)(ast, path.node, deltaBytes);
debug("shift section section=%s detla=%d", path.node.section, deltaBytes);
}
}
});
debug("resize byte size section=%s newValue=%s start=%d end=%d", section, newSectionSize, start, end);
return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes);

@@ -96,4 +92,3 @@ }

sectionMetadata.vectorOfSize.loc.end.column = start + newBytes.length;
debug("resize vec size section=%s detla=%d newValue=%s", section, deltaElements, newValue);
return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes);
}
{
"name": "@webassemblyjs/helper-wasm-section",
"version": "1.7.1-0",
"version": "1.7.1",
"description": "",

@@ -20,11 +20,10 @@ "main": "lib/index.js",

"dependencies": {
"@webassemblyjs/ast": "1.7.1-0",
"@webassemblyjs/helper-buffer": "1.7.1-0",
"@webassemblyjs/helper-wasm-bytecode": "1.7.1-0",
"@webassemblyjs/wasm-gen": "1.7.1-0",
"debug": "^3.1.0"
"@webassemblyjs/ast": "1.7.1",
"@webassemblyjs/helper-buffer": "1.7.1",
"@webassemblyjs/helper-wasm-bytecode": "1.7.1",
"@webassemblyjs/wasm-gen": "1.7.1"
},
"devDependencies": {
"@webassemblyjs/wasm-parser": "1.7.1-0"
"@webassemblyjs/wasm-parser": "1.7.1"
}
}
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