Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

primea-annotations

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primea-annotations - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

tests/bundle.js

40

index.js
const Stream = require('buffer-pipe')
const Buffer = require('safe-buffer').Buffer
const leb = require('leb128')
const {findSections} = require('wasm-json-toolkit')
const FUNC_TYPE = 0x60
const LANGUAGE_TYPES_STRG = {

@@ -10,10 +12,9 @@ 'i32': 0x7f,

'f64': 0x7c,
'anyref': 0x70,
'module': 0x6f,
'data': 0x6e,
'elem': 0x6d,
'link': 0x6c,
'id': 0x6b,
'func': 0x60
'func': 0x6e,
'data': 0x6d,
'elem': 0x6c,
'link': 0x6b,
'id': 0x6a
}

@@ -26,10 +27,9 @@

0x7c: 'f64',
0x70: 'anyref',
0x6f: 'module',
0x6e: 'data',
0x6d: 'elem',
0x6c: 'link',
0x6b: 'id',
0x60: 'func'
0x6e: 'func',
0x6d: 'data',
0x6c: 'elem',
0x6b: 'link',
0x6a: 'id'
}

@@ -180,3 +180,3 @@

// a single type entry binary encoded
binEntries.write([LANGUAGE_TYPES_STRG[entry.form]]) // the form
binEntries.write([FUNC_TYPE])

@@ -209,3 +209,3 @@ const len = entry.params.length // number of parameters

let type = stream.read(1)[0]
if (type !== 0x60) {
if (type !== FUNC_TYPE) {
throw new Error('invalid form')

@@ -255,3 +255,7 @@ }

const body = wasm.subarray(8)
return Buffer.concat([preramble, custom, body])
return Buffer.concat([
Buffer.from(preramble),
Buffer.from(custom),
Buffer.from(body)
])
}

@@ -261,4 +265,4 @@

* encodes a json definition and injects it into a wasm binary
* @param {Object} annotation - the type definition
* @param {Buffer} wasm - the wasm binary to inject
* @param {Object} annotation - the type definition
*/

@@ -346,3 +350,5 @@ function encodeAndInject (annotation, wasm) {

encode,
mergeTypeSections
mergeTypeSections,
LANGUAGE_TYPES_BIN,
LANGUAGE_TYPES_STRG
}
{
"name": "primea-annotations",
"version": "0.0.0",
"version": "0.0.1",
"description": "parsing/encoding for primea's type annotations",

@@ -20,4 +20,5 @@ "main": "index.js",

"buffer-pipe": "0.0.2",
"wasm-json-toolkit": "^0.2.3",
"leb128": "0.0.4"
"leb128": "0.0.4",
"safe-buffer": "^5.1.1",
"wasm-json-toolkit": "^0.2.3"
},

@@ -24,0 +25,0 @@ "devDependencies": {

# SYNOPSIS
[![NPM Package](https://img.shields.io/npm/v/primea-annotations.svg?style=flat-square)](https://www.npmjs.org/package/primea-annotations)

@@ -3,0 +4,0 @@ [![Build Status](https://img.shields.io/travis/primea/js-primea-annotations.svg?branch=master&style=flat-square)](https://travis-ci.org/primea/js-primea-annotations)

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