@bytecodealliance/preview2-shim 0.18.1 → 0.20.0

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.
Files changed (82) hide show
  1. package/README.md +15 -15
  2. package/dist/browser/cli.d.ts +16 -0
  3. package/dist/browser/cli.js +109 -0
  4. package/dist/browser/clocks.d.ts +3 -0
  5. package/dist/browser/clocks.js +36 -0
  6. package/dist/browser/config.d.ts +2 -0
  7. package/{lib → dist}/browser/config.js +2 -4
  8. package/dist/browser/environment.d.ts +5 -0
  9. package/dist/browser/environment.js +24 -0
  10. package/dist/browser/filesystem.d.ts +132 -0
  11. package/dist/browser/filesystem.js +488 -0
  12. package/dist/browser/http.d.ts +4 -0
  13. package/dist/browser/http.js +643 -0
  14. package/dist/browser/index.d.ts +7 -0
  15. package/dist/browser/index.js +7 -0
  16. package/dist/browser/io.d.ts +58 -0
  17. package/dist/browser/io.js +205 -0
  18. package/dist/browser/random.d.ts +4 -0
  19. package/dist/browser/random.js +49 -0
  20. package/dist/browser/sockets.d.ts +8 -0
  21. package/dist/browser/sockets.js +66 -0
  22. package/dist/common/instantiation.d.ts +97 -0
  23. package/dist/common/instantiation.js +228 -0
  24. package/dist/io/calls.d.ts +91 -0
  25. package/{lib → dist}/io/calls.js +4 -19
  26. package/dist/io/worker-http.d.ts +17 -0
  27. package/dist/io/worker-http.js +192 -0
  28. package/dist/io/worker-io.d.ts +84 -0
  29. package/dist/io/worker-io.js +381 -0
  30. package/dist/io/worker-socket-tcp.d.ts +34 -0
  31. package/dist/io/worker-socket-tcp.js +251 -0
  32. package/dist/io/worker-socket-udp.d.ts +54 -0
  33. package/dist/io/worker-socket-udp.js +493 -0
  34. package/dist/io/worker-sockets.d.ts +32 -0
  35. package/dist/io/worker-sockets.js +265 -0
  36. package/dist/io/worker-thread.d.ts +73 -0
  37. package/dist/io/worker-thread.js +794 -0
  38. package/dist/nodejs/cli.d.ts +30 -0
  39. package/dist/nodejs/cli.js +86 -0
  40. package/dist/nodejs/clocks.d.ts +3 -0
  41. package/dist/nodejs/clocks.js +61 -0
  42. package/dist/nodejs/filesystem.d.ts +113 -0
  43. package/dist/nodejs/filesystem.js +761 -0
  44. package/dist/nodejs/http.d.ts +82 -0
  45. package/dist/nodejs/http.js +674 -0
  46. package/dist/nodejs/index.d.ts +7 -0
  47. package/dist/nodejs/index.js +7 -0
  48. package/dist/nodejs/io.d.ts +1 -0
  49. package/dist/nodejs/io.js +1 -0
  50. package/dist/nodejs/random.d.ts +4 -0
  51. package/dist/nodejs/random.js +42 -0
  52. package/dist/nodejs/sockets.d.ts +21 -0
  53. package/dist/nodejs/sockets.js +482 -0
  54. package/dist/synckit/index.d.ts +2 -0
  55. package/dist/synckit/index.js +117 -0
  56. package/package.json +28 -15
  57. package/types/instantiation.d.ts +7 -7
  58. package/lib/browser/cli.js +0 -135
  59. package/lib/browser/clocks.js +0 -39
  60. package/lib/browser/environment.js +0 -29
  61. package/lib/browser/filesystem.js +0 -503
  62. package/lib/browser/http.js +0 -707
  63. package/lib/browser/index.js +0 -9
  64. package/lib/browser/io.js +0 -262
  65. package/lib/browser/random.js +0 -56
  66. package/lib/browser/sockets.js +0 -88
  67. package/lib/common/instantiation.js +0 -253
  68. package/lib/io/worker-http.js +0 -206
  69. package/lib/io/worker-io.js +0 -468
  70. package/lib/io/worker-socket-tcp.js +0 -331
  71. package/lib/io/worker-socket-udp.js +0 -587
  72. package/lib/io/worker-sockets.js +0 -364
  73. package/lib/io/worker-thread.js +0 -1051
  74. package/lib/nodejs/cli.js +0 -109
  75. package/lib/nodejs/clocks.js +0 -67
  76. package/lib/nodejs/filesystem.js +0 -829
  77. package/lib/nodejs/http.js +0 -764
  78. package/lib/nodejs/index.js +0 -9
  79. package/lib/nodejs/io.js +0 -1
  80. package/lib/nodejs/random.js +0 -49
  81. package/lib/nodejs/sockets.js +0 -565
  82. package/lib/synckit/index.js +0 -127
@@ -0,0 +1,82 @@
1
+ import type { types as TypesNamespace } from "../../types/http.js";
2
+ import { OutputStream, Pollable } from "../../types/interfaces/wasi-io-streams.js";
3
+ declare const symbolDispose: symbol;
4
+ export declare const _forbiddenHeaders: Set<string>;
5
+ declare class OutgoingRequest implements TypesNamespace.OutgoingRequest {
6
+ #private;
7
+ [symbolDispose]: () => void;
8
+ constructor(headers: any);
9
+ body(): OutgoingBody;
10
+ method(): TypesNamespace.Method;
11
+ setMethod(method: any): void;
12
+ pathWithQuery(): string | undefined;
13
+ setPathWithQuery(pathWithQuery: any): void;
14
+ scheme(): TypesNamespace.Scheme | undefined;
15
+ setScheme(scheme: any): void;
16
+ authority(): string | undefined;
17
+ setAuthority(authority: any): void;
18
+ headers(): Fields;
19
+ static _handle(request: any, options: any): FutureIncomingResponse;
20
+ }
21
+ declare class OutgoingBody implements TypesNamespace.OutgoingBody {
22
+ #private;
23
+ [symbolDispose]: () => void;
24
+ write(): OutputStream;
25
+ static finish(body: OutgoingBody, trailers: Fields | undefined): void;
26
+ static _outputStreamId(outgoingBody: any): any;
27
+ static _create(contentLength: any): OutgoingBody;
28
+ }
29
+ declare class FutureIncomingResponse implements TypesNamespace.FutureIncomingResponse {
30
+ #private;
31
+ [symbolDispose]: () => void;
32
+ subscribe(): Pollable;
33
+ get(): any;
34
+ static _create(method: any, scheme: any, authority: any, pathWithQuery: any, headers: any, body: any, connectTimeout: any, betweenBytesTimeout: any, firstByteTimeout: any): FutureIncomingResponse;
35
+ }
36
+ declare class Fields {
37
+ #private;
38
+ /**
39
+ * @param {[string, Uint8Array[][]][]} entries
40
+ */
41
+ static fromList(entries: any): Fields;
42
+ get(name: any): TypesNamespace.FieldValue[];
43
+ /**
44
+ * WIT spec (https://github.com/WebAssembly/WASI/blob/91bb44c3c3a9b1e09187db23c85fa844d1fd6b15/proposals/http/wit/types.wit#L215-L223):
45
+ *
46
+ * > Set all of the values for a name. Clears any existing values for that
47
+ * > name, if they have been set.
48
+ * >
49
+ * > Fails with `header-error.immutable` if the `fields` are immutable.
50
+ * >
51
+ * > Fails with `header-error.invalid-syntax` if the `field-name` or any of
52
+ * > the `field-value`s are syntactically invalid.
53
+ *
54
+ * The existing-branch splice/reuse is an allocation optimization — values are cleared, not retained.
55
+ */
56
+ set(name: any, values: any): void;
57
+ has(name: any): boolean;
58
+ delete(name: any): void;
59
+ append(name: any, value: any): void;
60
+ entries(): [string, TypesNamespace.FieldValue][];
61
+ clone(): Fields;
62
+ static _lock(fields: any): any;
63
+ static _fromEntriesChecked(entries: any): Fields;
64
+ }
65
+ export declare const outgoingHandler: {
66
+ /**
67
+ * @param {OutgoingRequest} request
68
+ * @param {RequestOptions | undefined} options
69
+ * @returns {FutureIncomingResponse}
70
+ */
71
+ handle: typeof OutgoingRequest._handle;
72
+ };
73
+ export declare const types: typeof TypesNamespace;
74
+ export declare class HTTPServer {
75
+ #private;
76
+ constructor(incomingHandler: any);
77
+ listen(port: any, host: any): void;
78
+ address(): any;
79
+ stop(): void;
80
+ close(): void;
81
+ }
82
+ export {};