@wasmer/wasi
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -16,6 +16,7 @@ /* | ||
*****************************************************************************/ | ||
'use strict';var extendStatics=function(e,c){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,d){c.__proto__=d}||function(c,d){for(var e in d)d.hasOwnProperty(e)&&(c[e]=d[e])};return extendStatics(e,c)};function __extends(e,c){function f(){this.constructor=e}extendStatics(e,c);e.prototype=null===c?Object.create(c):(f.prototype=c.prototype,new f)} | ||
function __values(e){var c="function"===typeof Symbol&&e[Symbol.iterator],f=0;return c?c.call(e):{next:function(){e&&f>=e.length&&(e=void 0);return{value:e&&e[f++],done:!e}}}}function __read(e,c){var f="function"===typeof Symbol&&e[Symbol.iterator];if(!f)return e;e=f.call(e);var d,x=[];try{for(;(void 0===c||0<c--)&&!(d=e.next()).done;)x.push(d.value)}catch(v){var w={error:v}}finally{try{d&&!d.done&&(f=e["return"])&&f.call(e)}finally{if(w)throw w.error;}}return x} | ||
function __spread(){for(var e=[],c=0;c<arguments.length;c++)e=e.concat(__read(arguments[c]));return e}var exportedBigInt=Number,globalThis={BigInt:{}};globalThis=global;globalThis.BigInt&&(exportedBigInt=globalThis.BigInt);var BigIntPolyfill=exportedBigInt,exportedDataView=DataView;exportedDataView.prototype.setBigUint64||(exportedDataView.prototype.setBigUint64=function(e,c,f){this.setUint32(f?0:4,c,f);this.setUint32(f?4:0,0,f)}); | ||
var DataViewPolyfill=exportedDataView,isomorphicBuffer=Buffer,NS_PER_SEC=1E9,getBigIntHrtime=function(e){var c=e();return function(f){f=e(f||c);return f[0]*NS_PER_SEC+f[1]}},crypto=require("crypto"),fs=require("fs"),isTTY=require("tty").isatty,path=require("path"),bigIntHrtime=getBigIntHrtime(process.hrtime);process.hrtime&&process.hrtime.bigint&&(bigIntHrtime=process.hrtime.bigint); | ||
'use strict';var extendStatics=function(e,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,d){b.__proto__=d}||function(b,d){for(var e in d)d.hasOwnProperty(e)&&(b[e]=d[e])};return extendStatics(e,b)};function __extends(e,b){function f(){this.constructor=e}extendStatics(e,b);e.prototype=null===b?Object.create(b):(f.prototype=b.prototype,new f)} | ||
function __values(e){var b="function"===typeof Symbol&&e[Symbol.iterator],f=0;return b?b.call(e):{next:function(){e&&f>=e.length&&(e=void 0);return{value:e&&e[f++],done:!e}}}}function __read(e,b){var f="function"===typeof Symbol&&e[Symbol.iterator];if(!f)return e;e=f.call(e);var d,v=[];try{for(;(void 0===b||0<b--)&&!(d=e.next()).done;)v.push(d.value)}catch(w){var x={error:w}}finally{try{d&&!d.done&&(f=e["return"])&&f.call(e)}finally{if(x)throw x.error;}}return v} | ||
function __spread(){for(var e=[],b=0;b<arguments.length;b++)e=e.concat(__read(arguments[b]));return e}var globalObj="undefined"!==typeof globalThis?globalThis:{},BigIntPolyfill=globalObj.BigInt||Number,exportedDataView=DataView; | ||
exportedDataView.prototype.setBigUint64||(exportedDataView.prototype.setBigUint64=function(e,b,f){if(b<Math.pow(2,32)){var d=b;b=0}else{d=b.toString(2);b="";for(var v=0;v<64-d.length;v++)b+="0";b+=d;d=parseInt(b.substring(0,32),2);b=parseInt(b.substring(32),2)}this.setUint32(e+(f?0:4),d,f);this.setUint32(e+(f?4:0),b,f)},exportedDataView.prototype.getBigUint64=function(e,b){var f=this.getUint32(e+(b?0:4),b);this.setUint32(e+(b?4:0),b);e=f.toString(2);f=f.toString(2);for(b=0;b<32-e.length;b++);return parseInt(f+ | ||
e)});var DataViewPolyfill=exportedDataView,isomorphicBuffer=Buffer,NS_PER_SEC=1E9,getBigIntHrtime=function(e){var b=e();return function(f){f=e(f||b);return f[0]*NS_PER_SEC+f[1]}},crypto=require("crypto"),fs=require("fs"),isTTY=require("tty").isatty,path=require("path"),bigIntHrtime=getBigIntHrtime(process.hrtime);process.hrtime&&process.hrtime.bigint&&(bigIntHrtime=process.hrtime.bigint); | ||
var bindings={hrtime:bigIntHrtime,exit:process.exit,kill:function(e){process.kill(process.pid,e)},randomFillSync:crypto.randomFillSync,isTTY,fs,path},_a,WASI_ESUCCESS=0,WASI_E2BIG=1,WASI_EACCES=2,WASI_EADDRINUSE=3,WASI_EADDRNOTAVAIL=4,WASI_EAFNOSUPPORT=5,WASI_EAGAIN=6,WASI_EALREADY=7,WASI_EBADF=8,WASI_EBADMSG=9,WASI_EBUSY=10,WASI_ECANCELED=11,WASI_ECHILD=12,WASI_ECONNABORTED=13,WASI_ECONNREFUSED=14,WASI_ECONNRESET=15,WASI_EDEADLK=16,WASI_EDESTADDRREQ=17,WASI_EDOM=18,WASI_EDQUOT=19,WASI_EEXIST=20, | ||
@@ -33,40 +34,42 @@ WASI_EFAULT=21,WASI_EFBIG=22,WASI_EHOSTUNREACH=23,WASI_EIDRM=24,WASI_EILSEQ=25,WASI_EINPROGRESS=26,WASI_EINTR=27,WASI_EINVAL=28,WASI_EIO=29,WASI_EISCONN=30,WASI_EISDIR=31,WASI_ELOOP=32,WASI_EMFILE=33,WASI_EMLINK=34,WASI_EMSGSIZE=35,WASI_EMULTIHOP=36,WASI_ENAMETOOLONG=37,WASI_ENETDOWN=38,WASI_ENETRESET=39,WASI_ENETUNREACH=40,WASI_ENFILE=41,WASI_ENOBUFS=42,WASI_ENODEV=43,WASI_ENOENT=44,WASI_ENOEXEC=45,WASI_ENOLCK=46,WASI_ENOLINK=47,WASI_ENOMEM=48,WASI_ENOMSG=49,WASI_ENOPROTOOPT=50,WASI_ENOSPC=51,WASI_ENOSYS= | ||
WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_FILESTAT_GET|WASI_RIGHT_POLL_FD_READWRITE|WASI_RIGHT_SOCK_SHUTDOWN,RIGHTS_SOCKET_INHERITING=RIGHTS_ALL,RIGHTS_TTY_BASE=WASI_RIGHT_FD_READ|WASI_RIGHT_FD_FDSTAT_SET_FLAGS|WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_FILESTAT_GET|WASI_RIGHT_POLL_FD_READWRITE,RIGHTS_TTY_INHERITING=BigIntPolyfill(0),WASI_CLOCK_MONOTONIC=0,WASI_CLOCK_PROCESS_CPUTIME_ID=1,WASI_CLOCK_REALTIME=2,WASI_CLOCK_THREAD_CPUTIME_ID=3,WASI_EVENTTYPE_CLOCK=0,WASI_EVENTTYPE_FD_READ=1,WASI_EVENTTYPE_FD_WRITE=2, | ||
WASI_FILESTAT_SET_ATIM_NOW=2,WASI_FILESTAT_SET_MTIM_NOW=8,WASI_O_CREAT=1,WASI_O_DIRECTORY=2,WASI_O_EXCL=4,WASI_O_TRUNC=8,WASI_PREOPENTYPE_DIR=0,WASI_STDIN_FILENO=0,WASI_STDOUT_FILENO=1,WASI_STDERR_FILENO=2,ERROR_MAP={E2BIG:WASI_E2BIG,EACCES:WASI_EACCES,EADDRINUSE:WASI_EADDRINUSE,EADDRNOTAVAIL:WASI_EADDRNOTAVAIL,EAFNOSUPPORT:WASI_EAFNOSUPPORT,EALREADY:WASI_EALREADY,EAGAIN:WASI_EAGAIN,EBADF:WASI_EBADF,EBADMSG:WASI_EBADMSG,EBUSY:WASI_EBUSY,ECANCELED:WASI_ECANCELED,ECHILD:WASI_ECHILD,ECONNABORTED:WASI_ECONNABORTED, | ||
ECONNREFUSED:WASI_ECONNREFUSED,ECONNRESET:WASI_ECONNRESET,EDEADLOCK:WASI_EDEADLK,EDESTADDRREQ:WASI_EDESTADDRREQ,EDOM:WASI_EDOM,EDQUOT:WASI_EDQUOT,EEXIST:WASI_EEXIST,EFAULT:WASI_EFAULT,EFBIG:WASI_EFBIG,EHOSTDOWN:WASI_EHOSTUNREACH,EHOSTUNREACH:WASI_EHOSTUNREACH,EIDRM:WASI_EIDRM,EILSEQ:WASI_EILSEQ,EINPROGRESS:WASI_EINPROGRESS,EINTR:WASI_EINTR,EINVAL:WASI_EINVAL,EIO:WASI_EIO,EISCONN:WASI_EISCONN,EISDIR:WASI_EISDIR,ELOOP:WASI_ELOOP,EMFILE:WASI_EMFILE,EMLINK:WASI_EMLINK,EMSGSIZE:WASI_EMSGSIZE,EMULTIHOP:WASI_EMULTIHOP, | ||
ENAMETOOLONG:WASI_ENAMETOOLONG,ENETDOWN:WASI_ENETDOWN,ENETRESET:WASI_ENETRESET,ENETUNREACH:WASI_ENETUNREACH,ENFILE:WASI_ENFILE,ENOBUFS:WASI_ENOBUFS,ENODEV:WASI_ENODEV,ENOENT:WASI_ENOENT,ENOEXEC:WASI_ENOEXEC,ENOLCK:WASI_ENOLCK,ENOLINK:WASI_ENOLINK,ENOMEM:WASI_ENOMEM,ENOMSG:WASI_ENOMSG,ENOPROTOOPT:WASI_ENOPROTOOPT,ENOSPC:WASI_ENOSPC,ENOSYS:WASI_ENOSYS,ENOTCONN:WASI_ENOTCONN,ENOTDIR:WASI_ENOTDIR,ENOTEMPTY:WASI_ENOTEMPTY,ENOTRECOVERABLE:WASI_ENOTRECOVERABLE,ENOTSOCK:WASI_ENOTSOCK,ENOTTY:WASI_ENOTTY,ENXIO:WASI_ENXIO, | ||
EOVERFLOW:WASI_EOVERFLOW,EOWNERDEAD:WASI_EOWNERDEAD,EPERM:WASI_EPERM,EPIPE:WASI_EPIPE,EPROTO:WASI_EPROTO,EPROTONOSUPPORT:WASI_EPROTONOSUPPORT,EPROTOTYPE:WASI_EPROTOTYPE,ERANGE:WASI_ERANGE,EROFS:WASI_EROFS,ESPIPE:WASI_ESPIPE,ESRCH:WASI_ESRCH,ESTALE:WASI_ESTALE,ETIMEDOUT:WASI_ETIMEDOUT,ETXTBSY:WASI_ETXTBSY,EXDEV:WASI_EXDEV},SIGNAL_MAP=(_a={},_a[WASI_SIGHUP]="SIGHUP",_a[WASI_SIGINT]="SIGINT",_a[WASI_SIGQUIT]="SIGQUIT",_a[WASI_SIGILL]="SIGILL",_a[WASI_SIGTRAP]="SIGTRAP",_a[WASI_SIGABRT]="SIGABRT",_a[WASI_SIGBUS]= | ||
"SIGBUS",_a[WASI_SIGFPE]="SIGFPE",_a[WASI_SIGKILL]="SIGKILL",_a[WASI_SIGUSR1]="SIGUSR1",_a[WASI_SIGSEGV]="SIGSEGV",_a[WASI_SIGUSR2]="SIGUSR2",_a[WASI_SIGPIPE]="SIGPIPE",_a[WASI_SIGALRM]="SIGALRM",_a[WASI_SIGTERM]="SIGTERM",_a[WASI_SIGCHLD]="SIGCHLD",_a[WASI_SIGCONT]="SIGCONT",_a[WASI_SIGSTOP]="SIGSTOP",_a[WASI_SIGTSTP]="SIGTSTP",_a[WASI_SIGTTIN]="SIGTTIN",_a[WASI_SIGTTOU]="SIGTTOU",_a[WASI_SIGURG]="SIGURG",_a[WASI_SIGXCPU]="SIGXCPU",_a[WASI_SIGXFSZ]="SIGXFSZ",_a[WASI_SIGVTALRM]="SIGVTALRM",_a),defaultBindings; | ||
defaultBindings=bindings; | ||
var msToNs=function(e){var c=Math.trunc(e);e=BigIntPolyfill(Math.round(1E3*(e-c)));return BigIntPolyfill(c)*BigIntPolyfill(1E3)+e},wrap=function(e){return function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];try{return e.apply(void 0,__spread(c))}catch(d){if("number"===typeof d)return d;if(d&&d.errno)return ERROR_MAP[d.code]||WASI_EINVAL;throw d;}}},stat=function(e,c){var f=e.FD_MAP.get(c);if(!f)throw WASI_EBADF;if(void 0===f.filetype){var d=e.bindings.fs.fstatSync(f.real);e=translateFileAttributes(e, | ||
c,d);c=e.rightsBase;d=e.rightsInheriting;f.filetype=e.filetype;f.rights||(f.rights={base:c,inheriting:d})}return f},translateFileAttributes=function(e,c,f){switch(!0){case f.isBlockDevice():return{filetype:WASI_FILETYPE_BLOCK_DEVICE,rightsBase:RIGHTS_BLOCK_DEVICE_BASE,rightsInheriting:RIGHTS_BLOCK_DEVICE_INHERITING};case f.isCharacterDevice():return f=WASI_FILETYPE_CHARACTER_DEVICE,void 0!==c&&e.bindings.isTTY(c)?{filetype:f,rightsBase:RIGHTS_TTY_BASE,rightsInheriting:RIGHTS_TTY_INHERITING}:{filetype:f, | ||
WASI_FILESTAT_SET_ATIM_NOW=2,WASI_FILESTAT_SET_MTIM_NOW=8,WASI_O_CREAT=1,WASI_O_DIRECTORY=2,WASI_O_EXCL=4,WASI_O_TRUNC=8,WASI_PREOPENTYPE_DIR=0,WASI_STDIN_FILENO=0,WASI_STDOUT_FILENO=1,WASI_STDERR_FILENO=2,WASI_WHENCE_CUR=0,WASI_WHENCE_END=1,WASI_WHENCE_SET=2,ERROR_MAP={E2BIG:WASI_E2BIG,EACCES:WASI_EACCES,EADDRINUSE:WASI_EADDRINUSE,EADDRNOTAVAIL:WASI_EADDRNOTAVAIL,EAFNOSUPPORT:WASI_EAFNOSUPPORT,EALREADY:WASI_EALREADY,EAGAIN:WASI_EAGAIN,EBADF:WASI_EBADF,EBADMSG:WASI_EBADMSG,EBUSY:WASI_EBUSY,ECANCELED:WASI_ECANCELED, | ||
ECHILD:WASI_ECHILD,ECONNABORTED:WASI_ECONNABORTED,ECONNREFUSED:WASI_ECONNREFUSED,ECONNRESET:WASI_ECONNRESET,EDEADLOCK:WASI_EDEADLK,EDESTADDRREQ:WASI_EDESTADDRREQ,EDOM:WASI_EDOM,EDQUOT:WASI_EDQUOT,EEXIST:WASI_EEXIST,EFAULT:WASI_EFAULT,EFBIG:WASI_EFBIG,EHOSTDOWN:WASI_EHOSTUNREACH,EHOSTUNREACH:WASI_EHOSTUNREACH,EIDRM:WASI_EIDRM,EILSEQ:WASI_EILSEQ,EINPROGRESS:WASI_EINPROGRESS,EINTR:WASI_EINTR,EINVAL:WASI_EINVAL,EIO:WASI_EIO,EISCONN:WASI_EISCONN,EISDIR:WASI_EISDIR,ELOOP:WASI_ELOOP,EMFILE:WASI_EMFILE,EMLINK:WASI_EMLINK, | ||
EMSGSIZE:WASI_EMSGSIZE,EMULTIHOP:WASI_EMULTIHOP,ENAMETOOLONG:WASI_ENAMETOOLONG,ENETDOWN:WASI_ENETDOWN,ENETRESET:WASI_ENETRESET,ENETUNREACH:WASI_ENETUNREACH,ENFILE:WASI_ENFILE,ENOBUFS:WASI_ENOBUFS,ENODEV:WASI_ENODEV,ENOENT:WASI_ENOENT,ENOEXEC:WASI_ENOEXEC,ENOLCK:WASI_ENOLCK,ENOLINK:WASI_ENOLINK,ENOMEM:WASI_ENOMEM,ENOMSG:WASI_ENOMSG,ENOPROTOOPT:WASI_ENOPROTOOPT,ENOSPC:WASI_ENOSPC,ENOSYS:WASI_ENOSYS,ENOTCONN:WASI_ENOTCONN,ENOTDIR:WASI_ENOTDIR,ENOTEMPTY:WASI_ENOTEMPTY,ENOTRECOVERABLE:WASI_ENOTRECOVERABLE, | ||
ENOTSOCK:WASI_ENOTSOCK,ENOTTY:WASI_ENOTTY,ENXIO:WASI_ENXIO,EOVERFLOW:WASI_EOVERFLOW,EOWNERDEAD:WASI_EOWNERDEAD,EPERM:WASI_EPERM,EPIPE:WASI_EPIPE,EPROTO:WASI_EPROTO,EPROTONOSUPPORT:WASI_EPROTONOSUPPORT,EPROTOTYPE:WASI_EPROTOTYPE,ERANGE:WASI_ERANGE,EROFS:WASI_EROFS,ESPIPE:WASI_ESPIPE,ESRCH:WASI_ESRCH,ESTALE:WASI_ESTALE,ETIMEDOUT:WASI_ETIMEDOUT,ETXTBSY:WASI_ETXTBSY,EXDEV:WASI_EXDEV},SIGNAL_MAP=(_a={},_a[WASI_SIGHUP]="SIGHUP",_a[WASI_SIGINT]="SIGINT",_a[WASI_SIGQUIT]="SIGQUIT",_a[WASI_SIGILL]="SIGILL", | ||
_a[WASI_SIGTRAP]="SIGTRAP",_a[WASI_SIGABRT]="SIGABRT",_a[WASI_SIGBUS]="SIGBUS",_a[WASI_SIGFPE]="SIGFPE",_a[WASI_SIGKILL]="SIGKILL",_a[WASI_SIGUSR1]="SIGUSR1",_a[WASI_SIGSEGV]="SIGSEGV",_a[WASI_SIGUSR2]="SIGUSR2",_a[WASI_SIGPIPE]="SIGPIPE",_a[WASI_SIGALRM]="SIGALRM",_a[WASI_SIGTERM]="SIGTERM",_a[WASI_SIGCHLD]="SIGCHLD",_a[WASI_SIGCONT]="SIGCONT",_a[WASI_SIGSTOP]="SIGSTOP",_a[WASI_SIGTSTP]="SIGTSTP",_a[WASI_SIGTTIN]="SIGTTIN",_a[WASI_SIGTTOU]="SIGTTOU",_a[WASI_SIGURG]="SIGURG",_a[WASI_SIGXCPU]="SIGXCPU", | ||
_a[WASI_SIGXFSZ]="SIGXFSZ",_a[WASI_SIGVTALRM]="SIGVTALRM",_a),defaultBindings;defaultBindings=bindings; | ||
var msToNs=function(e){var b=Math.trunc(e);e=BigIntPolyfill(Math.round(1E3*(e-b)));return BigIntPolyfill(b)*BigIntPolyfill(1E3)+e},wrap=function(e){return function(){for(var b=[],f=0;f<arguments.length;f++)b[f]=arguments[f];try{return e.apply(void 0,__spread(b))}catch(d){if("number"===typeof d)return d;if(d&&d.errno)return ERROR_MAP[d.code]||WASI_EINVAL;throw d;}}},stat=function(e,b){var f=e.FD_MAP.get(b);if(!f)throw WASI_EBADF;if(void 0===f.filetype){var d=e.bindings.fs.fstatSync(f.real);e=translateFileAttributes(e, | ||
b,d);b=e.rightsBase;d=e.rightsInheriting;f.filetype=e.filetype;f.rights||(f.rights={base:b,inheriting:d})}return f},translateFileAttributes=function(e,b,f){switch(!0){case f.isBlockDevice():return{filetype:WASI_FILETYPE_BLOCK_DEVICE,rightsBase:RIGHTS_BLOCK_DEVICE_BASE,rightsInheriting:RIGHTS_BLOCK_DEVICE_INHERITING};case f.isCharacterDevice():return f=WASI_FILETYPE_CHARACTER_DEVICE,void 0!==b&&e.bindings.isTTY(b)?{filetype:f,rightsBase:RIGHTS_TTY_BASE,rightsInheriting:RIGHTS_TTY_INHERITING}:{filetype:f, | ||
rightsBase:RIGHTS_CHARACTER_DEVICE_BASE,rightsInheriting:RIGHTS_CHARACTER_DEVICE_INHERITING};case f.isDirectory():return{filetype:WASI_FILETYPE_DIRECTORY,rightsBase:RIGHTS_DIRECTORY_BASE,rightsInheriting:RIGHTS_DIRECTORY_INHERITING};case f.isFIFO():return{filetype:WASI_FILETYPE_SOCKET_STREAM,rightsBase:RIGHTS_SOCKET_BASE,rightsInheriting:RIGHTS_SOCKET_INHERITING};case f.isFile():return{filetype:WASI_FILETYPE_REGULAR_FILE,rightsBase:RIGHTS_REGULAR_FILE_BASE,rightsInheriting:RIGHTS_REGULAR_FILE_INHERITING}; | ||
case f.isSocket():return{filetype:WASI_FILETYPE_SOCKET_STREAM,rightsBase:RIGHTS_SOCKET_BASE,rightsInheriting:RIGHTS_SOCKET_INHERITING};case f.isSymbolicLink():return{filetype:WASI_FILETYPE_SYMBOLIC_LINK,rightsBase:BigIntPolyfill(0),rightsInheriting:BigIntPolyfill(0)};default:return{filetype:WASI_FILETYPE_UNKNOWN,rightsBase:BigIntPolyfill(0),rightsInheriting:BigIntPolyfill(0)}}},WASIExitError=function(e){function c(c){var d=e.call(this,"WASI Exit error: "+c)||this;d.code=c;return d}__extends(c,e); | ||
return c}(Error),WASIKillError=function(e){function c(c){var d=e.call(this,"WASI Kill signal: "+c)||this;d.signal=c;return d}__extends(c,e);return c}(Error),WASI=function(){function e(c){var e,d=this,x={};c&&c.preopenDirectories&&(x=c.preopenDirectories);var w={};c&&c.env&&(w=c.env);var v=[];c&&c.args&&(v=c.args);var r=defaultBindings;c&&c.bindings&&(r=c.bindings);this.view=this.memory=void 0;this.bindings=r;this.FD_MAP=new Map([[WASI_STDIN_FILENO,{real:0,filetype:void 0,rights:{base:RIGHTS_REGULAR_FILE_BASE, | ||
inheriting:BigIntPolyfill(0)},path:void 0}],[WASI_STDOUT_FILENO,{real:1,filetype:void 0,rights:{base:RIGHTS_REGULAR_FILE_BASE,inheriting:BigIntPolyfill(0)},path:void 0}],[WASI_STDERR_FILENO,{real:2,filetype:void 0,rights:{base:RIGHTS_REGULAR_FILE_BASE,inheriting:BigIntPolyfill(0)},path:void 0}]]);var g=this.bindings.fs,n=this.bindings.path;try{for(var z=__values(Object.entries(x)),y=z.next();!y.done;y=z.next()){var C=__read(y.value,2),G=C[0],D=C[1],H=g.openSync(D,g.constants.O_RDONLY),I=__spread(this.FD_MAP.keys()).reverse()[0]+ | ||
1;this.FD_MAP.set(I,{real:H,filetype:WASI_FILETYPE_DIRECTORY,rights:{base:RIGHTS_DIRECTORY_BASE,inheriting:RIGHTS_DIRECTORY_INHERITING},fakePath:G,path:D})}}catch(a){var E={error:a}}finally{try{y&&!y.done&&(e=z.return)&&e.call(z)}finally{if(E)throw E.error;}}var A=function(a,b){d.refreshMemory();return Array.from({length:b},function(b,c){c=a+8*c;b=d.view.getUint32(c,!0);c=d.view.getUint32(c+4,!0);return new Uint8Array(d.memory.buffer,b,c)})},h=function(a,b){a=stat(d,a);if(b!==BigIntPolyfill(0)&&(a.rights.base& | ||
b)===BigIntPolyfill(0))throw WASI_EPERM;return a},J=r.hrtime(),B=function(a){switch(a){case WASI_CLOCK_MONOTONIC:case WASI_CLOCK_REALTIME:return r.hrtime();case WASI_CLOCK_PROCESS_CPUTIME_ID:case WASI_CLOCK_THREAD_CPUTIME_ID:return r.hrtime()-J;default:return null}};this.wasiImport={args_get:function(a,b){d.refreshMemory();var k=a,c=b;v.forEach(function(a){d.view.setUint32(k,c,!0);k+=4;c+=isomorphicBuffer.from(d.memory.buffer).write(a+"\x00",c)});return WASI_ESUCCESS},args_sizes_get:function(a,b){d.refreshMemory(); | ||
d.view.setUint32(a,v.length,!0);a=v.reduce(function(a,b){return a+isomorphicBuffer.byteLength(b)+1},0);d.view.setUint32(b,a,!0);return WASI_ESUCCESS},environ_get:function(a,b){d.refreshMemory();var k=a,c=b;Object.entries(w).forEach(function(a){var b=__read(a,2);a=b[0];b=b[1];d.view.setUint32(k,c,!0);k+=4;c+=isomorphicBuffer.from(d.memory.buffer).write(a+"="+b+"\x00",c)});return WASI_ESUCCESS},environ_sizes_get:function(a,b){d.refreshMemory();var k=Object.entries(w).map(function(a){a=__read(a,2);return a[0]+ | ||
"="+a[1]+"\x00"}),c=k.reduce(function(a,b){return a+isomorphicBuffer.byteLength(b)},0);d.view.setUint32(a,k.length,!0);d.view.setUint32(b,c,!0);return WASI_ESUCCESS},clock_res_get:function(a,b){d.view.setBigUint64(b,BigIntPolyfill(0));return WASI_ESUCCESS},clock_time_get:function(a,b,c){d.refreshMemory();a=B(a);if(null===a)return WASI_EINVAL;d.view.setBigUint64(c,BigIntPolyfill(a),!0);return WASI_ESUCCESS},fd_advise:wrap(function(a,b,d,c){h(a,WASI_RIGHT_FD_ADVISE);return WASI_ENOSYS}),fd_allocate:wrap(function(a, | ||
b,d){h(a,WASI_RIGHT_FD_ALLOCATE);return WASI_ENOSYS}),fd_close:wrap(function(a){var b=h(a,BigIntPolyfill(0));g.closeSync(b.real);d.FD_MAP.delete(a);return WASI_ESUCCESS}),fd_datasync:function(a){a=h(a,WASI_RIGHT_FD_DATASYNC);g.fdatasyncSync(a.real);return WASI_ESUCCESS},fd_fdstat_get:wrap(function(a,b){a=h(a,BigIntPolyfill(0));d.refreshMemory();d.view.setUint8(b,a.filetype);d.view.setUint16(b+2,0,!0);d.view.setUint16(b+4,0,!0);d.view.setBigUint64(b+8,a.rights.base,!0);d.view.setBigUint64(b+8+8,a.rights.inheriting, | ||
!0);return WASI_ESUCCESS}),fd_fdstat_set_flags:wrap(function(a,b){h(a,WASI_RIGHT_FD_FDSTAT_SET_FLAGS);return WASI_ENOSYS}),fd_fdstat_set_rights:wrap(function(a,b,d){a=h(a,BigIntPolyfill(0));b|=a.rights.base;if(b>a.rights.base)return WASI_EPERM;d|=a.rights.inheriting;if(d>a.rights.inheriting)return WASI_EPERM;a.rights.base=b;a.rights.inheriting=d;return WASI_ESUCCESS}),fd_filestat_get:wrap(function(a,b){a=h(a,WASI_RIGHT_FD_FILESTAT_GET);var c=g.fstatSync(a.real);d.refreshMemory();d.view.setBigUint64(b, | ||
BigIntPolyfill(c.dev),!0);b+=8;d.view.setBigUint64(b,BigIntPolyfill(c.ino),!0);b+=8;d.view.setUint8(b,a.filetype);b+=4;d.view.setUint32(b,Number(c.nlink),!0);b+=4;d.view.setBigUint64(b,BigIntPolyfill(c.size),!0);b+=8;d.view.setBigUint64(b,msToNs(c.atimeMs),!0);b+=8;d.view.setBigUint64(b,msToNs(c.mtimeMs),!0);d.view.setBigUint64(b+8,msToNs(c.ctimeMs),!0);return WASI_ESUCCESS}),fd_filestat_set_size:wrap(function(a,b){a=h(a,WASI_RIGHT_FD_FILESTAT_SET_SIZE);g.ftruncate(a.real,Number(b));return WASI_ESUCCESS}), | ||
fd_filestat_set_times:wrap(function(a,b,d,c){a=h(a,WASI_RIGHT_FD_FILESTAT_SET_TIMES);var k=B(WASI_CLOCK_REALTIME);g.futimesSync(a.real,(c&WASI_FILESTAT_SET_ATIM_NOW)===WASI_FILESTAT_SET_ATIM_NOW?k:b,(c&WASI_FILESTAT_SET_MTIM_NOW)===WASI_FILESTAT_SET_MTIM_NOW?k:d);return WASI_ESUCCESS}),fd_prestat_get:wrap(function(a,b){a=h(a,BigIntPolyfill(0));if(!a.path)return WASI_EINVAL;d.refreshMemory();d.view.setUint8(b,WASI_PREOPENTYPE_DIR);d.view.setUint32(b+4,isomorphicBuffer.byteLength(a.fakePath),!0);return WASI_ESUCCESS}), | ||
fd_prestat_dir_name:wrap(function(a,b,c){a=h(a,BigIntPolyfill(0));if(!a.path)return WASI_EINVAL;d.refreshMemory();isomorphicBuffer.from(d.memory.buffer).write(a.fakePath,b,c,"utf8");return WASI_ESUCCESS}),fd_pwrite:wrap(function(a,b,c,e,u){var k=h(a,WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_SEEK),f=0;A(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=g.writeSync(k.real,a,b,a.byteLength-b,e+f+b);f+=b});d.view.setUint32(u,f,!0);return WASI_ESUCCESS}),fd_write:wrap(function(a,b,c,e){var k=h(a,WASI_RIGHT_FD_WRITE), | ||
f=0;A(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=g.writeSync(k.real,a,b,a.byteLength-b);f+=b});d.view.setUint32(e,f,!0);return WASI_ESUCCESS}),fd_pread:wrap(function(a,b,c,e,f){var k=h(a,WASI_RIGHT_FD_READ|WASI_RIGHT_FD_SEEK),u=0;A(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=g.readSync(k.real,a,b,a.byteLength-b,e+u+b);u+=b});d.view.setUint32(f,u,!0);return WASI_ESUCCESS}),fd_read:wrap(function(a,b,c,e){var k;a=h(a,WASI_RIGHT_FD_READ);var f=0;try{var q=__values(A(b,c)),t=q.next(); | ||
a:for(;!t.done;t=q.next()){var l=t.value;for(b=0;b<l.byteLength;){var n=g.readSync(a.real,l,b,l.byteLength-b);b+=n;f+=n;if(0===n)break a}}}catch(K){var m={error:K}}finally{try{t&&!t.done&&(k=q.return)&&k.call(q)}finally{if(m)throw m.error;}}d.view.setUint32(e,f,!0);return WASI_ESUCCESS}),fd_readdir:wrap(function(a,b,c,e,f){a=h(a,WASI_RIGHT_FD_READDIR);d.refreshMemory();var k=g.readdirSync(a.path,{withFileTypes:!0}),u=b;for(e=Number(e);e<k.length;e+=1){var q=k[e];d.view.setBigUint64(b,BigIntPolyfill(e+ | ||
1),!0);b+=8;var l=g.statSync(n.resolve(a.path,q.name));d.view.setBigUint64(b,BigIntPolyfill(l.ino),!0);b+=8;d.view.setUint32(b,isomorphicBuffer.byteLength(q.name),!0);b+=4;switch(!0){case l.isBlockDevice():l=WASI_FILETYPE_BLOCK_DEVICE;break;case l.isCharacterDevice():l=WASI_FILETYPE_CHARACTER_DEVICE;break;case l.isDirectory():l=WASI_FILETYPE_DIRECTORY;break;case l.isFIFO():l=WASI_FILETYPE_SOCKET_STREAM;break;case l.isFile():l=WASI_FILETYPE_REGULAR_FILE;break;case l.isSocket():l=WASI_FILETYPE_SOCKET_STREAM; | ||
break;case l.isSymbolicLink():l=WASI_FILETYPE_SYMBOLIC_LINK;break;default:l=WASI_FILETYPE_UNKNOWN}d.view.setUint8(b,l);b+=1;b+=3;isomorphicBuffer.from(d.memory.buffer).write(q.name,b,c-b);b+=isomorphicBuffer.byteLength(q.name);b+=8%b}d.view.setUint32(f,b-u,!0);return WASI_ESUCCESS}),fd_renumber:wrap(function(a,b){h(a,BigIntPolyfill(0));h(b,BigIntPolyfill(0));g.closeSync(d.FD_MAP.get(a).real);d.FD_MAP.set(a,d.FD_MAP.get(b));d.FD_MAP.delete(b);return WASI_ESUCCESS}),fd_seek:wrap(function(a,b,c,e){h(a, | ||
WASI_RIGHT_FD_SEEK);d.refreshMemory();throw Error("fd_seek to be implemented (without binding)");}),fd_tell:wrap(function(a,b){h(a,WASI_RIGHT_FD_TELL);d.refreshMemory();throw Error("fd_tell to be implemented (without binding)");}),fd_sync:wrap(function(a){a=h(a,WASI_RIGHT_FD_SYNC);g.fsyncSync(a.real);return WASI_ESUCCESS}),path_create_directory:wrap(function(a,b,c){a=h(a,WASI_RIGHT_PATH_CREATE_DIRECTORY);if(!a.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,c).toString(); | ||
g.mkdirSync(n.resolve(a.path,b));return WASI_ESUCCESS}),path_filestat_get:wrap(function(a,b,c,e,f){a=h(a,WASI_RIGHT_PATH_FILESTAT_GET);if(!a.path)return WASI_EINVAL;d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,e).toString();c=g.statSync(n.resolve(a.path,c));d.view.setBigUint64(f,BigIntPolyfill(c.dev),!0);f+=8;d.view.setBigUint64(f,BigIntPolyfill(c.ino),!0);f+=8;d.view.setUint8(f,translateFileAttributes(d,void 0,c).filetype);f+=4;d.view.setUint32(f,Number(c.nlink),!0);f+=4;d.view.setBigUint64(f, | ||
BigIntPolyfill(c.size),!0);f+=8;d.view.setBigUint64(f,msToNs(c.atimeMs),!0);f+=8;d.view.setBigUint64(f,msToNs(c.mtimeMs),!0);d.view.setBigUint64(f+8,msToNs(c.ctimeMs),!0);return WASI_ESUCCESS}),path_filestat_set_times:wrap(function(a,b,c,e,f,p){a=h(a,WASI_RIGHT_PATH_FILESTAT_SET_TIMES);if(!a.path)return WASI_EINVAL;d.refreshMemory();var k=B(WASI_CLOCK_REALTIME),u=(b&WASI_FILESTAT_SET_ATIM_NOW)===WASI_FILESTAT_SET_ATIM_NOW;b=(b&WASI_FILESTAT_SET_MTIM_NOW)===WASI_FILESTAT_SET_MTIM_NOW;c=isomorphicBuffer.from(d.memory.buffer, | ||
c,e).toString();g.utimesSync(n.resolve(a.path,c),u?k:f,b?k:p);return WASI_ESUCCESS}),path_link:wrap(function(a,b,c,e,f,p,r){a=h(a,WASI_RIGHT_PATH_LINK_SOURCE);f=h(f,WASI_RIGHT_PATH_LINK_TARGET);if(!a.path||!f.path)return WASI_EINVAL;d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,e).toString();p=isomorphicBuffer.from(d.memory.buffer,p,r).toString();g.linkSync(n.resolve(a.path,c),n.resolve(f.path,p));return WASI_ESUCCESS}),path_open:wrap(function(a,b,c,e,f,p,r,t,l){b=h(a,WASI_RIGHT_PATH_OPEN); | ||
a=(p&(WASI_RIGHT_FD_READ|WASI_RIGHT_FD_READDIR))!==BigIntPolyfill(0);var k=(p&(WASI_RIGHT_FD_DATASYNC|WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_ALLOCATE|WASI_RIGHT_FD_FILESTAT_SET_SIZE))!==BigIntPolyfill(0);if(k&&a)var m=g.constants.O_RDWR;else a?m=g.constants.O_RDONLY:k&&(m=g.constants.O_WRONLY);a=WASI_RIGHT_PATH_OPEN;p|=r;0!==(f&WASI_O_CREAT)&&(m|=g.constants.O_CREAT,a|=WASI_RIGHT_PATH_CREATE_FILE);0!==(f&WASI_O_DIRECTORY)&&(m|=g.constants.O_DIRECTORY);0!==(f&WASI_O_EXCL)&&(m|=g.constants.O_EXCL);0!==(f& | ||
WASI_O_TRUNC)&&(m|=g.constants.O_TRUNC,a|=WASI_RIGHT_PATH_FILESTAT_SET_SIZE);0!==(t&WASI_FDFLAG_APPEND)&&(m|=g.constants.O_APPEND);0!==(t&WASI_FDFLAG_DSYNC)&&(m=g.constants.O_DSYNC?m|g.constants.O_DSYNC:m|g.constants.O_SYNC,p|=WASI_RIGHT_FD_DATASYNC);0!==(t&WASI_FDFLAG_NONBLOCK)&&(m|=g.constants.O_NONBLOCK);0!==(t&WASI_FDFLAG_RSYNC)&&(m=g.constants.O_RSYNC?m|g.constants.O_RSYNC:m|g.constants.O_SYNC,p|=WASI_RIGHT_FD_SYNC);0!==(t&WASI_FDFLAG_SYNC)&&(m|=g.constants.O_SYNC,p|=WASI_RIGHT_FD_SYNC);k&&0=== | ||
(m&(g.constants.O_APPEND|g.constants.O_TRUNC))&&(p|=WASI_RIGHT_FD_SEEK);d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,e).toString();c=n.resolve(b.path,c);if(n.relative(b.path,c).startsWith(".."))return WASI_ENOTCAPABLE;try{var q=g.realpathSync(c);if(n.relative(b.path,q).startsWith(".."))return WASI_ENOTCAPABLE}catch(F){if("ENOENT"===F.code)q=c;else throw F;}m=g.openSync(q,m);c=__spread(d.FD_MAP.keys()).reverse()[0]+1;d.FD_MAP.set(c,{real:m,filetype:void 0,rights:{base:a,inheriting:p}, | ||
path:q});stat(d,c);d.view.setUint32(l,c,!0);return WASI_ESUCCESS}),path_readlink:wrap(function(a,b,c,e,f,p){a=h(a,WASI_RIGHT_PATH_READLINK);if(!a.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,c).toString();b=n.resolve(a.path,b);b=g.readlinkSync(b);e=isomorphicBuffer.from(d.memory.buffer).write(b,e,f);d.view.setUint32(p,e,!0);return WASI_ESUCCESS}),path_remove_directory:wrap(function(a,b,c){a=h(a,WASI_RIGHT_PATH_REMOVE_DIRECTORY);if(!a.path)return WASI_EINVAL; | ||
d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,c).toString();g.rmdirSync(n.resolve(a.path,b));return WASI_ESUCCESS}),path_rename:wrap(function(a,b,c,e,f,p){a=h(a,WASI_RIGHT_PATH_RENAME_SOURCE);e=h(e,WASI_RIGHT_PATH_RENAME_TARGET);if(!a.path||!e.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,c).toString();f=isomorphicBuffer.from(d.memory.buffer,f,p).toString();g.renameSync(n.resolve(a.path,b),n.resolve(e.path,f));return WASI_ESUCCESS}),path_symlink:wrap(function(a, | ||
b,c,e,f){c=h(c,WASI_RIGHT_PATH_SYMLINK);if(!c.path)return WASI_EINVAL;d.refreshMemory();a=isomorphicBuffer.from(d.memory.buffer,a,b).toString();e=isomorphicBuffer.from(d.memory.buffer,e,f).toString();g.symlinkSync(a,n.resolve(c.path,e));return WASI_ESUCCESS}),path_unlink_file:wrap(function(a,b,c){a=h(a,WASI_RIGHT_PATH_UNLINK_FILE);if(!a.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,c).toString();g.unlinkSync(n.resolve(a.path,b));return WASI_ESUCCESS}),poll_oneoff:function(a, | ||
b,c,e){var f=0,g=0;d.refreshMemory();for(var h=0;h<c;h+=1){var k=d.view.getBigUint64(a,!0);a+=8;var l=d.view.getUint8(a);a+=1;switch(l){case WASI_EVENTTYPE_CLOCK:a+=7;d.view.getBigUint64(a,!0);a+=8;var n=d.view.getUint32(a,!0);a+=4;a+=4;l=d.view.getBigUint64(a,!0);a+=8;d.view.getBigUint64(a,!0);a+=8;var m=d.view.getUint16(a,!0);a+=2;a+=6;var q=1===m;m=WASI_ESUCCESS;n=B(n);null===n?m=WASI_EINVAL:(l=q?l:n+l,g=l>g?l:g);d.view.setBigUint64(b,k,!0);b+=8;d.view.setUint16(b,m,!0);b+=2;d.view.setUint8(b, | ||
WASI_EVENTTYPE_CLOCK);b+=1;b+=5;f+=1;break;case WASI_EVENTTYPE_FD_READ:case WASI_EVENTTYPE_FD_WRITE:a+=3;d.view.getUint32(a,!0);a+=4;d.view.setBigUint64(b,k,!0);b+=8;d.view.setUint16(b,WASI_ENOSYS,!0);b+=2;d.view.setUint8(b,l);b+=1;b+=5;f+=1;break;default:return WASI_EINVAL}}for(d.view.setUint32(e,f,!0);r.hrtime()<g;);return WASI_ESUCCESS},proc_exit:function(a){r.exit(a);return WASI_ESUCCESS},proc_raise:function(a){if(!(a in SIGNAL_MAP))return WASI_EINVAL;r.kill(SIGNAL_MAP[a]);return WASI_ESUCCESS}, | ||
random_get:function(a,b){d.refreshMemory();r.randomFillSync(new Uint8Array(d.memory.buffer),a,b);return WASI_ESUCCESS},sched_yield:function(){return WASI_ENOSYS},sock_recv:function(){return WASI_ENOSYS},sock_send:function(){return WASI_ENOSYS},sock_shutdown:function(){return WASI_ENOSYS}}}e.prototype.refreshMemory=function(){this.view&&0!==this.view.buffer.byteLength||(this.view=new DataViewPolyfill(this.memory.buffer))};e.prototype.setMemory=function(c){this.memory=c};e.prototype.start=function(c){c= | ||
c.exports;if(null===c||"object"!==typeof c)throw Error("instance.exports must be an Object. Received "+c+".");var e=c.memory;if(!(e instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+e+".");this.setMemory(e);c._start&&c._start()};e.defaultBindings=defaultBindings;return e}();module.exports=WASI; | ||
case f.isSocket():return{filetype:WASI_FILETYPE_SOCKET_STREAM,rightsBase:RIGHTS_SOCKET_BASE,rightsInheriting:RIGHTS_SOCKET_INHERITING};case f.isSymbolicLink():return{filetype:WASI_FILETYPE_SYMBOLIC_LINK,rightsBase:BigIntPolyfill(0),rightsInheriting:BigIntPolyfill(0)};default:return{filetype:WASI_FILETYPE_UNKNOWN,rightsBase:BigIntPolyfill(0),rightsInheriting:BigIntPolyfill(0)}}},WASIExitError=function(e){function b(b){var d=e.call(this,"WASI Exit error: "+b)||this;d.code=b;return d}__extends(b,e); | ||
return b}(Error),WASIKillError=function(e){function b(b){var d=e.call(this,"WASI Kill signal: "+b)||this;d.signal=b;return d}__extends(b,e);return b}(Error),WASI=function(){function e(b){var e,d=this,v={};b&&b.preopenDirectories&&(v=b.preopenDirectories);var x={};b&&b.env&&(x=b.env);var w=[];b&&b.args&&(w=b.args);var r=defaultBindings;b&&b.bindings&&(r=b.bindings);this.view=this.memory=void 0;this.bindings=r;this.FD_MAP=new Map([[WASI_STDIN_FILENO,{real:0,filetype:void 0,offset:BigIntPolyfill(0), | ||
rights:{base:RIGHTS_REGULAR_FILE_BASE,inheriting:BigIntPolyfill(0)},path:void 0}],[WASI_STDOUT_FILENO,{real:1,filetype:void 0,offset:BigIntPolyfill(0),rights:{base:RIGHTS_REGULAR_FILE_BASE,inheriting:BigIntPolyfill(0)},path:void 0}],[WASI_STDERR_FILENO,{real:2,filetype:void 0,offset:BigIntPolyfill(0),rights:{base:RIGHTS_REGULAR_FILE_BASE,inheriting:BigIntPolyfill(0)},path:void 0}]]);var g=this.bindings.fs,q=this.bindings.path;try{for(var z=__values(Object.entries(v)),y=z.next();!y.done;y=z.next()){var C= | ||
__read(y.value,2),H=C[0],D=C[1],I=g.openSync(D,g.constants.O_RDONLY),J=__spread(this.FD_MAP.keys()).reverse()[0]+1;this.FD_MAP.set(J,{real:I,filetype:WASI_FILETYPE_DIRECTORY,offset:BigIntPolyfill(0),rights:{base:RIGHTS_DIRECTORY_BASE,inheriting:RIGHTS_DIRECTORY_INHERITING},fakePath:H,path:D})}}catch(a){var E={error:a}}finally{try{y&&!y.done&&(e=z.return)&&e.call(z)}finally{if(E)throw E.error;}}var A=function(a,c){d.refreshMemory();return Array.from({length:c},function(c,b){b=a+8*b;c=d.view.getUint32(b, | ||
!0);b=d.view.getUint32(b+4,!0);return new Uint8Array(d.memory.buffer,c,b)})},h=function(a,c){a=stat(d,a);if(c!==BigIntPolyfill(0)&&(a.rights.base&c)===BigIntPolyfill(0))throw WASI_EPERM;return a},K=r.hrtime(),B=function(a){switch(a){case WASI_CLOCK_MONOTONIC:case WASI_CLOCK_REALTIME:return r.hrtime();case WASI_CLOCK_PROCESS_CPUTIME_ID:case WASI_CLOCK_THREAD_CPUTIME_ID:return r.hrtime()-K;default:return null}};this.wasiImport={args_get:function(a,c){d.refreshMemory();var b=a,e=c;w.forEach(function(a){d.view.setUint32(b, | ||
e,!0);b+=4;e+=isomorphicBuffer.from(d.memory.buffer).write(a+"\x00",e)});return WASI_ESUCCESS},args_sizes_get:function(a,c){d.refreshMemory();d.view.setUint32(a,w.length,!0);a=w.reduce(function(a,c){return a+isomorphicBuffer.byteLength(c)+1},0);d.view.setUint32(c,a,!0);return WASI_ESUCCESS},environ_get:function(a,c){d.refreshMemory();var b=a,e=c;Object.entries(x).forEach(function(a){var c=__read(a,2);a=c[0];c=c[1];d.view.setUint32(b,e,!0);b+=4;e+=isomorphicBuffer.from(d.memory.buffer).write(a+"="+ | ||
c+"\x00",e)});return WASI_ESUCCESS},environ_sizes_get:function(a,c){d.refreshMemory();var b=Object.entries(x).map(function(a){a=__read(a,2);return a[0]+"="+a[1]+"\x00"}),e=b.reduce(function(a,c){return a+isomorphicBuffer.byteLength(c)},0);d.view.setUint32(a,b.length,!0);d.view.setUint32(c,e,!0);return WASI_ESUCCESS},clock_res_get:function(a,c){d.view.setBigUint64(c,BigIntPolyfill(0));return WASI_ESUCCESS},clock_time_get:function(a,c,b){d.refreshMemory();a=B(a);if(null===a)return WASI_EINVAL;d.view.setBigUint64(b, | ||
BigIntPolyfill(a),!0);return WASI_ESUCCESS},fd_advise:wrap(function(a,c,d,b){h(a,WASI_RIGHT_FD_ADVISE);return WASI_ENOSYS}),fd_allocate:wrap(function(a,c,d){h(a,WASI_RIGHT_FD_ALLOCATE);return WASI_ENOSYS}),fd_close:wrap(function(a){var c=h(a,BigIntPolyfill(0));g.closeSync(c.real);d.FD_MAP.delete(a);return WASI_ESUCCESS}),fd_datasync:function(a){a=h(a,WASI_RIGHT_FD_DATASYNC);g.fdatasyncSync(a.real);return WASI_ESUCCESS},fd_fdstat_get:wrap(function(a,c){a=h(a,BigIntPolyfill(0));d.refreshMemory();d.view.setUint8(c, | ||
a.filetype);d.view.setUint16(c+2,0,!0);d.view.setUint16(c+4,0,!0);d.view.setBigUint64(c+8,a.rights.base,!0);d.view.setBigUint64(c+8+8,a.rights.inheriting,!0);return WASI_ESUCCESS}),fd_fdstat_set_flags:wrap(function(a,c){h(a,WASI_RIGHT_FD_FDSTAT_SET_FLAGS);return WASI_ENOSYS}),fd_fdstat_set_rights:wrap(function(a,c,d){a=h(a,BigIntPolyfill(0));c|=a.rights.base;if(c>a.rights.base)return WASI_EPERM;d|=a.rights.inheriting;if(d>a.rights.inheriting)return WASI_EPERM;a.rights.base=c;a.rights.inheriting=d; | ||
return WASI_ESUCCESS}),fd_filestat_get:wrap(function(a,c){a=h(a,WASI_RIGHT_FD_FILESTAT_GET);var b=g.fstatSync(a.real);d.refreshMemory();d.view.setBigUint64(c,BigIntPolyfill(b.dev),!0);c+=8;d.view.setBigUint64(c,BigIntPolyfill(b.ino),!0);c+=8;d.view.setUint8(c,a.filetype);c+=4;d.view.setUint32(c,Number(b.nlink),!0);c+=4;d.view.setBigUint64(c,BigIntPolyfill(b.size),!0);c+=8;d.view.setBigUint64(c,msToNs(b.atimeMs),!0);c+=8;d.view.setBigUint64(c,msToNs(b.mtimeMs),!0);d.view.setBigUint64(c+8,msToNs(b.ctimeMs), | ||
!0);return WASI_ESUCCESS}),fd_filestat_set_size:wrap(function(a,c){a=h(a,WASI_RIGHT_FD_FILESTAT_SET_SIZE);g.ftruncate(a.real,Number(c));return WASI_ESUCCESS}),fd_filestat_set_times:wrap(function(a,c,d,b){a=h(a,WASI_RIGHT_FD_FILESTAT_SET_TIMES);var e=B(WASI_CLOCK_REALTIME);g.futimesSync(a.real,(b&WASI_FILESTAT_SET_ATIM_NOW)===WASI_FILESTAT_SET_ATIM_NOW?e:c,(b&WASI_FILESTAT_SET_MTIM_NOW)===WASI_FILESTAT_SET_MTIM_NOW?e:d);return WASI_ESUCCESS}),fd_prestat_get:wrap(function(a,c){a=h(a,BigIntPolyfill(0)); | ||
if(!a.path)return WASI_EINVAL;d.refreshMemory();d.view.setUint8(c,WASI_PREOPENTYPE_DIR);d.view.setUint32(c+4,isomorphicBuffer.byteLength(a.fakePath),!0);return WASI_ESUCCESS}),fd_prestat_dir_name:wrap(function(a,c,b){a=h(a,BigIntPolyfill(0));if(!a.path)return WASI_EINVAL;d.refreshMemory();isomorphicBuffer.from(d.memory.buffer).write(a.fakePath,c,b,"utf8");return WASI_ESUCCESS}),fd_pwrite:wrap(function(a,c,b,e,f){var m=h(a,WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_SEEK),n=0;A(c,b).forEach(function(a){for(var c= | ||
0;c<a.byteLength;)c+=g.writeSync(m.real,a,c,a.byteLength-c,e+n+c);n+=c});d.view.setUint32(f,n,!0);return WASI_ESUCCESS}),fd_write:wrap(function(a,c,b,e){var m=h(a,WASI_RIGHT_FD_WRITE),f=0;A(c,b).forEach(function(a){for(var c=0;c<a.byteLength;)c+=g.writeSync(m.real,a,c,a.byteLength-c);f+=c});d.view.setUint32(e,f,!0);return WASI_ESUCCESS}),fd_pread:wrap(function(a,c,b,e,f){var m=h(a,WASI_RIGHT_FD_READ|WASI_RIGHT_FD_SEEK),n=0;A(c,b).forEach(function(a){for(var c=0;c<a.byteLength;)c+=g.readSync(m.real, | ||
a,c,a.byteLength-c,e+n+c);n+=c});d.view.setUint32(f,n,!0);return WASI_ESUCCESS}),fd_read:wrap(function(a,c,b,e){var m;a=h(a,WASI_RIGHT_FD_READ);var f=0;try{var k=__values(A(c,b)),u=k.next();a:for(;!u.done;u=k.next()){var l=u.value;for(c=0;c<l.byteLength;){var t=g.readSync(a.real,l,c,BigIntPolyfill(l.byteLength-c)+a.offset);c+=t;f+=t;if(0===t)break a}}}catch(L){var F={error:L}}finally{try{u&&!u.done&&(m=k.return)&&m.call(k)}finally{if(F)throw F.error;}}a.offset+=BigIntPolyfill(f);d.view.setUint32(e, | ||
f,!0);return WASI_ESUCCESS}),fd_readdir:wrap(function(a,c,b,e,f){a=h(a,WASI_RIGHT_FD_READDIR);d.refreshMemory();var m=g.readdirSync(a.path,{withFileTypes:!0}),n=c;for(e=Number(e);e<m.length;e+=1){var k=m[e],l=isomorphicBuffer.byteLength(k.name);if(c+24+l>=n+b)break;d.view.setBigUint64(c,BigIntPolyfill(e+1),!0);c+=8;var t=g.statSync(q.resolve(a.path,k.name));d.view.setBigUint64(c,BigIntPolyfill(t.ino),!0);c+=8;d.view.setUint32(c,l,!0);c+=4;switch(!0){case t.isBlockDevice():l=WASI_FILETYPE_BLOCK_DEVICE; | ||
break;case t.isCharacterDevice():l=WASI_FILETYPE_CHARACTER_DEVICE;break;case t.isDirectory():l=WASI_FILETYPE_DIRECTORY;break;case t.isFIFO():l=WASI_FILETYPE_SOCKET_STREAM;break;case t.isFile():l=WASI_FILETYPE_REGULAR_FILE;break;case t.isSocket():l=WASI_FILETYPE_SOCKET_STREAM;break;case t.isSymbolicLink():l=WASI_FILETYPE_SYMBOLIC_LINK;break;default:l=WASI_FILETYPE_UNKNOWN}d.view.setUint8(c,l);c+=1;c+=3;isomorphicBuffer.from(d.memory.buffer).write(k.name,c);c+=isomorphicBuffer.byteLength(k.name)}d.view.setUint32(f, | ||
c-n,!0);return WASI_ESUCCESS}),fd_renumber:wrap(function(a,c){h(a,BigIntPolyfill(0));h(c,BigIntPolyfill(0));g.closeSync(d.FD_MAP.get(a).real);d.FD_MAP.set(a,d.FD_MAP.get(c));d.FD_MAP.delete(c);return WASI_ESUCCESS}),fd_seek:wrap(function(a,c,b,e){a=h(a,WASI_RIGHT_FD_SEEK);d.refreshMemory();switch(b){case WASI_WHENCE_CUR:a.offset+=BigIntPolyfill(c);break;case WASI_WHENCE_END:b=g.fstatSync(a.real).size;a.offset=BigIntPolyfill(b)+BigIntPolyfill(c);break;case WASI_WHENCE_SET:a.offset=BigIntPolyfill(c)}d.view.setBigUint64(e, | ||
a.offset,!0);return WASI_ESUCCESS}),fd_tell:wrap(function(a,c){h(a,WASI_RIGHT_FD_TELL);d.refreshMemory();throw Error("fd_tell to be implemented (without binding)");}),fd_sync:wrap(function(a){a=h(a,WASI_RIGHT_FD_SYNC);g.fsyncSync(a.real);return WASI_ESUCCESS}),path_create_directory:wrap(function(a,c,b){a=h(a,WASI_RIGHT_PATH_CREATE_DIRECTORY);if(!a.path)return WASI_EINVAL;d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,b).toString();g.mkdirSync(q.resolve(a.path,c));return WASI_ESUCCESS}), | ||
path_filestat_get:wrap(function(a,c,b,e,f){a=h(a,WASI_RIGHT_PATH_FILESTAT_GET);if(!a.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,e).toString();b=g.statSync(q.resolve(a.path,b));d.view.setBigUint64(f,BigIntPolyfill(b.dev),!0);f+=8;d.view.setBigUint64(f,BigIntPolyfill(b.ino),!0);f+=8;d.view.setUint8(f,translateFileAttributes(d,void 0,b).filetype);f+=4;d.view.setUint32(f,Number(b.nlink),!0);f+=4;d.view.setBigUint64(f,BigIntPolyfill(b.size),!0);f+=8;d.view.setBigUint64(f, | ||
msToNs(b.atimeMs),!0);f+=8;d.view.setBigUint64(f,msToNs(b.mtimeMs),!0);d.view.setBigUint64(f+8,msToNs(b.ctimeMs),!0);return WASI_ESUCCESS}),path_filestat_set_times:wrap(function(a,c,b,e,f,p){a=h(a,WASI_RIGHT_PATH_FILESTAT_SET_TIMES);if(!a.path)return WASI_EINVAL;d.refreshMemory();var m=B(WASI_CLOCK_REALTIME),n=(c&WASI_FILESTAT_SET_ATIM_NOW)===WASI_FILESTAT_SET_ATIM_NOW;c=(c&WASI_FILESTAT_SET_MTIM_NOW)===WASI_FILESTAT_SET_MTIM_NOW;b=isomorphicBuffer.from(d.memory.buffer,b,e).toString();g.utimesSync(q.resolve(a.path, | ||
b),n?m:f,c?m:p);return WASI_ESUCCESS}),path_link:wrap(function(a,c,b,e,f,p,r){a=h(a,WASI_RIGHT_PATH_LINK_SOURCE);f=h(f,WASI_RIGHT_PATH_LINK_TARGET);if(!a.path||!f.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,e).toString();p=isomorphicBuffer.from(d.memory.buffer,p,r).toString();g.linkSync(q.resolve(a.path,b),q.resolve(f.path,p));return WASI_ESUCCESS}),path_open:wrap(function(a,c,b,e,f,p,r,u,l){c=h(a,WASI_RIGHT_PATH_OPEN);p=BigIntPolyfill(p);r=BigIntPolyfill(r); | ||
a=(p&(WASI_RIGHT_FD_READ|WASI_RIGHT_FD_READDIR))!==BigIntPolyfill(0);var m=(p&(WASI_RIGHT_FD_DATASYNC|WASI_RIGHT_FD_WRITE|WASI_RIGHT_FD_ALLOCATE|WASI_RIGHT_FD_FILESTAT_SET_SIZE))!==BigIntPolyfill(0);if(m&&a)var k=g.constants.O_RDWR;else a?k=g.constants.O_RDONLY:m&&(k=g.constants.O_WRONLY);a=p|WASI_RIGHT_PATH_OPEN;p|=r;0!==(f&WASI_O_CREAT)&&(k|=g.constants.O_CREAT,a|=WASI_RIGHT_PATH_CREATE_FILE);0!==(f&WASI_O_DIRECTORY)&&(k|=g.constants.O_DIRECTORY);0!==(f&WASI_O_EXCL)&&(k|=g.constants.O_EXCL);0!== | ||
(f&WASI_O_TRUNC)&&(k|=g.constants.O_TRUNC,a|=WASI_RIGHT_PATH_FILESTAT_SET_SIZE);0!==(u&WASI_FDFLAG_APPEND)&&(k|=g.constants.O_APPEND);0!==(u&WASI_FDFLAG_DSYNC)&&(k=g.constants.O_DSYNC?k|g.constants.O_DSYNC:k|g.constants.O_SYNC,p|=WASI_RIGHT_FD_DATASYNC);0!==(u&WASI_FDFLAG_NONBLOCK)&&(k|=g.constants.O_NONBLOCK);0!==(u&WASI_FDFLAG_RSYNC)&&(k=g.constants.O_RSYNC?k|g.constants.O_RSYNC:k|g.constants.O_SYNC,p|=WASI_RIGHT_FD_SYNC);0!==(u&WASI_FDFLAG_SYNC)&&(k|=g.constants.O_SYNC,p|=WASI_RIGHT_FD_SYNC);m&& | ||
0===(k&(g.constants.O_APPEND|g.constants.O_TRUNC))&&(p|=WASI_RIGHT_FD_SEEK);d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,e).toString();b=q.resolve(c.path,b);if(q.relative(c.path,b).startsWith(".."))return WASI_ENOTCAPABLE;try{var n=g.realpathSync(b);if(q.relative(c.path,n).startsWith(".."))return WASI_ENOTCAPABLE}catch(G){if("ENOENT"===G.code)n=b;else throw G;}k=g.openSync(n,k);b=__spread(d.FD_MAP.keys()).reverse()[0]+1;d.FD_MAP.set(b,{real:k,filetype:void 0,offset:BigIntPolyfill(0), | ||
rights:{base:a,inheriting:p},path:n});stat(d,b);d.view.setUint32(l,b,!0);return WASI_ESUCCESS}),path_readlink:wrap(function(a,c,b,e,f,p){a=h(a,WASI_RIGHT_PATH_READLINK);if(!a.path)return WASI_EINVAL;d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,b).toString();c=q.resolve(a.path,c);c=g.readlinkSync(c);e=isomorphicBuffer.from(d.memory.buffer).write(c,e,f);d.view.setUint32(p,e,!0);return WASI_ESUCCESS}),path_remove_directory:wrap(function(a,c,b){a=h(a,WASI_RIGHT_PATH_REMOVE_DIRECTORY);if(!a.path)return WASI_EINVAL; | ||
d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,b).toString();g.rmdirSync(q.resolve(a.path,c));return WASI_ESUCCESS}),path_rename:wrap(function(a,c,b,e,f,p){a=h(a,WASI_RIGHT_PATH_RENAME_SOURCE);e=h(e,WASI_RIGHT_PATH_RENAME_TARGET);if(!a.path||!e.path)return WASI_EINVAL;d.refreshMemory();c=isomorphicBuffer.from(d.memory.buffer,c,b).toString();f=isomorphicBuffer.from(d.memory.buffer,f,p).toString();g.renameSync(q.resolve(a.path,c),q.resolve(e.path,f));return WASI_ESUCCESS}),path_symlink:wrap(function(a, | ||
c,b,e,f){b=h(b,WASI_RIGHT_PATH_SYMLINK);if(!b.path)return WASI_EINVAL;d.refreshMemory();a=isomorphicBuffer.from(d.memory.buffer,a,c).toString();e=isomorphicBuffer.from(d.memory.buffer,e,f).toString();g.symlinkSync(a,q.resolve(b.path,e));return WASI_ESUCCESS}),path_unlink_file:wrap(function(a,b,e){a=h(a,WASI_RIGHT_PATH_UNLINK_FILE);if(!a.path)return WASI_EINVAL;d.refreshMemory();b=isomorphicBuffer.from(d.memory.buffer,b,e).toString();g.unlinkSync(q.resolve(a.path,b));return WASI_ESUCCESS}),poll_oneoff:function(a, | ||
b,e,f){var c=0,g=0;d.refreshMemory();for(var k=0;k<e;k+=1){var h=d.view.getBigUint64(a,!0);a+=8;var l=d.view.getUint8(a);a+=1;switch(l){case WASI_EVENTTYPE_CLOCK:a+=7;d.view.getBigUint64(a,!0);a+=8;var m=d.view.getUint32(a,!0);a+=4;a+=4;l=d.view.getBigUint64(a,!0);a+=8;d.view.getBigUint64(a,!0);a+=8;var q=d.view.getUint16(a,!0);a+=2;a+=6;var v=1===q;q=WASI_ESUCCESS;m=BigIntPolyfill(B(m));null===m?q=WASI_EINVAL:(l=v?l:m+l,g=l>g?l:g);d.view.setBigUint64(b,h,!0);b+=8;d.view.setUint16(b,q,!0);b+=2;d.view.setUint8(b, | ||
WASI_EVENTTYPE_CLOCK);b+=1;b+=5;c+=1;break;case WASI_EVENTTYPE_FD_READ:case WASI_EVENTTYPE_FD_WRITE:a+=3;d.view.getUint32(a,!0);a+=4;d.view.setBigUint64(b,h,!0);b+=8;d.view.setUint16(b,WASI_ENOSYS,!0);b+=2;d.view.setUint8(b,l);b+=1;b+=5;c+=1;break;default:return WASI_EINVAL}}for(d.view.setUint32(f,c,!0);r.hrtime()<g;);return WASI_ESUCCESS},proc_exit:function(a){r.exit(a);return WASI_ESUCCESS},proc_raise:function(a){if(!(a in SIGNAL_MAP))return WASI_EINVAL;r.kill(SIGNAL_MAP[a]);return WASI_ESUCCESS}, | ||
random_get:function(a,b){d.refreshMemory();r.randomFillSync(new Uint8Array(d.memory.buffer),a,b);return WASI_ESUCCESS},sched_yield:function(){return WASI_ENOSYS},sock_recv:function(){return WASI_ENOSYS},sock_send:function(){return WASI_ENOSYS},sock_shutdown:function(){return WASI_ENOSYS}};Object.keys(this.wasiImport).forEach(function(a){var b=d.wasiImport[a];d.wasiImport[a]=function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];try{return b.apply(void 0,__spread(a))}catch(n){switch(console.log("Catched error: "+ | ||
n),n.code){default:throw n;case "ENOENT":return WASI_ENOENT}}}})}e.prototype.refreshMemory=function(){this.view&&0!==this.view.buffer.byteLength||(this.view=new DataViewPolyfill(this.memory.buffer))};e.prototype.setMemory=function(b){this.memory=b};e.prototype.start=function(b){b=b.exports;if(null===b||"object"!==typeof b)throw Error("instance.exports must be an Object. Received "+b+".");var e=b.memory;if(!(e instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+ | ||
e+".");this.setMemory(e);b._start&&b._start()};e.defaultBindings=defaultBindings;return e}();module.exports=WASI; |
@@ -116,44 +116,44 @@ export declare const WASI_ESUCCESS = 0; | ||
export declare const WASI_FDFLAG_SYNC = 16; | ||
export declare const WASI_RIGHT_FD_DATASYNC: any; | ||
export declare const WASI_RIGHT_FD_READ: any; | ||
export declare const WASI_RIGHT_FD_SEEK: any; | ||
export declare const WASI_RIGHT_FD_FDSTAT_SET_FLAGS: any; | ||
export declare const WASI_RIGHT_FD_SYNC: any; | ||
export declare const WASI_RIGHT_FD_TELL: any; | ||
export declare const WASI_RIGHT_FD_WRITE: any; | ||
export declare const WASI_RIGHT_FD_ADVISE: any; | ||
export declare const WASI_RIGHT_FD_ALLOCATE: any; | ||
export declare const WASI_RIGHT_PATH_CREATE_DIRECTORY: any; | ||
export declare const WASI_RIGHT_PATH_CREATE_FILE: any; | ||
export declare const WASI_RIGHT_PATH_LINK_SOURCE: any; | ||
export declare const WASI_RIGHT_PATH_LINK_TARGET: any; | ||
export declare const WASI_RIGHT_PATH_OPEN: any; | ||
export declare const WASI_RIGHT_FD_READDIR: any; | ||
export declare const WASI_RIGHT_PATH_READLINK: any; | ||
export declare const WASI_RIGHT_PATH_RENAME_SOURCE: any; | ||
export declare const WASI_RIGHT_PATH_RENAME_TARGET: any; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_GET: any; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_SET_SIZE: any; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_SET_TIMES: any; | ||
export declare const WASI_RIGHT_FD_FILESTAT_GET: any; | ||
export declare const WASI_RIGHT_FD_FILESTAT_SET_SIZE: any; | ||
export declare const WASI_RIGHT_FD_FILESTAT_SET_TIMES: any; | ||
export declare const WASI_RIGHT_PATH_SYMLINK: any; | ||
export declare const WASI_RIGHT_PATH_REMOVE_DIRECTORY: any; | ||
export declare const WASI_RIGHT_PATH_UNLINK_FILE: any; | ||
export declare const WASI_RIGHT_POLL_FD_READWRITE: any; | ||
export declare const WASI_RIGHT_SOCK_SHUTDOWN: any; | ||
export declare const RIGHTS_ALL: number; | ||
export declare const RIGHTS_BLOCK_DEVICE_BASE: number; | ||
export declare const RIGHTS_BLOCK_DEVICE_INHERITING: number; | ||
export declare const RIGHTS_CHARACTER_DEVICE_BASE: number; | ||
export declare const RIGHTS_CHARACTER_DEVICE_INHERITING: number; | ||
export declare const RIGHTS_REGULAR_FILE_BASE: number; | ||
export declare const RIGHTS_REGULAR_FILE_INHERITING: any; | ||
export declare const RIGHTS_DIRECTORY_BASE: number; | ||
export declare const RIGHTS_DIRECTORY_INHERITING: number; | ||
export declare const RIGHTS_SOCKET_BASE: number; | ||
export declare const RIGHTS_SOCKET_INHERITING: number; | ||
export declare const RIGHTS_TTY_BASE: number; | ||
export declare const RIGHTS_TTY_INHERITING: any; | ||
export declare const WASI_RIGHT_FD_DATASYNC: bigint; | ||
export declare const WASI_RIGHT_FD_READ: bigint; | ||
export declare const WASI_RIGHT_FD_SEEK: bigint; | ||
export declare const WASI_RIGHT_FD_FDSTAT_SET_FLAGS: bigint; | ||
export declare const WASI_RIGHT_FD_SYNC: bigint; | ||
export declare const WASI_RIGHT_FD_TELL: bigint; | ||
export declare const WASI_RIGHT_FD_WRITE: bigint; | ||
export declare const WASI_RIGHT_FD_ADVISE: bigint; | ||
export declare const WASI_RIGHT_FD_ALLOCATE: bigint; | ||
export declare const WASI_RIGHT_PATH_CREATE_DIRECTORY: bigint; | ||
export declare const WASI_RIGHT_PATH_CREATE_FILE: bigint; | ||
export declare const WASI_RIGHT_PATH_LINK_SOURCE: bigint; | ||
export declare const WASI_RIGHT_PATH_LINK_TARGET: bigint; | ||
export declare const WASI_RIGHT_PATH_OPEN: bigint; | ||
export declare const WASI_RIGHT_FD_READDIR: bigint; | ||
export declare const WASI_RIGHT_PATH_READLINK: bigint; | ||
export declare const WASI_RIGHT_PATH_RENAME_SOURCE: bigint; | ||
export declare const WASI_RIGHT_PATH_RENAME_TARGET: bigint; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_GET: bigint; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_SET_SIZE: bigint; | ||
export declare const WASI_RIGHT_PATH_FILESTAT_SET_TIMES: bigint; | ||
export declare const WASI_RIGHT_FD_FILESTAT_GET: bigint; | ||
export declare const WASI_RIGHT_FD_FILESTAT_SET_SIZE: bigint; | ||
export declare const WASI_RIGHT_FD_FILESTAT_SET_TIMES: bigint; | ||
export declare const WASI_RIGHT_PATH_SYMLINK: bigint; | ||
export declare const WASI_RIGHT_PATH_REMOVE_DIRECTORY: bigint; | ||
export declare const WASI_RIGHT_PATH_UNLINK_FILE: bigint; | ||
export declare const WASI_RIGHT_POLL_FD_READWRITE: bigint; | ||
export declare const WASI_RIGHT_SOCK_SHUTDOWN: bigint; | ||
export declare const RIGHTS_ALL: bigint; | ||
export declare const RIGHTS_BLOCK_DEVICE_BASE: bigint; | ||
export declare const RIGHTS_BLOCK_DEVICE_INHERITING: bigint; | ||
export declare const RIGHTS_CHARACTER_DEVICE_BASE: bigint; | ||
export declare const RIGHTS_CHARACTER_DEVICE_INHERITING: bigint; | ||
export declare const RIGHTS_REGULAR_FILE_BASE: bigint; | ||
export declare const RIGHTS_REGULAR_FILE_INHERITING: bigint; | ||
export declare const RIGHTS_DIRECTORY_BASE: bigint; | ||
export declare const RIGHTS_DIRECTORY_INHERITING: bigint; | ||
export declare const RIGHTS_SOCKET_BASE: bigint; | ||
export declare const RIGHTS_SOCKET_INHERITING: bigint; | ||
export declare const RIGHTS_TTY_BASE: bigint; | ||
export declare const RIGHTS_TTY_INHERITING: bigint; | ||
export declare const WASI_CLOCK_MONOTONIC = 0; | ||
@@ -160,0 +160,0 @@ export declare const WASI_CLOCK_PROCESS_CPUTIME_ID = 1; |
@@ -1,2 +0,2 @@ | ||
export declare const BigIntPolyfill: any; | ||
export declare type BigIntPolyfillType = any; | ||
export declare const BigIntPolyfill: typeof BigInt; | ||
export declare type BigIntPolyfillType = bigint; |
@@ -1,2 +0,2 @@ | ||
declare const getBigIntHrtime: (nativeHrtime: Function) => (time?: [number, number] | undefined) => any; | ||
declare const getBigIntHrtime: (nativeHrtime: Function) => (time?: [number, number] | undefined) => bigint; | ||
export default getBigIntHrtime; |
@@ -9,2 +9,3 @@ import { BigIntPolyfillType } from "./polyfills/bigint"; | ||
real: number; | ||
offset: bigint; | ||
filetype?: any; | ||
@@ -11,0 +12,0 @@ rights: Rights; |
{ | ||
"name": "@wasmer/wasi", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Isomorphic Javascript library for interacting with WASI Modules in Node.js and the Browser. 📚", | ||
@@ -54,3 +54,3 @@ "main": "dist/index.cjs.js", | ||
}, | ||
"gitHead": "665bb3490ecbc74f69c413e9b104a29a8e97ca3f" | ||
"gitHead": "b55bab0130bf7c35bcc7fe6d319202dbc02e5200" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
184422
997