New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

walt-compiler

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

walt-compiler - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

2

package.json
{
"name": "walt-compiler",
"version": "0.8.0",
"version": "0.8.1",
"description": "Alternative syntax for WebAssembly text format",

@@ -5,0 +5,0 @@ "main": "dist/walt.js",

@@ -65,1 +65,12 @@ import test from "ava";

});
test("memory & table exports", t => {
const source = `
export const memory: Memory = { initial: 1 };
export const table: Table = { initial: 1, element: 'anyfunc' };
`;
return compileAndRun(source).then(({ instance }) => {
t.is(instance.exports.memory instanceof WebAssembly.Memory, true);
t.is(instance.exports.table instanceof WebAssembly.Table, true);
});
});
// @flow
import { GLOBAL_INDEX, FUNCTION_INDEX } from "../semantics/metadata";
import { EXTERN_GLOBAL, EXTERN_FUNCTION } from "../emitter/external_kind";
import {
EXTERN_GLOBAL,
EXTERN_MEMORY,
EXTERN_TABLE,
EXTERN_FUNCTION,
} from "../emitter/external_kind";
import type { NodeType, IntermediateExportType } from "./flow/types";
const externaKindMap = {
Memory: EXTERN_MEMORY,
Table: EXTERN_TABLE,
};
export default function generateExport(node: NodeType): IntermediateExportType {

@@ -11,5 +21,9 @@ const functionIndexMeta = node.meta[FUNCTION_INDEX];

if (globalIndexMeta != null) {
const kind = externaKindMap[String(node.type)] || EXTERN_GLOBAL;
const index = [EXTERN_MEMORY, EXTERN_TABLE].includes(kind)
? 0
: globalIndexMeta;
return {
index: globalIndexMeta,
kind: EXTERN_GLOBAL,
index,
kind,
field: node.value,

@@ -16,0 +30,0 @@ };

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