mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
update wasm_exec_go.js for Go 1.24
This commit is contained in:
parent
316e53639d
commit
62e996b9be
@ -14,7 +14,7 @@
|
|||||||
if (!globalThis.fs) {
|
if (!globalThis.fs) {
|
||||||
let outputBuf = "";
|
let outputBuf = "";
|
||||||
globalThis.fs = {
|
globalThis.fs = {
|
||||||
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
|
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1, O_DIRECTORY: -1 }, // unused
|
||||||
writeSync(fd, buf) {
|
writeSync(fd, buf) {
|
||||||
outputBuf += decoder.decode(buf);
|
outputBuf += decoder.decode(buf);
|
||||||
const nl = outputBuf.lastIndexOf("\n");
|
const nl = outputBuf.lastIndexOf("\n");
|
||||||
@ -73,6 +73,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!globalThis.path) {
|
||||||
|
globalThis.path = {
|
||||||
|
resolve(...pathSegments) {
|
||||||
|
return pathSegments.join("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!globalThis.crypto) {
|
if (!globalThis.crypto) {
|
||||||
throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
|
throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
|
||||||
}
|
}
|
||||||
@ -208,10 +216,16 @@
|
|||||||
return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
|
return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const testCallExport = (a, b) => {
|
||||||
|
this._inst.exports.testExport0();
|
||||||
|
return this._inst.exports.testExport(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
const timeOrigin = Date.now() - performance.now();
|
const timeOrigin = Date.now() - performance.now();
|
||||||
this.importObject = {
|
this.importObject = {
|
||||||
_gotest: {
|
_gotest: {
|
||||||
add: (a, b) => a + b,
|
add: (a, b) => a + b,
|
||||||
|
callExport: testCallExport,
|
||||||
},
|
},
|
||||||
gojs: {
|
gojs: {
|
||||||
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
|
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user