You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

python-wasm

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-wasm - npm Package Compare versions

Comparing version
0.6.1
to
0.6.2
+35
-22
dist/python/python.test.js

@@ -39,10 +39,14 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./index");
var node_1 = require("./node");
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, node_1.init)()];
test("add 2+3", function () { return __awaiter(void 0, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, (0, node_1.exec)("a = 2+3")];
case 1:
_a.sent();
_b.sent();
_a = expect;
return [4 /*yield*/, (0, node_1.repr)("a")];
case 2:
_a.apply(void 0, [_b.sent()]).toBe("5");
return [2 /*return*/];

@@ -52,23 +56,32 @@ }

}); });
test("add 2+3", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
(0, index_1.exec)("a = 2+3");
expect((0, index_1.repr)("a")).toBe("5");
return [2 /*return*/];
test("Exec involving multiline statement", function () { return __awaiter(void 0, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, (0, node_1.exec)("\ndef double(n : int) -> int:\n return 2*n\n\ndef f(n : int) -> int:\n s = 0\n for i in range(1,n+1):\n s += i\n return double(s);\n")];
case 1:
_b.sent();
_a = expect;
return [4 /*yield*/, (0, node_1.repr)("f(100)")];
case 2:
_a.apply(void 0, [_b.sent()]).toBe("".concat(5050 * 2));
return [2 /*return*/];
}
});
}); });
test("Exec involving multiple statements", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
(0, index_1.exec)("\ndef f(n):\n s = 0\n for i in range(1,n+1):\n s += i\n return s\n");
expect((0, index_1.repr)("f(100)")).toBe("5050");
return [2 /*return*/];
});
}); });
test("sys.platform is wasi", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
(0, index_1.exec)("import sys");
expect((0, index_1.repr)("sys.platform")).toBe("'wasi'");
return [2 /*return*/];
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, (0, node_1.exec)("import sys")];
case 1:
_b.sent();
_a = expect;
return [4 /*yield*/, (0, node_1.repr)("sys.platform")];
case 2:
_a.apply(void 0, [_b.sent()]).toBe("'wasi'");
return [2 /*return*/];
}
});
}); });
//# sourceMappingURL=python.test.js.map

@@ -169,7 +169,8 @@ "use strict";

log("got data", data.toString());
if (data.includes("\u0004")) {
// Ctrl+D
this.terminate();
return [2 /*return*/];
}
// See https://github.com/sagemathinc/python-wasm/issues/6
// if (data.includes("\u0004")) {
// // Ctrl+D
// this.terminate();
// return;
// }
data.copy(Buffer.from(stdinBuffer));

@@ -176,0 +177,0 @@ Atomics.store(this.spinLock, 0, data.length);

{
"name": "python-wasm",
"version": "0.6.1",
"version": "0.6.2",
"description": "python-wasm -- Web Assembly Python for Node.js and the Browser",

@@ -12,3 +12,3 @@ "main": "./dist/python/node.js",

"tsc": "npx tsc -w",
"test": "jest ./dist",
"test": "jest --forceExit ./dist # TODO: fix this hang issue with forceExit",
"test-watch": "jest --watch ./dist"

@@ -30,3 +30,3 @@ },

"dependencies": {
"@wapython/wasi": "^0.18.0",
"@wapython/wasi": "^0.18.1",
"awaiting": "^3.0.0",

@@ -33,0 +33,0 @@ "callsite": "^1.0.0"

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
console.log("hi from a worker!");
//# sourceMappingURL=worker.js.map
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/wasm/worker.ts"],"names":[],"mappings":";;AACA,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet