@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.d801d8d

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 (113) hide show
  1. package/README.md +3 -0
  2. package/node_modules/@emnapi/core/LICENSE +21 -0
  3. package/node_modules/@emnapi/core/README.md +1 -0
  4. package/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +6661 -0
  5. package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +363 -0
  6. package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -0
  7. package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +363 -0
  8. package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +365 -0
  9. package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +7411 -0
  10. package/node_modules/@emnapi/core/dist/emnapi-core.js +8390 -0
  11. package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +363 -0
  12. package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -0
  13. package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -0
  14. package/node_modules/@emnapi/core/dist/emnapi-core.mjs +6650 -0
  15. package/node_modules/@emnapi/core/index.js +5 -0
  16. package/node_modules/@emnapi/core/package.json +49 -0
  17. package/node_modules/@emnapi/runtime/LICENSE +21 -0
  18. package/node_modules/@emnapi/runtime/README.md +1 -0
  19. package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1347 -0
  20. package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +663 -0
  21. package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -0
  22. package/node_modules/@emnapi/runtime/dist/emnapi.d.mts +663 -0
  23. package/node_modules/@emnapi/runtime/dist/emnapi.d.ts +665 -0
  24. package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1403 -0
  25. package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +420 -0
  26. package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1474 -0
  27. package/node_modules/@emnapi/runtime/dist/emnapi.js +1475 -0
  28. package/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +663 -0
  29. package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -0
  30. package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -0
  31. package/node_modules/@emnapi/runtime/dist/emnapi.mjs +1316 -0
  32. package/node_modules/@emnapi/runtime/index.js +5 -0
  33. package/node_modules/@emnapi/runtime/package.json +48 -0
  34. package/node_modules/@emnapi/wasi-threads/LICENSE +21 -0
  35. package/node_modules/@emnapi/wasi-threads/README.md +203 -0
  36. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +881 -0
  37. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +214 -0
  38. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +1 -0
  39. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +214 -0
  40. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +216 -0
  41. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +929 -0
  42. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +941 -0
  43. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +214 -0
  44. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +1 -0
  45. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +1 -0
  46. package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +876 -0
  47. package/node_modules/@emnapi/wasi-threads/index.js +5 -0
  48. package/node_modules/@emnapi/wasi-threads/package.json +50 -0
  49. package/node_modules/@napi-rs/wasm-runtime/LICENSE +43 -0
  50. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +23712 -0
  51. package/node_modules/@napi-rs/wasm-runtime/dist/runtime.js +12269 -0
  52. package/node_modules/@napi-rs/wasm-runtime/fs-proxy.cjs +193 -0
  53. package/node_modules/@napi-rs/wasm-runtime/package.json +60 -0
  54. package/node_modules/@napi-rs/wasm-runtime/runtime.cjs +15 -0
  55. package/node_modules/@tybys/wasm-util/README.md +193 -0
  56. package/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +11 -0
  57. package/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +417 -0
  58. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +2738 -0
  59. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +2738 -0
  60. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -0
  61. package/node_modules/@tybys/wasm-util/dist/wasm-util.js +2760 -0
  62. package/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -0
  63. package/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +158 -0
  64. package/node_modules/@tybys/wasm-util/lib/cjs/index.js +13 -0
  65. package/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +46 -0
  66. package/node_modules/@tybys/wasm-util/lib/cjs/load.js +97 -0
  67. package/node_modules/@tybys/wasm-util/lib/cjs/memory.js +35 -0
  68. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +103 -0
  69. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +268 -0
  70. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +3 -0
  71. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +194 -0
  72. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +174 -0
  73. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +1544 -0
  74. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +141 -0
  75. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +220 -0
  76. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +128 -0
  77. package/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +13 -0
  78. package/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +153 -0
  79. package/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +9 -0
  80. package/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +39 -0
  81. package/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +89 -0
  82. package/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +28 -0
  83. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +97 -0
  84. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +256 -0
  85. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +1 -0
  86. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +188 -0
  87. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +168 -0
  88. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +1539 -0
  89. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +135 -0
  90. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +216 -0
  91. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +113 -0
  92. package/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +9 -0
  93. package/node_modules/@tybys/wasm-util/package.json +58 -0
  94. package/node_modules/tslib/CopyrightNotice.txt +15 -0
  95. package/node_modules/tslib/LICENSE.txt +12 -0
  96. package/node_modules/tslib/README.md +164 -0
  97. package/node_modules/tslib/SECURITY.md +41 -0
  98. package/node_modules/tslib/modules/index.d.ts +38 -0
  99. package/node_modules/tslib/modules/index.js +70 -0
  100. package/node_modules/tslib/modules/package.json +3 -0
  101. package/node_modules/tslib/package.json +47 -0
  102. package/node_modules/tslib/tslib.d.ts +460 -0
  103. package/node_modules/tslib/tslib.es6.html +1 -0
  104. package/node_modules/tslib/tslib.es6.js +393 -0
  105. package/node_modules/tslib/tslib.es6.mjs +392 -0
  106. package/node_modules/tslib/tslib.html +1 -0
  107. package/node_modules/tslib/tslib.js +475 -0
  108. package/package.json +45 -0
  109. package/tailwindcss-oxide.wasi-browser.js +63 -0
  110. package/tailwindcss-oxide.wasi.cjs +88 -0
  111. package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
  112. package/wasi-worker-browser.mjs +39 -0
  113. package/wasi-worker.mjs +63 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRights = exports.TTY_INHERITING = exports.TTY_BASE = exports.SOCKET_INHERITING = exports.SOCKET_BASE = exports.DIRECTORY_INHERITING = exports.DIRECTORY_BASE = exports.REGULAR_FILE_INHERITING = exports.REGULAR_FILE_BASE = exports.CHARACTER_DEVICE_INHERITING = exports.CHARACTER_DEVICE_BASE = exports.BLOCK_DEVICE_INHERITING = exports.BLOCK_DEVICE_BASE = exports.RIGHTS_ALL = void 0;
4
+ /* eslint-disable spaced-comment */
5
+ const error_1 = require("./error");
6
+ const types_1 = require("./types");
7
+ exports.RIGHTS_ALL = types_1.WasiRights.FD_DATASYNC |
8
+ types_1.WasiRights.FD_READ |
9
+ types_1.WasiRights.FD_SEEK |
10
+ types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
11
+ types_1.WasiRights.FD_SYNC |
12
+ types_1.WasiRights.FD_TELL |
13
+ types_1.WasiRights.FD_WRITE |
14
+ types_1.WasiRights.FD_ADVISE |
15
+ types_1.WasiRights.FD_ALLOCATE |
16
+ types_1.WasiRights.PATH_CREATE_DIRECTORY |
17
+ types_1.WasiRights.PATH_CREATE_FILE |
18
+ types_1.WasiRights.PATH_LINK_SOURCE |
19
+ types_1.WasiRights.PATH_LINK_TARGET |
20
+ types_1.WasiRights.PATH_OPEN |
21
+ types_1.WasiRights.FD_READDIR |
22
+ types_1.WasiRights.PATH_READLINK |
23
+ types_1.WasiRights.PATH_RENAME_SOURCE |
24
+ types_1.WasiRights.PATH_RENAME_TARGET |
25
+ types_1.WasiRights.PATH_FILESTAT_GET |
26
+ types_1.WasiRights.PATH_FILESTAT_SET_SIZE |
27
+ types_1.WasiRights.PATH_FILESTAT_SET_TIMES |
28
+ types_1.WasiRights.FD_FILESTAT_GET |
29
+ types_1.WasiRights.FD_FILESTAT_SET_TIMES |
30
+ types_1.WasiRights.FD_FILESTAT_SET_SIZE |
31
+ types_1.WasiRights.PATH_SYMLINK |
32
+ types_1.WasiRights.PATH_UNLINK_FILE |
33
+ types_1.WasiRights.PATH_REMOVE_DIRECTORY |
34
+ types_1.WasiRights.POLL_FD_READWRITE |
35
+ types_1.WasiRights.SOCK_SHUTDOWN |
36
+ types_1.WasiRights.SOCK_ACCEPT;
37
+ exports.BLOCK_DEVICE_BASE = exports.RIGHTS_ALL;
38
+ exports.BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL;
39
+ exports.CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL;
40
+ exports.CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL;
41
+ exports.REGULAR_FILE_BASE = types_1.WasiRights.FD_DATASYNC |
42
+ types_1.WasiRights.FD_READ |
43
+ types_1.WasiRights.FD_SEEK |
44
+ types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
45
+ types_1.WasiRights.FD_SYNC |
46
+ types_1.WasiRights.FD_TELL |
47
+ types_1.WasiRights.FD_WRITE |
48
+ types_1.WasiRights.FD_ADVISE |
49
+ types_1.WasiRights.FD_ALLOCATE |
50
+ types_1.WasiRights.FD_FILESTAT_GET |
51
+ types_1.WasiRights.FD_FILESTAT_SET_SIZE |
52
+ types_1.WasiRights.FD_FILESTAT_SET_TIMES |
53
+ types_1.WasiRights.POLL_FD_READWRITE;
54
+ exports.REGULAR_FILE_INHERITING = BigInt(0);
55
+ exports.DIRECTORY_BASE = types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
56
+ types_1.WasiRights.FD_SYNC |
57
+ types_1.WasiRights.FD_ADVISE |
58
+ types_1.WasiRights.PATH_CREATE_DIRECTORY |
59
+ types_1.WasiRights.PATH_CREATE_FILE |
60
+ types_1.WasiRights.PATH_LINK_SOURCE |
61
+ types_1.WasiRights.PATH_LINK_TARGET |
62
+ types_1.WasiRights.PATH_OPEN |
63
+ types_1.WasiRights.FD_READDIR |
64
+ types_1.WasiRights.PATH_READLINK |
65
+ types_1.WasiRights.PATH_RENAME_SOURCE |
66
+ types_1.WasiRights.PATH_RENAME_TARGET |
67
+ types_1.WasiRights.PATH_FILESTAT_GET |
68
+ types_1.WasiRights.PATH_FILESTAT_SET_SIZE |
69
+ types_1.WasiRights.PATH_FILESTAT_SET_TIMES |
70
+ types_1.WasiRights.FD_FILESTAT_GET |
71
+ types_1.WasiRights.FD_FILESTAT_SET_TIMES |
72
+ types_1.WasiRights.PATH_SYMLINK |
73
+ types_1.WasiRights.PATH_UNLINK_FILE |
74
+ types_1.WasiRights.PATH_REMOVE_DIRECTORY |
75
+ types_1.WasiRights.POLL_FD_READWRITE;
76
+ exports.DIRECTORY_INHERITING = exports.DIRECTORY_BASE | exports.REGULAR_FILE_BASE;
77
+ exports.SOCKET_BASE = (types_1.WasiRights.FD_READ |
78
+ types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
79
+ types_1.WasiRights.FD_WRITE |
80
+ types_1.WasiRights.FD_FILESTAT_GET |
81
+ types_1.WasiRights.POLL_FD_READWRITE |
82
+ types_1.WasiRights.SOCK_SHUTDOWN);
83
+ exports.SOCKET_INHERITING = exports.RIGHTS_ALL;
84
+ exports.TTY_BASE = types_1.WasiRights.FD_READ |
85
+ types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
86
+ types_1.WasiRights.FD_WRITE |
87
+ types_1.WasiRights.FD_FILESTAT_GET |
88
+ types_1.WasiRights.POLL_FD_READWRITE;
89
+ exports.TTY_INHERITING = BigInt(0);
90
+ function getRights(stdio, fd, flags, type) {
91
+ const ret = {
92
+ base: BigInt(0),
93
+ inheriting: BigInt(0)
94
+ };
95
+ if (type === types_1.WasiFileType.UNKNOWN) {
96
+ throw new error_1.WasiError('Unknown file type', types_1.WasiErrno.EINVAL);
97
+ }
98
+ switch (type) {
99
+ case types_1.WasiFileType.REGULAR_FILE:
100
+ ret.base = exports.REGULAR_FILE_BASE;
101
+ ret.inheriting = exports.REGULAR_FILE_INHERITING;
102
+ break;
103
+ case types_1.WasiFileType.DIRECTORY:
104
+ ret.base = exports.DIRECTORY_BASE;
105
+ ret.inheriting = exports.DIRECTORY_INHERITING;
106
+ break;
107
+ case types_1.WasiFileType.SOCKET_STREAM:
108
+ case types_1.WasiFileType.SOCKET_DGRAM:
109
+ ret.base = exports.SOCKET_BASE;
110
+ ret.inheriting = exports.SOCKET_INHERITING;
111
+ break;
112
+ case types_1.WasiFileType.CHARACTER_DEVICE:
113
+ if (stdio.indexOf(fd) !== -1) {
114
+ ret.base = exports.TTY_BASE;
115
+ ret.inheriting = exports.TTY_INHERITING;
116
+ }
117
+ else {
118
+ ret.base = exports.CHARACTER_DEVICE_BASE;
119
+ ret.inheriting = exports.CHARACTER_DEVICE_INHERITING;
120
+ }
121
+ break;
122
+ case types_1.WasiFileType.BLOCK_DEVICE:
123
+ ret.base = exports.BLOCK_DEVICE_BASE;
124
+ ret.inheriting = exports.BLOCK_DEVICE_INHERITING;
125
+ break;
126
+ default:
127
+ ret.base = BigInt(0);
128
+ ret.inheriting = BigInt(0);
129
+ }
130
+ /* Disable read/write bits depending on access mode. */
131
+ const read_or_write_only = flags & (0 | 1 | 2);
132
+ if (read_or_write_only === 0) {
133
+ ret.base &= ~types_1.WasiRights.FD_WRITE;
134
+ }
135
+ else if (read_or_write_only === 1) {
136
+ ret.base &= ~types_1.WasiRights.FD_READ;
137
+ }
138
+ return ret;
139
+ }
140
+ exports.getRights = getRights;
141
+ //# sourceMappingURL=rights.js.map
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WasiSubclockflags = exports.WasiEventType = exports.WasiFstFlag = exports.WasiClockid = exports.WasiFdFlag = exports.WasiFileControlFlag = exports.FileControlFlag = exports.WasiWhence = exports.WasiRights = exports.WasiFileType = exports.WasiErrno = void 0;
4
+ /* eslint-disable spaced-comment */
5
+ var WasiErrno;
6
+ (function (WasiErrno) {
7
+ WasiErrno[WasiErrno["ESUCCESS"] = 0] = "ESUCCESS";
8
+ WasiErrno[WasiErrno["E2BIG"] = 1] = "E2BIG";
9
+ WasiErrno[WasiErrno["EACCES"] = 2] = "EACCES";
10
+ WasiErrno[WasiErrno["EADDRINUSE"] = 3] = "EADDRINUSE";
11
+ WasiErrno[WasiErrno["EADDRNOTAVAIL"] = 4] = "EADDRNOTAVAIL";
12
+ WasiErrno[WasiErrno["EAFNOSUPPORT"] = 5] = "EAFNOSUPPORT";
13
+ WasiErrno[WasiErrno["EAGAIN"] = 6] = "EAGAIN";
14
+ WasiErrno[WasiErrno["EALREADY"] = 7] = "EALREADY";
15
+ WasiErrno[WasiErrno["EBADF"] = 8] = "EBADF";
16
+ WasiErrno[WasiErrno["EBADMSG"] = 9] = "EBADMSG";
17
+ WasiErrno[WasiErrno["EBUSY"] = 10] = "EBUSY";
18
+ WasiErrno[WasiErrno["ECANCELED"] = 11] = "ECANCELED";
19
+ WasiErrno[WasiErrno["ECHILD"] = 12] = "ECHILD";
20
+ WasiErrno[WasiErrno["ECONNABORTED"] = 13] = "ECONNABORTED";
21
+ WasiErrno[WasiErrno["ECONNREFUSED"] = 14] = "ECONNREFUSED";
22
+ WasiErrno[WasiErrno["ECONNRESET"] = 15] = "ECONNRESET";
23
+ WasiErrno[WasiErrno["EDEADLK"] = 16] = "EDEADLK";
24
+ WasiErrno[WasiErrno["EDESTADDRREQ"] = 17] = "EDESTADDRREQ";
25
+ WasiErrno[WasiErrno["EDOM"] = 18] = "EDOM";
26
+ WasiErrno[WasiErrno["EDQUOT"] = 19] = "EDQUOT";
27
+ WasiErrno[WasiErrno["EEXIST"] = 20] = "EEXIST";
28
+ WasiErrno[WasiErrno["EFAULT"] = 21] = "EFAULT";
29
+ WasiErrno[WasiErrno["EFBIG"] = 22] = "EFBIG";
30
+ WasiErrno[WasiErrno["EHOSTUNREACH"] = 23] = "EHOSTUNREACH";
31
+ WasiErrno[WasiErrno["EIDRM"] = 24] = "EIDRM";
32
+ WasiErrno[WasiErrno["EILSEQ"] = 25] = "EILSEQ";
33
+ WasiErrno[WasiErrno["EINPROGRESS"] = 26] = "EINPROGRESS";
34
+ WasiErrno[WasiErrno["EINTR"] = 27] = "EINTR";
35
+ WasiErrno[WasiErrno["EINVAL"] = 28] = "EINVAL";
36
+ WasiErrno[WasiErrno["EIO"] = 29] = "EIO";
37
+ WasiErrno[WasiErrno["EISCONN"] = 30] = "EISCONN";
38
+ WasiErrno[WasiErrno["EISDIR"] = 31] = "EISDIR";
39
+ WasiErrno[WasiErrno["ELOOP"] = 32] = "ELOOP";
40
+ WasiErrno[WasiErrno["EMFILE"] = 33] = "EMFILE";
41
+ WasiErrno[WasiErrno["EMLINK"] = 34] = "EMLINK";
42
+ WasiErrno[WasiErrno["EMSGSIZE"] = 35] = "EMSGSIZE";
43
+ WasiErrno[WasiErrno["EMULTIHOP"] = 36] = "EMULTIHOP";
44
+ WasiErrno[WasiErrno["ENAMETOOLONG"] = 37] = "ENAMETOOLONG";
45
+ WasiErrno[WasiErrno["ENETDOWN"] = 38] = "ENETDOWN";
46
+ WasiErrno[WasiErrno["ENETRESET"] = 39] = "ENETRESET";
47
+ WasiErrno[WasiErrno["ENETUNREACH"] = 40] = "ENETUNREACH";
48
+ WasiErrno[WasiErrno["ENFILE"] = 41] = "ENFILE";
49
+ WasiErrno[WasiErrno["ENOBUFS"] = 42] = "ENOBUFS";
50
+ WasiErrno[WasiErrno["ENODEV"] = 43] = "ENODEV";
51
+ WasiErrno[WasiErrno["ENOENT"] = 44] = "ENOENT";
52
+ WasiErrno[WasiErrno["ENOEXEC"] = 45] = "ENOEXEC";
53
+ WasiErrno[WasiErrno["ENOLCK"] = 46] = "ENOLCK";
54
+ WasiErrno[WasiErrno["ENOLINK"] = 47] = "ENOLINK";
55
+ WasiErrno[WasiErrno["ENOMEM"] = 48] = "ENOMEM";
56
+ WasiErrno[WasiErrno["ENOMSG"] = 49] = "ENOMSG";
57
+ WasiErrno[WasiErrno["ENOPROTOOPT"] = 50] = "ENOPROTOOPT";
58
+ WasiErrno[WasiErrno["ENOSPC"] = 51] = "ENOSPC";
59
+ WasiErrno[WasiErrno["ENOSYS"] = 52] = "ENOSYS";
60
+ WasiErrno[WasiErrno["ENOTCONN"] = 53] = "ENOTCONN";
61
+ WasiErrno[WasiErrno["ENOTDIR"] = 54] = "ENOTDIR";
62
+ WasiErrno[WasiErrno["ENOTEMPTY"] = 55] = "ENOTEMPTY";
63
+ WasiErrno[WasiErrno["ENOTRECOVERABLE"] = 56] = "ENOTRECOVERABLE";
64
+ WasiErrno[WasiErrno["ENOTSOCK"] = 57] = "ENOTSOCK";
65
+ WasiErrno[WasiErrno["ENOTSUP"] = 58] = "ENOTSUP";
66
+ WasiErrno[WasiErrno["ENOTTY"] = 59] = "ENOTTY";
67
+ WasiErrno[WasiErrno["ENXIO"] = 60] = "ENXIO";
68
+ WasiErrno[WasiErrno["EOVERFLOW"] = 61] = "EOVERFLOW";
69
+ WasiErrno[WasiErrno["EOWNERDEAD"] = 62] = "EOWNERDEAD";
70
+ WasiErrno[WasiErrno["EPERM"] = 63] = "EPERM";
71
+ WasiErrno[WasiErrno["EPIPE"] = 64] = "EPIPE";
72
+ WasiErrno[WasiErrno["EPROTO"] = 65] = "EPROTO";
73
+ WasiErrno[WasiErrno["EPROTONOSUPPORT"] = 66] = "EPROTONOSUPPORT";
74
+ WasiErrno[WasiErrno["EPROTOTYPE"] = 67] = "EPROTOTYPE";
75
+ WasiErrno[WasiErrno["ERANGE"] = 68] = "ERANGE";
76
+ WasiErrno[WasiErrno["EROFS"] = 69] = "EROFS";
77
+ WasiErrno[WasiErrno["ESPIPE"] = 70] = "ESPIPE";
78
+ WasiErrno[WasiErrno["ESRCH"] = 71] = "ESRCH";
79
+ WasiErrno[WasiErrno["ESTALE"] = 72] = "ESTALE";
80
+ WasiErrno[WasiErrno["ETIMEDOUT"] = 73] = "ETIMEDOUT";
81
+ WasiErrno[WasiErrno["ETXTBSY"] = 74] = "ETXTBSY";
82
+ WasiErrno[WasiErrno["EXDEV"] = 75] = "EXDEV";
83
+ WasiErrno[WasiErrno["ENOTCAPABLE"] = 76] = "ENOTCAPABLE";
84
+ })(WasiErrno = exports.WasiErrno || (exports.WasiErrno = {}));
85
+ var WasiFileType;
86
+ (function (WasiFileType) {
87
+ WasiFileType[WasiFileType["UNKNOWN"] = 0] = "UNKNOWN";
88
+ WasiFileType[WasiFileType["BLOCK_DEVICE"] = 1] = "BLOCK_DEVICE";
89
+ WasiFileType[WasiFileType["CHARACTER_DEVICE"] = 2] = "CHARACTER_DEVICE";
90
+ WasiFileType[WasiFileType["DIRECTORY"] = 3] = "DIRECTORY";
91
+ WasiFileType[WasiFileType["REGULAR_FILE"] = 4] = "REGULAR_FILE";
92
+ WasiFileType[WasiFileType["SOCKET_DGRAM"] = 5] = "SOCKET_DGRAM";
93
+ WasiFileType[WasiFileType["SOCKET_STREAM"] = 6] = "SOCKET_STREAM";
94
+ WasiFileType[WasiFileType["SYMBOLIC_LINK"] = 7] = "SYMBOLIC_LINK";
95
+ })(WasiFileType = exports.WasiFileType || (exports.WasiFileType = {}));
96
+ const FD_DATASYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(0));
97
+ const FD_READ = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(1));
98
+ const FD_SEEK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(2));
99
+ const FD_FDSTAT_SET_FLAGS = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(3));
100
+ const FD_SYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(4));
101
+ const FD_TELL = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(5));
102
+ const FD_WRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(6));
103
+ const FD_ADVISE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(7));
104
+ const FD_ALLOCATE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(8));
105
+ const PATH_CREATE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(9));
106
+ const PATH_CREATE_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(10));
107
+ const PATH_LINK_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(11));
108
+ const PATH_LINK_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(12));
109
+ const PATH_OPEN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(13));
110
+ const FD_READDIR = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(14));
111
+ const PATH_READLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(15));
112
+ const PATH_RENAME_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(16));
113
+ const PATH_RENAME_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(17));
114
+ const PATH_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(18));
115
+ const PATH_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(19));
116
+ const PATH_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(20));
117
+ const FD_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(21));
118
+ const FD_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(22));
119
+ const FD_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(23));
120
+ const PATH_SYMLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(24));
121
+ const PATH_REMOVE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(25));
122
+ const PATH_UNLINK_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(26));
123
+ const POLL_FD_READWRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(27));
124
+ const SOCK_SHUTDOWN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(28));
125
+ const SOCK_ACCEPT = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(29));
126
+ exports.WasiRights = {
127
+ FD_DATASYNC,
128
+ FD_READ,
129
+ FD_SEEK,
130
+ FD_FDSTAT_SET_FLAGS,
131
+ FD_SYNC,
132
+ FD_TELL,
133
+ FD_WRITE,
134
+ FD_ADVISE,
135
+ FD_ALLOCATE,
136
+ PATH_CREATE_DIRECTORY,
137
+ PATH_CREATE_FILE,
138
+ PATH_LINK_SOURCE,
139
+ PATH_LINK_TARGET,
140
+ PATH_OPEN,
141
+ FD_READDIR,
142
+ PATH_READLINK,
143
+ PATH_RENAME_SOURCE,
144
+ PATH_RENAME_TARGET,
145
+ PATH_FILESTAT_GET,
146
+ PATH_FILESTAT_SET_SIZE,
147
+ PATH_FILESTAT_SET_TIMES,
148
+ FD_FILESTAT_GET,
149
+ FD_FILESTAT_SET_SIZE,
150
+ FD_FILESTAT_SET_TIMES,
151
+ PATH_SYMLINK,
152
+ PATH_REMOVE_DIRECTORY,
153
+ PATH_UNLINK_FILE,
154
+ POLL_FD_READWRITE,
155
+ SOCK_SHUTDOWN,
156
+ SOCK_ACCEPT
157
+ };
158
+ var WasiWhence;
159
+ (function (WasiWhence) {
160
+ WasiWhence[WasiWhence["SET"] = 0] = "SET";
161
+ WasiWhence[WasiWhence["CUR"] = 1] = "CUR";
162
+ WasiWhence[WasiWhence["END"] = 2] = "END";
163
+ })(WasiWhence = exports.WasiWhence || (exports.WasiWhence = {}));
164
+ var FileControlFlag;
165
+ (function (FileControlFlag) {
166
+ FileControlFlag[FileControlFlag["O_RDONLY"] = 0] = "O_RDONLY";
167
+ FileControlFlag[FileControlFlag["O_WRONLY"] = 1] = "O_WRONLY";
168
+ FileControlFlag[FileControlFlag["O_RDWR"] = 2] = "O_RDWR";
169
+ FileControlFlag[FileControlFlag["O_CREAT"] = 64] = "O_CREAT";
170
+ FileControlFlag[FileControlFlag["O_EXCL"] = 128] = "O_EXCL";
171
+ FileControlFlag[FileControlFlag["O_NOCTTY"] = 256] = "O_NOCTTY";
172
+ FileControlFlag[FileControlFlag["O_TRUNC"] = 512] = "O_TRUNC";
173
+ FileControlFlag[FileControlFlag["O_APPEND"] = 1024] = "O_APPEND";
174
+ FileControlFlag[FileControlFlag["O_DIRECTORY"] = 65536] = "O_DIRECTORY";
175
+ FileControlFlag[FileControlFlag["O_NOATIME"] = 262144] = "O_NOATIME";
176
+ FileControlFlag[FileControlFlag["O_NOFOLLOW"] = 131072] = "O_NOFOLLOW";
177
+ FileControlFlag[FileControlFlag["O_SYNC"] = 1052672] = "O_SYNC";
178
+ FileControlFlag[FileControlFlag["O_DIRECT"] = 16384] = "O_DIRECT";
179
+ FileControlFlag[FileControlFlag["O_NONBLOCK"] = 2048] = "O_NONBLOCK";
180
+ })(FileControlFlag = exports.FileControlFlag || (exports.FileControlFlag = {}));
181
+ var WasiFileControlFlag;
182
+ (function (WasiFileControlFlag) {
183
+ WasiFileControlFlag[WasiFileControlFlag["O_CREAT"] = 1] = "O_CREAT";
184
+ WasiFileControlFlag[WasiFileControlFlag["O_DIRECTORY"] = 2] = "O_DIRECTORY";
185
+ WasiFileControlFlag[WasiFileControlFlag["O_EXCL"] = 4] = "O_EXCL";
186
+ WasiFileControlFlag[WasiFileControlFlag["O_TRUNC"] = 8] = "O_TRUNC";
187
+ })(WasiFileControlFlag = exports.WasiFileControlFlag || (exports.WasiFileControlFlag = {}));
188
+ var WasiFdFlag;
189
+ (function (WasiFdFlag) {
190
+ WasiFdFlag[WasiFdFlag["APPEND"] = 1] = "APPEND";
191
+ WasiFdFlag[WasiFdFlag["DSYNC"] = 2] = "DSYNC";
192
+ WasiFdFlag[WasiFdFlag["NONBLOCK"] = 4] = "NONBLOCK";
193
+ WasiFdFlag[WasiFdFlag["RSYNC"] = 8] = "RSYNC";
194
+ WasiFdFlag[WasiFdFlag["SYNC"] = 16] = "SYNC";
195
+ })(WasiFdFlag = exports.WasiFdFlag || (exports.WasiFdFlag = {}));
196
+ var WasiClockid;
197
+ (function (WasiClockid) {
198
+ WasiClockid[WasiClockid["REALTIME"] = 0] = "REALTIME";
199
+ WasiClockid[WasiClockid["MONOTONIC"] = 1] = "MONOTONIC";
200
+ WasiClockid[WasiClockid["PROCESS_CPUTIME_ID"] = 2] = "PROCESS_CPUTIME_ID";
201
+ WasiClockid[WasiClockid["THREAD_CPUTIME_ID"] = 3] = "THREAD_CPUTIME_ID";
202
+ })(WasiClockid = exports.WasiClockid || (exports.WasiClockid = {}));
203
+ var WasiFstFlag;
204
+ (function (WasiFstFlag) {
205
+ WasiFstFlag[WasiFstFlag["SET_ATIM"] = 1] = "SET_ATIM";
206
+ WasiFstFlag[WasiFstFlag["SET_ATIM_NOW"] = 2] = "SET_ATIM_NOW";
207
+ WasiFstFlag[WasiFstFlag["SET_MTIM"] = 4] = "SET_MTIM";
208
+ WasiFstFlag[WasiFstFlag["SET_MTIM_NOW"] = 8] = "SET_MTIM_NOW";
209
+ })(WasiFstFlag = exports.WasiFstFlag || (exports.WasiFstFlag = {}));
210
+ var WasiEventType;
211
+ (function (WasiEventType) {
212
+ WasiEventType[WasiEventType["CLOCK"] = 0] = "CLOCK";
213
+ WasiEventType[WasiEventType["FD_READ"] = 1] = "FD_READ";
214
+ WasiEventType[WasiEventType["FD_WRITE"] = 2] = "FD_WRITE";
215
+ })(WasiEventType = exports.WasiEventType || (exports.WasiEventType = {}));
216
+ var WasiSubclockflags;
217
+ (function (WasiSubclockflags) {
218
+ WasiSubclockflags[WasiSubclockflags["ABSTIME"] = 1] = "ABSTIME";
219
+ })(WasiSubclockflags = exports.WasiSubclockflags || (exports.WasiSubclockflags = {}));
220
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unsharedSlice = exports.sleepBreakIf = exports.postMsg = exports.isMainThread = exports.wrapInstanceExports = exports.isPromiseLike = exports.validateInt32 = exports.validateUndefined = exports.validateFunction = exports.validateString = exports.validateBoolean = exports.validateArray = exports.validateObject = void 0;
4
+ /* eslint-disable spaced-comment */
5
+ function validateObject(value, name) {
6
+ if (value === null || typeof value !== 'object') {
7
+ throw new TypeError(`${name} must be an object. Received ${value === null ? 'null' : typeof value}`);
8
+ }
9
+ }
10
+ exports.validateObject = validateObject;
11
+ function validateArray(value, name) {
12
+ if (!Array.isArray(value)) {
13
+ throw new TypeError(`${name} must be an array. Received ${value === null ? 'null' : typeof value}`);
14
+ }
15
+ }
16
+ exports.validateArray = validateArray;
17
+ function validateBoolean(value, name) {
18
+ if (typeof value !== 'boolean') {
19
+ throw new TypeError(`${name} must be a boolean. Received ${value === null ? 'null' : typeof value}`);
20
+ }
21
+ }
22
+ exports.validateBoolean = validateBoolean;
23
+ function validateString(value, name) {
24
+ if (typeof value !== 'string') {
25
+ throw new TypeError(`${name} must be a string. Received ${value === null ? 'null' : typeof value}`);
26
+ }
27
+ }
28
+ exports.validateString = validateString;
29
+ function validateFunction(value, name) {
30
+ if (typeof value !== 'function') {
31
+ throw new TypeError(`${name} must be a function. Received ${value === null ? 'null' : typeof value}`);
32
+ }
33
+ }
34
+ exports.validateFunction = validateFunction;
35
+ function validateUndefined(value, name) {
36
+ if (value !== undefined) {
37
+ throw new TypeError(`${name} must be undefined. Received ${value === null ? 'null' : typeof value}`);
38
+ }
39
+ }
40
+ exports.validateUndefined = validateUndefined;
41
+ function validateInt32(value, name, min = -2147483648, max = 2147483647) {
42
+ if (typeof value !== 'number') {
43
+ throw new TypeError(`${name} must be a number. Received ${value === null ? 'null' : typeof value}`);
44
+ }
45
+ if (!Number.isInteger(value)) {
46
+ throw new RangeError(`${name} must be a integer.`);
47
+ }
48
+ if (value < min || value > max) {
49
+ throw new RangeError(`${name} must be >= ${min} && <= ${max}. Received ${value}`);
50
+ }
51
+ }
52
+ exports.validateInt32 = validateInt32;
53
+ function isPromiseLike(obj) {
54
+ return !!(obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function');
55
+ }
56
+ exports.isPromiseLike = isPromiseLike;
57
+ function wrapInstanceExports(exports, mapFn) {
58
+ const newExports = Object.create(null);
59
+ Object.keys(exports).forEach(name => {
60
+ const exportValue = exports[name];
61
+ Object.defineProperty(newExports, name, {
62
+ enumerable: true,
63
+ value: mapFn(exportValue, name)
64
+ });
65
+ });
66
+ return newExports;
67
+ }
68
+ exports.wrapInstanceExports = wrapInstanceExports;
69
+ const _require = /*#__PURE__*/ (function () {
70
+ let nativeRequire;
71
+ if (typeof __webpack_public_path__ !== 'undefined') {
72
+ nativeRequire = (function () {
73
+ return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined;
74
+ })();
75
+ }
76
+ else {
77
+ nativeRequire = (function () {
78
+ return typeof __webpack_public_path__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined);
79
+ })();
80
+ }
81
+ return nativeRequire;
82
+ })();
83
+ exports.isMainThread = (function () {
84
+ let worker_threads;
85
+ try {
86
+ worker_threads = _require('worker_threads');
87
+ }
88
+ catch (_) { }
89
+ if (!worker_threads) {
90
+ return typeof importScripts === 'undefined';
91
+ }
92
+ return worker_threads.isMainThread;
93
+ })();
94
+ exports.postMsg = exports.isMainThread
95
+ ? () => { }
96
+ : /*#__PURE__*/ (function () {
97
+ let worker_threads;
98
+ try {
99
+ worker_threads = _require('worker_threads');
100
+ }
101
+ catch (_) { }
102
+ if (!worker_threads) {
103
+ return postMessage;
104
+ }
105
+ return function postMessage(data) {
106
+ worker_threads.parentPort.postMessage({ data });
107
+ };
108
+ })();
109
+ function sleepBreakIf(delay, breakIf) {
110
+ const start = Date.now();
111
+ const end = start + delay;
112
+ let ret = false;
113
+ while (Date.now() < end) {
114
+ if (breakIf()) {
115
+ ret = true;
116
+ break;
117
+ }
118
+ }
119
+ return ret;
120
+ }
121
+ exports.sleepBreakIf = sleepBreakIf;
122
+ function unsharedSlice(view, start, end) {
123
+ return ((typeof SharedArrayBuffer === 'function' && view.buffer instanceof SharedArrayBuffer) || (Object.prototype.toString.call(view.buffer.constructor) === '[object SharedArrayBuffer]'))
124
+ ? view.slice(start, end)
125
+ : view.subarray(start, end);
126
+ }
127
+ exports.unsharedSlice = unsharedSlice;
128
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._WebAssembly = void 0;
4
+ const _WebAssembly = typeof WebAssembly !== 'undefined'
5
+ ? WebAssembly
6
+ : typeof WXWebAssembly !== 'undefined'
7
+ ? WXWebAssembly
8
+ : undefined;
9
+ exports._WebAssembly = _WebAssembly;
10
+ if (!_WebAssembly) {
11
+ throw new Error('WebAssembly is not supported in this environment');
12
+ }
13
+ //# sourceMappingURL=webassembly.js.map
@@ -0,0 +1,153 @@
1
+ import { _WebAssembly } from "./webassembly.mjs";
2
+ import { isPromiseLike, wrapInstanceExports } from "./wasi/util.mjs";
3
+ const ignoreNames = [
4
+ 'asyncify_get_state',
5
+ 'asyncify_start_rewind',
6
+ 'asyncify_start_unwind',
7
+ 'asyncify_stop_rewind',
8
+ 'asyncify_stop_unwind'
9
+ ];
10
+ // const wrappedExports = new WeakMap<WebAssembly.Exports, WebAssembly.Exports>()
11
+ var AsyncifyState;
12
+ (function (AsyncifyState) {
13
+ AsyncifyState[AsyncifyState["NONE"] = 0] = "NONE";
14
+ AsyncifyState[AsyncifyState["UNWINDING"] = 1] = "UNWINDING";
15
+ AsyncifyState[AsyncifyState["REWINDING"] = 2] = "REWINDING";
16
+ })(AsyncifyState || (AsyncifyState = {}));
17
+ function tryAllocate(instance, wasm64, size, mallocName) {
18
+ if (typeof instance.exports[mallocName] !== 'function' || size <= 0) {
19
+ return {
20
+ wasm64,
21
+ dataPtr: 16,
22
+ start: wasm64 ? 32 : 24,
23
+ end: 1024
24
+ };
25
+ }
26
+ const malloc = instance.exports[mallocName];
27
+ const dataPtr = wasm64 ? Number(malloc(BigInt(16) + BigInt(size))) : malloc(8 + size);
28
+ if (dataPtr === 0) {
29
+ throw new Error('Allocate asyncify data failed');
30
+ }
31
+ return wasm64
32
+ ? { wasm64, dataPtr, start: dataPtr + 16, end: dataPtr + 16 + size }
33
+ : { wasm64, dataPtr, start: dataPtr + 8, end: dataPtr + 8 + size };
34
+ }
35
+ /** @public */
36
+ export class Asyncify {
37
+ constructor() {
38
+ this.value = undefined;
39
+ this.exports = undefined;
40
+ this.dataPtr = 0;
41
+ }
42
+ init(memory, instance, options) {
43
+ var _a, _b;
44
+ if (this.exports) {
45
+ throw new Error('Asyncify has been initialized');
46
+ }
47
+ if (!(memory instanceof _WebAssembly.Memory)) {
48
+ throw new TypeError('Require WebAssembly.Memory object');
49
+ }
50
+ const exports = instance.exports;
51
+ for (let i = 0; i < ignoreNames.length; ++i) {
52
+ if (typeof exports[ignoreNames[i]] !== 'function') {
53
+ throw new TypeError('Invalid asyncify wasm');
54
+ }
55
+ }
56
+ let address;
57
+ const wasm64 = Boolean(options.wasm64);
58
+ if (!options.tryAllocate) {
59
+ address = {
60
+ wasm64,
61
+ dataPtr: 16,
62
+ start: wasm64 ? 32 : 24,
63
+ end: 1024
64
+ };
65
+ }
66
+ else {
67
+ if (options.tryAllocate === true) {
68
+ address = tryAllocate(instance, wasm64, 4096, 'malloc');
69
+ }
70
+ else {
71
+ address = tryAllocate(instance, wasm64, (_a = options.tryAllocate.size) !== null && _a !== void 0 ? _a : 4096, (_b = options.tryAllocate.name) !== null && _b !== void 0 ? _b : 'malloc');
72
+ }
73
+ }
74
+ this.dataPtr = address.dataPtr;
75
+ if (wasm64) {
76
+ new BigInt64Array(memory.buffer, this.dataPtr).set([BigInt(address.start), BigInt(address.end)]);
77
+ }
78
+ else {
79
+ new Int32Array(memory.buffer, this.dataPtr).set([address.start, address.end]);
80
+ }
81
+ this.exports = this.wrapExports(exports, options.wrapExports);
82
+ const asyncifiedInstance = Object.create(_WebAssembly.Instance.prototype);
83
+ Object.defineProperty(asyncifiedInstance, 'exports', { value: this.exports });
84
+ // Object.setPrototypeOf(instance, Instance.prototype)
85
+ return asyncifiedInstance;
86
+ }
87
+ assertState() {
88
+ if (this.exports.asyncify_get_state() !== AsyncifyState.NONE) {
89
+ throw new Error('Asyncify state error');
90
+ }
91
+ }
92
+ wrapImportFunction(f) {
93
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
94
+ const _this = this;
95
+ return (function () {
96
+ // eslint-disable-next-line no-unreachable-loop
97
+ while (_this.exports.asyncify_get_state() === AsyncifyState.REWINDING) {
98
+ _this.exports.asyncify_stop_rewind();
99
+ return _this.value;
100
+ }
101
+ _this.assertState();
102
+ const v = f.apply(this, arguments);
103
+ if (!isPromiseLike(v))
104
+ return v;
105
+ _this.exports.asyncify_start_unwind(_this.dataPtr);
106
+ _this.value = v;
107
+ });
108
+ }
109
+ wrapImports(imports) {
110
+ const importObject = {};
111
+ Object.keys(imports).forEach(k => {
112
+ const mod = imports[k];
113
+ const newModule = {};
114
+ Object.keys(mod).forEach(name => {
115
+ const importValue = mod[name];
116
+ if (typeof importValue === 'function') {
117
+ newModule[name] = this.wrapImportFunction(importValue);
118
+ }
119
+ else {
120
+ newModule[name] = importValue;
121
+ }
122
+ });
123
+ importObject[k] = newModule;
124
+ });
125
+ return importObject;
126
+ }
127
+ wrapExportFunction(f) {
128
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
129
+ const _this = this;
130
+ return (async function () {
131
+ _this.assertState();
132
+ let ret = f.apply(this, arguments);
133
+ while (_this.exports.asyncify_get_state() === AsyncifyState.UNWINDING) {
134
+ _this.exports.asyncify_stop_unwind();
135
+ _this.value = await _this.value;
136
+ _this.assertState();
137
+ _this.exports.asyncify_start_rewind(_this.dataPtr);
138
+ ret = f.call(this);
139
+ }
140
+ _this.assertState();
141
+ return ret;
142
+ });
143
+ }
144
+ wrapExports(exports, needWrap) {
145
+ return wrapInstanceExports(exports, (exportValue, name) => {
146
+ let ignore = ignoreNames.indexOf(name) !== -1 || typeof exportValue !== 'function';
147
+ if (Array.isArray(needWrap)) {
148
+ ignore = ignore || (needWrap.indexOf(name) === -1);
149
+ }
150
+ return ignore ? exportValue : this.wrapExportFunction(exportValue);
151
+ });
152
+ }
153
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @packageDocumentation
3
+ */
4
+ export * from "./asyncify.mjs";
5
+ export * from "./load.mjs";
6
+ export * from "./wasi/index.mjs";
7
+ export * from "./memory.mjs";
8
+ export * from "./jspi.mjs";
9
+ export * from "./wasi/fs.mjs";