@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,193 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @param {unknown} value
5
+ */
6
+ const getType = (value) => {
7
+ if (value === undefined) return 0
8
+ if (value === null) return 1
9
+ const t = typeof value
10
+ if (t === 'boolean') return 2
11
+ if (t === 'number') return 3
12
+ if (t === 'string') return 4
13
+ if (t === 'object') return 6
14
+ if (t === 'bigint') return 9
15
+ return -1
16
+ }
17
+
18
+ /**
19
+ * @param {import('memfs').IFs} memfs
20
+ * @param {any} value
21
+ * @param {ReturnType<typeof getType>} type
22
+ * @returns {Uint8Array}
23
+ */
24
+ const encodeValue = (memfs, value, type) => {
25
+ switch (type) {
26
+ case 0:
27
+ case 1:
28
+ return new Uint8Array(0)
29
+ case 2: {
30
+ const view = new Int32Array(1)
31
+ view[0] = value ? 1 : 0
32
+ return new Uint8Array(view.buffer)
33
+ }
34
+ case 3: {
35
+ const view = new Float64Array(1)
36
+ view[0] = value
37
+ return new Uint8Array(view.buffer)
38
+ }
39
+ case 4: {
40
+ const view = new TextEncoder().encode(value)
41
+ return view
42
+ }
43
+ case 6: {
44
+ const [entry] = Object.entries(memfs).filter(([_, v]) => v === value.constructor)[0] ?? []
45
+ if (entry) {
46
+ Object.defineProperty(value, '__constructor__', {
47
+ configurable: true,
48
+ writable: true,
49
+ enumerable: true,
50
+ value: entry
51
+ })
52
+ }
53
+
54
+ const json = JSON.stringify(value, (_, value) => {
55
+ if (typeof value === 'bigint') {
56
+ return `BigInt(${String(value)})`
57
+ }
58
+ return value
59
+ })
60
+ const view = new TextEncoder().encode(json)
61
+ return view
62
+ }
63
+ case 9: {
64
+ const view = new BigInt64Array(1)
65
+ view[0] = value
66
+ return new Uint8Array(view.buffer)
67
+ }
68
+ case -1:
69
+ default:
70
+ throw new Error('unsupported data')
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @param {import('memfs').IFs} fs
76
+ * @returns {(e: { data: { __fs__: { sab: Int32Array, type: keyof import('memfs').IFs, payload: any[] } } }) => void}
77
+ */
78
+ // oxlint-disable-next-line no-unused-vars -- fixed in an upcoming release
79
+ module.exports.createOnMessage = (fs) => function onMessage(e) {
80
+ if (e.data.__fs__) {
81
+ /**
82
+ * 0..4 status(int32_t): 21(waiting) 0(success) 1(error)
83
+ * 5..8 type(napi_valuetype): 0(undefined) 1(null) 2(boolean) 3(number) 4(string) 6(jsonstring) 9(bigint) -1(unsupported)
84
+ * 9..16 payload_size(uint32_t) <= 1024
85
+ * 16..16 + payload_size payload_content
86
+ */
87
+ const { sab, type, payload } = e.data.__fs__
88
+ const fn = fs[type]
89
+ const args = payload ? payload.map((value) => {
90
+ if (value instanceof Uint8Array) {
91
+ // buffer polyfill bug
92
+ // @ts-expect-error
93
+ value._isBuffer = true
94
+ }
95
+ return value
96
+ }) : payload
97
+ try {
98
+ const ret = fn.apply(fs, args)
99
+ const t = getType(ret)
100
+ const v = encodeValue(fs, ret, t)
101
+ Atomics.store(sab, 0, 0)
102
+ Atomics.store(sab, 1, t)
103
+ Atomics.store(sab, 2, v.length)
104
+ new Uint8Array(sab.buffer).set(v, 16)
105
+
106
+ } catch (/** @type {any} */ err) {
107
+ Atomics.store(sab, 0, 1)
108
+ Atomics.store(sab, 1, 6)
109
+ const payloadContent = new TextEncoder().encode(JSON.stringify({
110
+ ...err,
111
+ message: err.message,
112
+ stack: err.stack
113
+ }))
114
+ Atomics.store(sab, 2, payloadContent.length)
115
+ new Uint8Array(sab.buffer).set(payloadContent, 16)
116
+ } finally {
117
+ Atomics.notify(sab, 0)
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * @param {import('memfs').IFs} memfs
124
+ */
125
+ module.exports.createFsProxy = (memfs) => new Proxy({}, {
126
+ get (_target, p, _receiver) {
127
+ /**
128
+ * @param {any[]} args
129
+ */
130
+ return function (...args) {
131
+ const sab = new SharedArrayBuffer(16 + 1024)
132
+ const i32arr = new Int32Array(sab)
133
+ Atomics.store(i32arr, 0, 21)
134
+
135
+ // @ts-expect-error
136
+ postMessage({
137
+ __fs__: {
138
+ sab: i32arr,
139
+ type: p,
140
+ payload: args
141
+ }
142
+ })
143
+
144
+ Atomics.wait(i32arr, 0, 21)
145
+
146
+ const status = Atomics.load(i32arr, 0)
147
+ const type = Atomics.load(i32arr, 1)
148
+ const size = Atomics.load(i32arr, 2)
149
+ const content = new Uint8Array(sab, 16, size)
150
+ if (status === 1) {
151
+ const errobj = JSON.parse(new TextDecoder().decode(content.slice()))
152
+ const err = new Error(errobj.message)
153
+ Object.defineProperty(err, 'stack', {
154
+ configurable: true,
155
+ enumerable: false,
156
+ writable: true,
157
+ value: errobj.stack
158
+ })
159
+ for (const [k, v] of Object.entries(errobj)) {
160
+ if (k === 'message' || k === 'stack') continue
161
+ // @ts-expect-error
162
+ err[k] = v
163
+ }
164
+ throw err
165
+ }
166
+ if (type === 0) return undefined
167
+ if (type === 1) return null
168
+ if (type === 2) return Boolean(content[0])
169
+ if (type === 3) return new Float64Array(sab, 16, 1)[0]
170
+ if (type === 4) return new TextDecoder().decode(content.slice())
171
+ if (type === 6) {
172
+ const obj = JSON.parse(new TextDecoder().decode(content.slice()), (_key, value) => {
173
+ if (typeof value === 'string') {
174
+ const matched = value.match(/^BigInt\((-?\d+)\)$/)
175
+ if (matched && matched[1]) {
176
+ return BigInt(matched[1])
177
+ }
178
+ }
179
+ return value
180
+ })
181
+ if (obj.__constructor__) {
182
+ const ctor = obj.__constructor__
183
+ delete obj.__constructor__
184
+ // @ts-expect-error
185
+ Object.setPrototypeOf(obj, memfs[ctor].prototype)
186
+ }
187
+ return obj
188
+ }
189
+ if (type === 9) return new BigInt64Array(sab, 16, 1)[0]
190
+ throw new Error('unsupported data')
191
+ }
192
+ }
193
+ })
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@napi-rs/wasm-runtime",
3
+ "version": "0.2.8",
4
+ "type": "module",
5
+ "description": "Runtime and polyfill for wasm targets",
6
+ "author": {
7
+ "name": "LongYinan",
8
+ "url": "https://github.com/Brooooooklyn"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/napi-rs/napi-rs.git",
13
+ "directory": "wasi-runtime"
14
+ },
15
+ "license": "MIT",
16
+ "publishConfig": {
17
+ "registry": "https://registry.npmjs.org/",
18
+ "access": "public"
19
+ },
20
+ "files": [
21
+ "runtime.cjs",
22
+ "fs-proxy.cjs",
23
+ "dist/*.js"
24
+ ],
25
+ "devDependencies": {
26
+ "@rollup/plugin-alias": "^5.1.1",
27
+ "@rollup/plugin-commonjs": "^28.0.3",
28
+ "@rollup/plugin-inject": "^5.0.5",
29
+ "@rollup/plugin-json": "^6.1.0",
30
+ "@rollup/plugin-node-resolve": "^16.0.1",
31
+ "@rollup/plugin-replace": "^6.0.2",
32
+ "buffer": "^6.0.3",
33
+ "memfs": "^4.17.0",
34
+ "node-inspect-extracted": "^3.0.2",
35
+ "path-browserify": "^1.0.1",
36
+ "process": "^0.11.10",
37
+ "readable-stream": "^4.7.0",
38
+ "rollup": "^4.38.0",
39
+ "rollup-plugin-polyfill-node": "^0.13.0",
40
+ "tslib": "^2.8.1"
41
+ },
42
+ "dependencies": {
43
+ "@emnapi/core": "^1.4.0",
44
+ "@emnapi/runtime": "^1.4.0",
45
+ "@tybys/wasm-util": "^0.9.0"
46
+ },
47
+ "scripts": {
48
+ "build": "rollup -c rollup.config.js"
49
+ },
50
+ "exports": {
51
+ ".": {
52
+ "import": "./dist/runtime.js",
53
+ "require": "./runtime.cjs"
54
+ },
55
+ "./fs": {
56
+ "import": "./dist/fs.js"
57
+ }
58
+ },
59
+ "gitHead": "6ce13931967f9413ed3312a210a20418b8d6773f"
60
+ }
@@ -0,0 +1,15 @@
1
+ const { MessageHandler, instantiateNapiModuleSync, instantiateNapiModule } = require('@emnapi/core')
2
+ const { getDefaultContext } = require('@emnapi/runtime')
3
+ const { WASI } = require('@tybys/wasm-util')
4
+
5
+ const { createFsProxy, createOnMessage } = require('./fs-proxy.cjs')
6
+
7
+ module.exports = {
8
+ MessageHandler,
9
+ instantiateNapiModule,
10
+ instantiateNapiModuleSync,
11
+ getDefaultContext,
12
+ WASI,
13
+ createFsProxy,
14
+ createOnMessage,
15
+ }
@@ -0,0 +1,193 @@
1
+ # @tybys/wasm-util
2
+
3
+ WebAssembly related utils for browser environment
4
+
5
+ **The output code is ES2019**
6
+
7
+ ## Features
8
+
9
+ All example code below need to be bundled by ES module bundlers like `webpack` / `rollup`, or specify import map in browser native ES module runtime.
10
+
11
+ ### WASI polyfill for browser
12
+
13
+ The API is similar to the `require('wasi').WASI` in Node.js.
14
+
15
+ You can use `memfs-browser` to provide filesystem capability.
16
+
17
+ - Example: [https://github.com/toyobayashi/wasi-wabt](https://github.com/toyobayashi/wasi-wabt)
18
+ - Demo: [https://toyobayashi.github.io/wasi-wabt/](https://toyobayashi.github.io/wasi-wabt/)
19
+
20
+ ```js
21
+ import { load, WASI } from '@tybys/wasm-util'
22
+ import { Volume, createFsFromVolume } from 'memfs-browser'
23
+
24
+ const fs = createFsFromVolume(Volume.fromJSON({
25
+ '/home/wasi': null
26
+ }))
27
+
28
+ const wasi = new WASI({
29
+ args: ['chrome', 'file.wasm'],
30
+ env: {
31
+ NODE_ENV: 'development',
32
+ WASI_SDK_PATH: '/opt/wasi-sdk'
33
+ },
34
+ preopens: {
35
+ '/': '/'
36
+ },
37
+ fs,
38
+
39
+ // redirect stdout / stderr
40
+
41
+ // print (text) { console.log(text) },
42
+ // printErr (text) { console.error(text) }
43
+ })
44
+
45
+ const imports = {
46
+ wasi_snapshot_preview1: wasi.wasiImport
47
+ }
48
+
49
+ const { module, instance } = await load('/path/to/file.wasm', imports)
50
+ wasi.start(instance)
51
+ // wasi.initialize(instance)
52
+ ```
53
+
54
+ Implemented syscalls: [wasi_snapshot_preview1](#wasi_snapshot_preview1)
55
+
56
+ ### `load` / `loadSync`
57
+
58
+ `loadSync` has 4KB wasm size limit in browser.
59
+
60
+ ```js
61
+ // bundler
62
+ import { load, loadSync } from '@tybys/wasm-util'
63
+
64
+ const imports = { /* ... */ }
65
+
66
+ // using path
67
+ const { module, instance } = await load('/path/to/file.wasm', imports)
68
+ const { module, instance } = loadSync('/path/to/file.wasm', imports)
69
+
70
+ // using URL
71
+ const { module, instance } = await load(new URL('./file.wasm', import.meta.url), imports)
72
+ const { module, instance } = loadSync(new URL('./file.wasm', import.meta.url), imports)
73
+
74
+ // using Uint8Array
75
+ const buffer = new Uint8Array([
76
+ 0x00, 0x61, 0x73, 0x6d,
77
+ 0x01, 0x00, 0x00, 0x00
78
+ ])
79
+ const { module, instance } = await load(buffer, imports)
80
+ const { module, instance } = loadSync(buffer, imports)
81
+
82
+ // auto asyncify
83
+ const {
84
+ module,
85
+ instance: asyncifiedInstance
86
+ } = await load(buffer, imports, { /* asyncify options */})
87
+ asyncifiedInstance.exports.fn() // => return Promise
88
+ ```
89
+
90
+ ### Extend Memory instance
91
+
92
+ ```js
93
+ import { Memory, extendMemory } from '@tybys/wasm-util'
94
+
95
+ const memory = new WebAssembly.Memory({ initial: 256 })
96
+ // const memory = instance.exports.memory
97
+
98
+ extendMemory(memory)
99
+ console.log(memory instanceof Memory)
100
+ console.log(memory instanceof WebAssembly.Memory)
101
+ // expose memory view getters like Emscripten
102
+ const { HEAPU8, HEAPU32, view } = memory
103
+ ```
104
+
105
+ ### Asyncify wrap
106
+
107
+ Build the C code using `clang`, `wasm-ld` and `wasm-opt`
108
+
109
+ ```c
110
+ void async_sleep(int ms);
111
+
112
+ int main() {
113
+ async_sleep(200);
114
+ return 0;
115
+ }
116
+ ```
117
+
118
+ ```js
119
+ import { Asyncify } from '@tybys/wasm-util'
120
+
121
+ const asyncify = new Asyncify()
122
+
123
+ const imports = {
124
+ env: {
125
+ async_sleep: asyncify.wrapImportFunction(function (ms) {
126
+ return new Promise((resolve) => {
127
+ setTimeout(resolve, ms)
128
+ })
129
+ })
130
+ }
131
+ }
132
+
133
+ // async_sleep(200)
134
+ const bytes = await (await fetch('/asyncfied_by_wasm-opt.wasm')).arrayBuffer()
135
+ const { instance } = await WebAssembly.instantiate(bytes, imports)
136
+ const asyncifiedInstance = asyncify.init(instance.exports.memory, instance, {
137
+ wrapExports: ['_start']
138
+ })
139
+
140
+ const p = asyncifedInstance._start()
141
+ console.log(typeof p.then === 'function')
142
+ const now = Date.now()
143
+ await p
144
+ console.log(Date.now() - now >= 200)
145
+ ```
146
+
147
+ ### wasi_snapshot_preview1
148
+
149
+ - [x] args_get
150
+ - [x] args_sizes_get
151
+ - [x] environ_get
152
+ - [x] environ_sizes_get
153
+ - [x] clock_res_get
154
+ - [x] clock_time_get
155
+ - [ ] ~~fd_advise~~
156
+ - [x] fd_allocate
157
+ - [x] fd_close
158
+ - [x] fd_datasync
159
+ - [x] fd_fdstat_get
160
+ - [ ] ~~fd_fdstat_set_flags~~
161
+ - [x] fd_fdstat_set_rights
162
+ - [x] fd_filestat_get
163
+ - [x] fd_filestat_set_size
164
+ - [x] fd_filestat_set_times
165
+ - [x] fd_pread
166
+ - [x] fd_prestat_get
167
+ - [x] fd_prestat_dir_name
168
+ - [x] fd_pwrite
169
+ - [x] fd_read
170
+ - [x] fd_readdir
171
+ - [x] fd_renumber
172
+ - [x] fd_seek
173
+ - [x] fd_sync
174
+ - [x] fd_tell
175
+ - [x] fd_write
176
+ - [x] path_create_directory
177
+ - [x] path_filestat_get
178
+ - [x] path_filestat_set_times
179
+ - [x] path_link
180
+ - [x] path_open
181
+ - [x] path_readlink
182
+ - [x] path_remove_directory
183
+ - [x] path_rename
184
+ - [x] path_symlink
185
+ - [x] path_unlink_file
186
+ - [x] poll_oneoff (timer only)
187
+ - [x] proc_exit
188
+ - [ ] ~~proc_raise~~
189
+ - [x] sched_yield
190
+ - [x] random_get
191
+ - [ ] ~~sock_recv~~
192
+ - [ ] ~~sock_send~~
193
+ - [ ] ~~sock_shutdown~~
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.34.4"
9
+ }
10
+ ]
11
+ }