@bytecodealliance/preview2-shim 0.0.21 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -14
- package/lib/browser/cli.js +2 -4
- package/lib/browser/clocks.js +15 -27
- package/lib/browser/filesystem.js +2 -30
- package/lib/browser/http.js +1 -3
- package/lib/browser/io.js +4 -2
- package/lib/common/assert.js +7 -0
- package/lib/io/calls.js +64 -0
- package/lib/io/worker-http.js +95 -0
- package/lib/io/worker-io.js +322 -0
- package/lib/io/worker-thread.js +569 -0
- package/lib/nodejs/cli.js +45 -59
- package/lib/nodejs/clocks.js +13 -27
- package/lib/nodejs/filesystem.js +539 -459
- package/lib/nodejs/http.js +440 -173
- package/lib/nodejs/index.js +4 -1
- package/lib/nodejs/io.js +1 -0
- package/lib/nodejs/sockets/socket-common.js +116 -0
- package/lib/nodejs/sockets/socketopts-bindings.js +94 -0
- package/lib/nodejs/sockets/tcp-socket-impl.js +794 -0
- package/lib/nodejs/sockets/udp-socket-impl.js +628 -0
- package/lib/nodejs/sockets/wasi-sockets.js +320 -0
- package/lib/nodejs/sockets.js +11 -200
- package/lib/synckit/index.js +4 -2
- package/package.json +1 -5
- package/types/interfaces/wasi-cli-terminal-input.d.ts +4 -0
- package/types/interfaces/wasi-cli-terminal-output.d.ts +4 -0
- package/types/interfaces/wasi-clocks-monotonic-clock.d.ts +19 -6
- package/types/interfaces/wasi-filesystem-types.d.ts +1 -178
- package/types/interfaces/wasi-http-outgoing-handler.d.ts +2 -2
- package/types/interfaces/wasi-http-types.d.ts +412 -82
- package/types/interfaces/wasi-io-error.d.ts +16 -0
- package/types/interfaces/wasi-io-poll.d.ts +19 -8
- package/types/interfaces/wasi-io-streams.d.ts +26 -46
- package/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +9 -21
- package/types/interfaces/wasi-sockets-network.d.ts +4 -0
- package/types/interfaces/wasi-sockets-tcp.d.ts +75 -18
- package/types/interfaces/wasi-sockets-udp-create-socket.d.ts +1 -1
- package/types/interfaces/wasi-sockets-udp.d.ts +282 -193
- package/types/wasi-cli-command.d.ts +28 -28
- package/types/wasi-http-proxy.d.ts +12 -12
- package/lib/common/io.js +0 -183
- package/lib/common/make-request.js +0 -30
- package/types/interfaces/wasi-clocks-timezone.d.ts +0 -56
|
@@ -201,143 +201,12 @@ export namespace WasiFilesystemTypes {
|
|
|
201
201
|
*
|
|
202
202
|
* Note: This is similar to `symlinkat` in POSIX.
|
|
203
203
|
*/
|
|
204
|
-
/**
|
|
205
|
-
* Check accessibility of a filesystem path.
|
|
206
|
-
*
|
|
207
|
-
* Check whether the given filesystem path names an object which is
|
|
208
|
-
* readable, writable, or executable, or whether it exists.
|
|
209
|
-
*
|
|
210
|
-
* This does not a guarantee that subsequent accesses will succeed, as
|
|
211
|
-
* filesystem permissions may be modified asynchronously by external
|
|
212
|
-
* entities.
|
|
213
|
-
*
|
|
214
|
-
* Note: This is similar to `faccessat` with the `AT_EACCESS` flag in POSIX.
|
|
215
|
-
*/
|
|
216
204
|
/**
|
|
217
205
|
* Unlink a filesystem object that is not a directory.
|
|
218
206
|
*
|
|
219
207
|
* Return `error-code::is-directory` if the path refers to a directory.
|
|
220
208
|
* Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
|
|
221
209
|
*/
|
|
222
|
-
/**
|
|
223
|
-
* Change the permissions of a filesystem object that is not a directory.
|
|
224
|
-
*
|
|
225
|
-
* Note that the ultimate meanings of these permissions is
|
|
226
|
-
* filesystem-specific.
|
|
227
|
-
*
|
|
228
|
-
* Note: This is similar to `fchmodat` in POSIX.
|
|
229
|
-
*/
|
|
230
|
-
/**
|
|
231
|
-
* Change the permissions of a directory.
|
|
232
|
-
*
|
|
233
|
-
* Note that the ultimate meanings of these permissions is
|
|
234
|
-
* filesystem-specific.
|
|
235
|
-
*
|
|
236
|
-
* Unlike in POSIX, the `executable` flag is not reinterpreted as a "search"
|
|
237
|
-
* flag. `read` on a directory implies readability and searchability, and
|
|
238
|
-
* `execute` is not valid for directories.
|
|
239
|
-
*
|
|
240
|
-
* Note: This is similar to `fchmodat` in POSIX.
|
|
241
|
-
*/
|
|
242
|
-
/**
|
|
243
|
-
* Request a shared advisory lock for an open file.
|
|
244
|
-
*
|
|
245
|
-
* This requests a *shared* lock; more than one shared lock can be held for
|
|
246
|
-
* a file at the same time.
|
|
247
|
-
*
|
|
248
|
-
* If the open file has an exclusive lock, this function downgrades the lock
|
|
249
|
-
* to a shared lock. If it has a shared lock, this function has no effect.
|
|
250
|
-
*
|
|
251
|
-
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
252
|
-
* by other programs that don't hold the lock.
|
|
253
|
-
*
|
|
254
|
-
* It is unspecified how shared locks interact with locks acquired by
|
|
255
|
-
* non-WASI programs.
|
|
256
|
-
*
|
|
257
|
-
* This function blocks until the lock can be acquired.
|
|
258
|
-
*
|
|
259
|
-
* Not all filesystems support locking; on filesystems which don't support
|
|
260
|
-
* locking, this function returns `error-code::unsupported`.
|
|
261
|
-
*
|
|
262
|
-
* Note: This is similar to `flock(fd, LOCK_SH)` in Unix.
|
|
263
|
-
*/
|
|
264
|
-
/**
|
|
265
|
-
* Request an exclusive advisory lock for an open file.
|
|
266
|
-
*
|
|
267
|
-
* This requests an *exclusive* lock; no other locks may be held for the
|
|
268
|
-
* file while an exclusive lock is held.
|
|
269
|
-
*
|
|
270
|
-
* If the open file has a shared lock and there are no exclusive locks held
|
|
271
|
-
* for the file, this function upgrades the lock to an exclusive lock. If the
|
|
272
|
-
* open file already has an exclusive lock, this function has no effect.
|
|
273
|
-
*
|
|
274
|
-
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
275
|
-
* by other programs that don't hold the lock.
|
|
276
|
-
*
|
|
277
|
-
* It is unspecified whether this function succeeds if the file descriptor
|
|
278
|
-
* is not opened for writing. It is unspecified how exclusive locks interact
|
|
279
|
-
* with locks acquired by non-WASI programs.
|
|
280
|
-
*
|
|
281
|
-
* This function blocks until the lock can be acquired.
|
|
282
|
-
*
|
|
283
|
-
* Not all filesystems support locking; on filesystems which don't support
|
|
284
|
-
* locking, this function returns `error-code::unsupported`.
|
|
285
|
-
*
|
|
286
|
-
* Note: This is similar to `flock(fd, LOCK_EX)` in Unix.
|
|
287
|
-
*/
|
|
288
|
-
/**
|
|
289
|
-
* Request a shared advisory lock for an open file.
|
|
290
|
-
*
|
|
291
|
-
* This requests a *shared* lock; more than one shared lock can be held for
|
|
292
|
-
* a file at the same time.
|
|
293
|
-
*
|
|
294
|
-
* If the open file has an exclusive lock, this function downgrades the lock
|
|
295
|
-
* to a shared lock. If it has a shared lock, this function has no effect.
|
|
296
|
-
*
|
|
297
|
-
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
298
|
-
* by other programs that don't hold the lock.
|
|
299
|
-
*
|
|
300
|
-
* It is unspecified how shared locks interact with locks acquired by
|
|
301
|
-
* non-WASI programs.
|
|
302
|
-
*
|
|
303
|
-
* This function returns `error-code::would-block` if the lock cannot be
|
|
304
|
-
* acquired.
|
|
305
|
-
*
|
|
306
|
-
* Not all filesystems support locking; on filesystems which don't support
|
|
307
|
-
* locking, this function returns `error-code::unsupported`.
|
|
308
|
-
*
|
|
309
|
-
* Note: This is similar to `flock(fd, LOCK_SH | LOCK_NB)` in Unix.
|
|
310
|
-
*/
|
|
311
|
-
/**
|
|
312
|
-
* Request an exclusive advisory lock for an open file.
|
|
313
|
-
*
|
|
314
|
-
* This requests an *exclusive* lock; no other locks may be held for the
|
|
315
|
-
* file while an exclusive lock is held.
|
|
316
|
-
*
|
|
317
|
-
* If the open file has a shared lock and there are no exclusive locks held
|
|
318
|
-
* for the file, this function upgrades the lock to an exclusive lock. If the
|
|
319
|
-
* open file already has an exclusive lock, this function has no effect.
|
|
320
|
-
*
|
|
321
|
-
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
322
|
-
* by other programs that don't hold the lock.
|
|
323
|
-
*
|
|
324
|
-
* It is unspecified whether this function succeeds if the file descriptor
|
|
325
|
-
* is not opened for writing. It is unspecified how exclusive locks interact
|
|
326
|
-
* with locks acquired by non-WASI programs.
|
|
327
|
-
*
|
|
328
|
-
* This function returns `error-code::would-block` if the lock cannot be
|
|
329
|
-
* acquired.
|
|
330
|
-
*
|
|
331
|
-
* Not all filesystems support locking; on filesystems which don't support
|
|
332
|
-
* locking, this function returns `error-code::unsupported`.
|
|
333
|
-
*
|
|
334
|
-
* Note: This is similar to `flock(fd, LOCK_EX | LOCK_NB)` in Unix.
|
|
335
|
-
*/
|
|
336
|
-
/**
|
|
337
|
-
* Release a shared or exclusive lock on an open file.
|
|
338
|
-
*
|
|
339
|
-
* Note: This is similar to `flock(fd, LOCK_UN)` in Unix.
|
|
340
|
-
*/
|
|
341
210
|
/**
|
|
342
211
|
* Test whether two descriptors refer to the same filesystem object.
|
|
343
212
|
*
|
|
@@ -523,44 +392,6 @@ export interface OpenFlags {
|
|
|
523
392
|
*/
|
|
524
393
|
truncate?: boolean,
|
|
525
394
|
}
|
|
526
|
-
/**
|
|
527
|
-
* Permissions mode used by `open-at`, `change-file-permissions-at`, and
|
|
528
|
-
* similar.
|
|
529
|
-
*/
|
|
530
|
-
export interface Modes {
|
|
531
|
-
/**
|
|
532
|
-
* True if the resource is considered readable by the containing
|
|
533
|
-
* filesystem.
|
|
534
|
-
*/
|
|
535
|
-
readable?: boolean,
|
|
536
|
-
/**
|
|
537
|
-
* True if the resource is considered writable by the containing
|
|
538
|
-
* filesystem.
|
|
539
|
-
*/
|
|
540
|
-
writable?: boolean,
|
|
541
|
-
/**
|
|
542
|
-
* True if the resource is considered executable by the containing
|
|
543
|
-
* filesystem. This does not apply to directories.
|
|
544
|
-
*/
|
|
545
|
-
executable?: boolean,
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Access type used by `access-at`.
|
|
549
|
-
*/
|
|
550
|
-
export type AccessType = AccessTypeAccess | AccessTypeExists;
|
|
551
|
-
/**
|
|
552
|
-
* Test for readability, writeability, or executability.
|
|
553
|
-
*/
|
|
554
|
-
export interface AccessTypeAccess {
|
|
555
|
-
tag: 'access',
|
|
556
|
-
val: Modes,
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* Test whether the path exists.
|
|
560
|
-
*/
|
|
561
|
-
export interface AccessTypeExists {
|
|
562
|
-
tag: 'exists',
|
|
563
|
-
}
|
|
564
395
|
/**
|
|
565
396
|
* Number of hard links to an inode.
|
|
566
397
|
*/
|
|
@@ -827,20 +658,12 @@ export class Descriptor {
|
|
|
827
658
|
statAt(pathFlags: PathFlags, path: string): DescriptorStat;
|
|
828
659
|
setTimesAt(pathFlags: PathFlags, path: string, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
|
|
829
660
|
linkAt(oldPathFlags: PathFlags, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
830
|
-
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags
|
|
661
|
+
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor;
|
|
831
662
|
readlinkAt(path: string): string;
|
|
832
663
|
removeDirectoryAt(path: string): void;
|
|
833
664
|
renameAt(oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
834
665
|
symlinkAt(oldPath: string, newPath: string): void;
|
|
835
|
-
accessAt(pathFlags: PathFlags, path: string, type: AccessType): void;
|
|
836
666
|
unlinkFileAt(path: string): void;
|
|
837
|
-
changeFilePermissionsAt(pathFlags: PathFlags, path: string, modes: Modes): void;
|
|
838
|
-
changeDirectoryPermissionsAt(pathFlags: PathFlags, path: string, modes: Modes): void;
|
|
839
|
-
lockShared(): void;
|
|
840
|
-
lockExclusive(): void;
|
|
841
|
-
tryLockShared(): void;
|
|
842
|
-
tryLockExclusive(): void;
|
|
843
|
-
unlock(): void;
|
|
844
667
|
isSameObject(other: Descriptor): boolean;
|
|
845
668
|
metadataHash(): MetadataHashValue;
|
|
846
669
|
metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
|
|
@@ -19,5 +19,5 @@ import type { RequestOptions } from '../interfaces/wasi-http-types.js';
|
|
|
19
19
|
export { RequestOptions };
|
|
20
20
|
import type { FutureIncomingResponse } from '../interfaces/wasi-http-types.js';
|
|
21
21
|
export { FutureIncomingResponse };
|
|
22
|
-
import type {
|
|
23
|
-
export {
|
|
22
|
+
import type { ErrorCode } from '../interfaces/wasi-http-types.js';
|
|
23
|
+
export { ErrorCode };
|