@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.fc4afc2 → 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 +177 -131
- 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 +212 -133
- package/node_modules/@emnapi/core/dist/emnapi-core.js +269 -163
- 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 +177 -131
- package/node_modules/@emnapi/core/package.json +2 -2
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +19 -12
- 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 +19 -12
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +4 -4
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +19 -12
- package/node_modules/@emnapi/runtime/dist/emnapi.js +19 -12
- 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 +19 -12
- package/node_modules/@emnapi/runtime/package.json +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +45 -29
- 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 +45 -29
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +45 -29
- 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 +45 -29
- 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 +14861 -13920
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +259 -0
- package/node_modules/@napi-rs/wasm-runtime/package.json +15 -13
- 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 -12269
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.cjs +0 -193
|
@@ -1,193 +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
|
-
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
|
-
})
|