@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.fac8cd9 → 0.0.0-insiders.fc63ce7
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/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +175 -129
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +58 -2
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +58 -2
- package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +58 -2
- package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +210 -131
- package/node_modules/@emnapi/core/dist/emnapi-core.js +266 -160
- package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +58 -2
- package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.mjs +175 -129
- package/node_modules/@emnapi/core/package.json +2 -2
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +13 -10
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.d.mts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.d.ts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +13 -10
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +13 -10
- package/node_modules/@emnapi/runtime/dist/emnapi.js +13 -10
- package/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.mjs +13 -10
- package/node_modules/@emnapi/runtime/package.json +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +46 -30
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +57 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +57 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +57 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +46 -30
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +46 -30
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +57 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +46 -30
- package/node_modules/@emnapi/wasi-threads/package.json +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +264 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +14895 -13935
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +259 -0
- package/node_modules/@napi-rs/wasm-runtime/package.json +13 -12
- package/node_modules/@napi-rs/wasm-runtime/runtime.cjs +1 -1
- package/node_modules/@napi-rs/wasm-runtime/runtime.js +8 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +6 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +51 -31
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +51 -31
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -1
- package/node_modules/@tybys/wasm-util/dist/wasm-util.js +51 -31
- package/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -1
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +12 -14
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +39 -17
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +12 -14
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +39 -17
- package/node_modules/@tybys/wasm-util/package.json +1 -1
- package/node_modules/tslib/package.json +1 -1
- package/node_modules/tslib/tslib.es6.js +10 -1
- package/node_modules/tslib/tslib.es6.mjs +10 -1
- package/node_modules/tslib/tslib.js +42 -33
- package/package.json +7 -7
- package/tailwindcss-oxide.wasi-browser.js +6 -3
- package/tailwindcss-oxide.wasi.cjs +26 -3
- package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
- package/node_modules/@napi-rs/wasm-runtime/LICENSE +0 -43
- package/node_modules/@napi-rs/wasm-runtime/dist/runtime.js +0 -12285
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.cjs +0 -209
|
@@ -1,209 +0,0 @@
|
|
|
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
|
-
if (value instanceof Error) {
|
|
59
|
-
return {
|
|
60
|
-
...value,
|
|
61
|
-
message: value.message,
|
|
62
|
-
stack: value.stack,
|
|
63
|
-
__error__: value.constructor.name,
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return value
|
|
67
|
-
})
|
|
68
|
-
const view = new TextEncoder().encode(json)
|
|
69
|
-
return view
|
|
70
|
-
}
|
|
71
|
-
case 9: {
|
|
72
|
-
const view = new BigInt64Array(1)
|
|
73
|
-
view[0] = value
|
|
74
|
-
return new Uint8Array(view.buffer)
|
|
75
|
-
}
|
|
76
|
-
case -1:
|
|
77
|
-
default:
|
|
78
|
-
throw new Error('unsupported data')
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {typeof import('memfs')} memfs
|
|
84
|
-
* @param {Uint8Array} payload
|
|
85
|
-
* @param {number} type
|
|
86
|
-
* @returns {any}
|
|
87
|
-
*/
|
|
88
|
-
const decodeValue = (memfs, payload, type) => {
|
|
89
|
-
if (type === 0) return undefined
|
|
90
|
-
if (type === 1) return null
|
|
91
|
-
if (type === 2) return Boolean(new Int32Array(payload.buffer, payload.byteOffset, 1)[0])
|
|
92
|
-
if (type === 3) return new Float64Array(payload.buffer, payload.byteOffset, 1)[0]
|
|
93
|
-
if (type === 4) return new TextDecoder().decode(payload.slice())
|
|
94
|
-
if (type === 6) {
|
|
95
|
-
const obj = JSON.parse(new TextDecoder().decode(payload.slice()), (_key, value) => {
|
|
96
|
-
if (typeof value === 'string') {
|
|
97
|
-
const matched = value.match(/^BigInt\((-?\d+)\)$/)
|
|
98
|
-
if (matched && matched[1]) {
|
|
99
|
-
return BigInt(matched[1])
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return value
|
|
103
|
-
})
|
|
104
|
-
if (obj.__constructor__) {
|
|
105
|
-
const ctor = obj.__constructor__
|
|
106
|
-
delete obj.__constructor__
|
|
107
|
-
Object.setPrototypeOf(obj, memfs[ctor].prototype)
|
|
108
|
-
}
|
|
109
|
-
if (obj.__error__) {
|
|
110
|
-
const name = obj.__error__
|
|
111
|
-
const ErrorConstructor = globalThis[name] || Error
|
|
112
|
-
delete obj.__error__
|
|
113
|
-
const err = new ErrorConstructor(obj.message)
|
|
114
|
-
Object.defineProperty(err, 'stack', {
|
|
115
|
-
configurable: true,
|
|
116
|
-
enumerable: false,
|
|
117
|
-
writable: true,
|
|
118
|
-
value: err.stack
|
|
119
|
-
})
|
|
120
|
-
Object.defineProperty(err, Symbol.toStringTag, {
|
|
121
|
-
configurable: true,
|
|
122
|
-
enumerable: false,
|
|
123
|
-
writable: true,
|
|
124
|
-
value: name
|
|
125
|
-
})
|
|
126
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
127
|
-
if (k === 'message' || k === 'stack') continue
|
|
128
|
-
err[k] = v
|
|
129
|
-
}
|
|
130
|
-
return err
|
|
131
|
-
}
|
|
132
|
-
return obj
|
|
133
|
-
}
|
|
134
|
-
if (type === 9) return new BigInt64Array(payload.buffer, payload.byteOffset, 1)[0]
|
|
135
|
-
throw new Error('unsupported data')
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @param {import('memfs').IFs} fs
|
|
140
|
-
* @returns {(e: { data: { __fs__: { sab: Int32Array, type: keyof import('memfs').IFs, payload: any[] } } }) => void}
|
|
141
|
-
*/
|
|
142
|
-
// oxlint-disable-next-line no-unused-vars -- fixed in an upcoming release
|
|
143
|
-
module.exports.createOnMessage = (fs) => function onMessage(e) {
|
|
144
|
-
if (e.data.__fs__) {
|
|
145
|
-
/**
|
|
146
|
-
* 0..4 status(int32_t): 21(waiting) 0(success) 1(error)
|
|
147
|
-
* 5..8 type(napi_valuetype): 0(undefined) 1(null) 2(boolean) 3(number) 4(string) 6(jsonstring) 9(bigint) -1(unsupported)
|
|
148
|
-
* 9..16 payload_size(uint32_t) <= 1024
|
|
149
|
-
* 16..16 + payload_size payload_content
|
|
150
|
-
*/
|
|
151
|
-
const { sab, type, payload } = e.data.__fs__
|
|
152
|
-
const fn = fs[type]
|
|
153
|
-
try {
|
|
154
|
-
const ret = fn.apply(fs, payload)
|
|
155
|
-
const t = getType(ret)
|
|
156
|
-
Atomics.store(sab, 1, t)
|
|
157
|
-
const v = encodeValue(fs, ret, t)
|
|
158
|
-
Atomics.store(sab, 2, v.length)
|
|
159
|
-
new Uint8Array(sab.buffer).set(v, 16)
|
|
160
|
-
Atomics.store(sab, 0, 0) // success
|
|
161
|
-
|
|
162
|
-
} catch (/** @type {any} */ err) {
|
|
163
|
-
const t = getType(err)
|
|
164
|
-
Atomics.store(sab, 1, t)
|
|
165
|
-
const v = encodeValue(fs, err, t)
|
|
166
|
-
Atomics.store(sab, 2, v.length)
|
|
167
|
-
new Uint8Array(sab.buffer).set(v, 16)
|
|
168
|
-
Atomics.store(sab, 0, 1) // error
|
|
169
|
-
} finally {
|
|
170
|
-
Atomics.notify(sab, 0)
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @param {typeof import('memfs')} memfs
|
|
177
|
-
*/
|
|
178
|
-
module.exports.createFsProxy = (memfs) => new Proxy({}, {
|
|
179
|
-
get (_target, p, _receiver) {
|
|
180
|
-
/**
|
|
181
|
-
* @param {any[]} args
|
|
182
|
-
*/
|
|
183
|
-
return function (...args) {
|
|
184
|
-
const sab = new SharedArrayBuffer(16 + 10240)
|
|
185
|
-
const i32arr = new Int32Array(sab)
|
|
186
|
-
Atomics.store(i32arr, 0, 21)
|
|
187
|
-
|
|
188
|
-
postMessage({
|
|
189
|
-
__fs__: {
|
|
190
|
-
sab: i32arr,
|
|
191
|
-
type: p,
|
|
192
|
-
payload: args
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
Atomics.wait(i32arr, 0, 21)
|
|
197
|
-
|
|
198
|
-
const status = Atomics.load(i32arr, 0)
|
|
199
|
-
const type = Atomics.load(i32arr, 1)
|
|
200
|
-
const size = Atomics.load(i32arr, 2)
|
|
201
|
-
const content = new Uint8Array(sab, 16, size)
|
|
202
|
-
const value = decodeValue(memfs, content, type)
|
|
203
|
-
if (status === 1) {
|
|
204
|
-
throw value
|
|
205
|
-
}
|
|
206
|
-
return value
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
})
|