From d2abd3720c38738d6864665c4fe8f0564bfe1d56 Mon Sep 17 00:00:00 2001 From: Tom Wilson Date: Sun, 9 Jun 2024 11:10:02 +0000 Subject: [PATCH] chore: update loader and container --- dev-cli/src/versions.js | 4 +- loader/package-lock.json | 4 +- loader/package.json | 2 +- loader/src/formats/wasm64-emscripten.cjs | 117 ++++++++++++----------- 4 files changed, 68 insertions(+), 59 deletions(-) diff --git a/dev-cli/src/versions.js b/dev-cli/src/versions.js index 92481e4b3..edbf83aa2 100644 --- a/dev-cli/src/versions.js +++ b/dev-cli/src/versions.js @@ -1,5 +1,5 @@ /* eslint-disable */ export const VERSION = { - "CLI": "0.0.57", - "IMAGE": "0.0.37" + "CLI": "0.0.58", + "IMAGE": "0.0.38" } diff --git a/loader/package-lock.json b/loader/package-lock.json index 53e15954d..2e7aa0f9f 100644 --- a/loader/package-lock.json +++ b/loader/package-lock.json @@ -1,12 +1,12 @@ { "name": "@permaweb/ao-loader", - "version": "0.0.33", + "version": "0.0.34", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@permaweb/ao-loader", - "version": "0.0.33", + "version": "0.0.34", "license": "MIT", "devDependencies": { "esbuild": "^0.19.5", diff --git a/loader/package.json b/loader/package.json index c00cc8540..08c1284f1 100644 --- a/loader/package.json +++ b/loader/package.json @@ -1,6 +1,6 @@ { "name": "@permaweb/ao-loader", - "version": "0.0.33", + "version": "0.0.34", "repository": { "type": "git", "url": "https://github.com/permaweb/ao.git", diff --git a/loader/src/formats/wasm64-emscripten.cjs b/loader/src/formats/wasm64-emscripten.cjs index 1fd0bf463..0ce0c70a0 100644 --- a/loader/src/formats/wasm64-emscripten.cjs +++ b/loader/src/formats/wasm64-emscripten.cjs @@ -630,60 +630,66 @@ var Module = (() => { missingGlobal("asm", "Please use wasmExports instead"); - function missingLibrarySymbol(sym) { - if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { - Object.defineProperty(globalThis, sym, { - configurable: true, - get() { - var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; - var librarySymbol = sym; - if (!librarySymbol.startsWith("_")) { - librarySymbol = "$" + sym; - } - msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; - if (isExportedByForceFilesystem(sym)) { - msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; - } - warnOnce(msg); - return undefined; - } - }); - } - unexportedRuntimeSymbol(sym); - } - - function unexportedRuntimeSymbol(sym) { - if (!Object.getOwnPropertyDescriptor(Module, sym)) { - Object.defineProperty(Module, sym, { - configurable: true, - get() { - var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; - if (isExportedByForceFilesystem(sym)) { - msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; - } - abort(msg); - } - }); - } - } - - function __asyncjs__weavedrive_open(c_filename, mode) { - return Asyncify.handleAsync(async () => { - const filename = UTF8ToString(Number(c_filename)); - if (!Module.WeaveDrive) { - return Promise.resolve(null); - } - const drive = Module.WeaveDrive(Module, FS); - return await drive.open(filename); - }); - } - - function __asyncjs__weavedrive_read(fd, dst_ptr, length) { - return Asyncify.handleAsync(async () => { - const drive = Module.WeaveDrive(Module, FS); - return Promise.resolve(await drive.read(fd, dst_ptr, length)); - }); - } +function missingLibrarySymbol(sym) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + return undefined; + } + }); + } + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +function __asyncjs__weavedrive_open(c_filename, mode) { + return Asyncify.handleAsync(async () => { + const filename = UTF8ToString(Number(c_filename)); + if (!Module.WeaveDrive) { + return Promise.resolve(null); + } + const drive = Module.WeaveDrive(Module, FS); + return await drive.open(filename); + }); +} + +function __asyncjs__weavedrive_read(fd, dst_ptr, length) { + return Asyncify.handleAsync(async () => { + const drive = Module.WeaveDrive(Module, FS); + return Promise.resolve(await drive.read(fd, dst_ptr, length)); + }); +} +function __asyncjs__weavedrive_close(fd) { + return Asyncify.handleAsync(async () => { + const drive = Module.WeaveDrive(Module, FS); + return drive.close(fd); + }); +} /** @constructor */ function ExitStatus(status) { this.name = "ExitStatus"; @@ -4949,6 +4955,9 @@ var Module = (() => { var wasmImports = { /** @export */ __assert_fail: ___assert_fail, + /** @export */ __asyncjs__weavedrive_close: __asyncjs__weavedrive_close, + + /** @export */ __asyncjs__weavedrive_open: __asyncjs__weavedrive_open, /** @export */ __asyncjs__weavedrive_read: __asyncjs__weavedrive_read, /** @export */ __cxa_throw: ___cxa_throw,