@bytecodealliance/preview2-shim
Advanced tools
@@ -1,2 +0,1 @@ | ||
| // eslint-disable-next-line no-unused-vars | ||
| let _cwd = '/'; | ||
@@ -3,0 +2,0 @@ |
@@ -328,4 +328,101 @@ import { streams } from './io.js'; | ||
| DirectoryEntryStream, | ||
| filesystemErrorCode(err) { | ||
| return convertFsError(err.payload); | ||
| }, | ||
| }; | ||
| function convertFsError(e) { | ||
| switch (e.code) { | ||
| case 'EACCES': | ||
| return 'access'; | ||
| case 'EAGAIN': | ||
| case 'EWOULDBLOCK': | ||
| return 'would-block'; | ||
| case 'EALREADY': | ||
| return 'already'; | ||
| case 'EBADF': | ||
| return 'bad-descriptor'; | ||
| case 'EBUSY': | ||
| return 'busy'; | ||
| case 'EDEADLK': | ||
| return 'deadlock'; | ||
| case 'EDQUOT': | ||
| return 'quota'; | ||
| case 'EEXIST': | ||
| return 'exist'; | ||
| case 'EFBIG': | ||
| return 'file-too-large'; | ||
| case 'EILSEQ': | ||
| return 'illegal-byte-sequence'; | ||
| case 'EINPROGRESS': | ||
| return 'in-progress'; | ||
| case 'EINTR': | ||
| return 'interrupted'; | ||
| case 'EINVAL': | ||
| return 'invalid'; | ||
| case 'EIO': | ||
| return 'io'; | ||
| case 'EISDIR': | ||
| return 'is-directory'; | ||
| case 'ELOOP': | ||
| return 'loop'; | ||
| case 'EMLINK': | ||
| return 'too-many-links'; | ||
| case 'EMSGSIZE': | ||
| return 'message-size'; | ||
| case 'ENAMETOOLONG': | ||
| return 'name-too-long'; | ||
| case 'ENODEV': | ||
| return 'no-device'; | ||
| case 'ENOENT': | ||
| return 'no-entry'; | ||
| case 'ENOLCK': | ||
| return 'no-lock'; | ||
| case 'ENOMEM': | ||
| return 'insufficient-memory'; | ||
| case 'ENOSPC': | ||
| return 'insufficient-space'; | ||
| case 'ENOTDIR': | ||
| case 'ERR_FS_EISDIR': | ||
| return 'not-directory'; | ||
| case 'ENOTEMPTY': | ||
| return 'not-empty'; | ||
| case 'ENOTRECOVERABLE': | ||
| return 'not-recoverable'; | ||
| case 'ENOTSUP': | ||
| return 'unsupported'; | ||
| case 'ENOTTY': | ||
| return 'no-tty'; | ||
| // windows gives this error for badly structured `//` reads | ||
| // this seems like a slightly better error than unknown given | ||
| // that it's a common footgun | ||
| case -4094: | ||
| case 'ENXIO': | ||
| return 'no-such-device'; | ||
| case 'EOVERFLOW': | ||
| return 'overflow'; | ||
| case 'EPERM': | ||
| return 'not-permitted'; | ||
| case 'EPIPE': | ||
| return 'pipe'; | ||
| case 'EROFS': | ||
| return 'read-only'; | ||
| case 'ESPIPE': | ||
| return 'invalid-seek'; | ||
| case 'ETXTBSY': | ||
| return 'text-file-busy'; | ||
| case 'EXDEV': | ||
| return 'cross-device'; | ||
| case 'UNKNOWN': | ||
| switch (e.errno) { | ||
| case -4094: | ||
| return 'no-such-device'; | ||
| default: | ||
| throw e; | ||
| } | ||
| default: | ||
| throw e; | ||
| } | ||
| } | ||
| export { types as filesystemTypes }; |
+10
-0
@@ -145,2 +145,12 @@ /** | ||
| }, | ||
| Fields: class Fields {}, | ||
| FutureIncomingResponse: new class FutureIncomingResponse {}, | ||
| IncomingBody: new class IncomingBody {}, | ||
| IncomingRequest: new class IncomingRequest {}, | ||
| IncomingResponse: new class IncomingResponse {}, | ||
| OutgoingBody: new class OutgoingBody {}, | ||
| OutgoingRequest: new class OutgoingRequest {}, | ||
| OutgoingResponse: new class OutgoingResponse {}, | ||
| RequestOptions: new class RequestOptions {}, | ||
| ResponseOutparam: new class ResponseOutparam {}, | ||
| }; |
@@ -20,3 +20,3 @@ let id = 0; | ||
| * blockingSkip?: (len: BigInt) => BigInt, | ||
| * subscribe: () => void, | ||
| * subscribe: () => Pollable, | ||
| * drop?: () => void, | ||
@@ -37,3 +37,3 @@ * }} InputStreamHandler | ||
| * forward?: (src: InputStream) => void, | ||
| * subscribe?: () => void, | ||
| * subscribe?: () => Pollable, | ||
| * drop?: () => void, | ||
@@ -83,2 +83,3 @@ * }} OutputStreamHandler | ||
| console.log(`[streams] Subscribe to input stream ${this.id}`); | ||
| return new Pollable(); | ||
| } | ||
@@ -174,2 +175,3 @@ [symbolDispose]() { | ||
| console.log(`[streams] Subscribe to output stream ${this.id}`); | ||
| return new Pollable(); | ||
| } | ||
@@ -197,2 +199,3 @@ [symbolDispose]() {} | ||
| pollOne, | ||
| poll: pollOne, | ||
| }; |
+1
-1
| { | ||
| "name": "@bytecodealliance/preview2-shim", | ||
| "version": "0.17.5", | ||
| "version": "0.17.6", | ||
| "description": "WASI Preview2 shim for JS environments", | ||
@@ -5,0 +5,0 @@ "author": "Guy Bedford, Eduardo Rodrigues<16357187+eduardomourar@users.noreply.github.com>", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
350140
0.84%9925
1.1%