@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.00ef99d
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/README.md +3 -0
- package/node_modules/@emnapi/core/LICENSE +21 -0
- package/node_modules/@emnapi/core/README.md +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +7746 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +428 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +428 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +430 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +8741 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.js +9777 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +428 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.mjs +7735 -0
- package/node_modules/@emnapi/core/index.js +5 -0
- package/node_modules/@emnapi/core/package.json +49 -0
- package/node_modules/@emnapi/runtime/LICENSE +21 -0
- package/node_modules/@emnapi/runtime/README.md +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1398 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +671 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.d.mts +671 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.d.ts +673 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1457 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +426 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1528 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.js +1529 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +671 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.mjs +1367 -0
- package/node_modules/@emnapi/runtime/index.js +5 -0
- package/node_modules/@emnapi/runtime/package.json +48 -0
- package/node_modules/@emnapi/wasi-threads/LICENSE +21 -0
- package/node_modules/@emnapi/wasi-threads/README.md +203 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +915 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +271 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +271 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +273 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +975 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +987 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +271 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +910 -0
- package/node_modules/@emnapi/wasi-threads/index.js +5 -0
- package/node_modules/@emnapi/wasi-threads/package.json +50 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +1826 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +1823 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +321 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +25524 -0
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +316 -0
- package/node_modules/@napi-rs/wasm-runtime/package.json +74 -0
- package/node_modules/@napi-rs/wasm-runtime/runtime.cjs +39 -0
- package/node_modules/@napi-rs/wasm-runtime/runtime.js +36 -0
- package/node_modules/@tybys/wasm-util/README.md +193 -0
- package/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +11 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +423 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +2932 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +2932 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.js +2954 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +158 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/index.js +13 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +46 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/load.js +97 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/memory.js +35 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +103 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +268 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +3 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +192 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +316 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +1599 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +141 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +220 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +128 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +13 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +153 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +9 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +39 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +89 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +28 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +97 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +256 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +1 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +186 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +310 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +1593 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +135 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +216 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +113 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +9 -0
- package/node_modules/@tybys/wasm-util/package.json +58 -0
- package/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/node_modules/tslib/LICENSE.txt +12 -0
- package/node_modules/tslib/README.md +164 -0
- package/node_modules/tslib/SECURITY.md +41 -0
- package/node_modules/tslib/modules/index.d.ts +38 -0
- package/node_modules/tslib/modules/index.js +70 -0
- package/node_modules/tslib/modules/package.json +3 -0
- package/node_modules/tslib/package.json +47 -0
- package/node_modules/tslib/tslib.d.ts +460 -0
- package/node_modules/tslib/tslib.es6.html +1 -0
- package/node_modules/tslib/tslib.es6.js +402 -0
- package/node_modules/tslib/tslib.es6.mjs +401 -0
- package/node_modules/tslib/tslib.html +1 -0
- package/node_modules/tslib/tslib.js +484 -0
- package/package.json +42 -0
- package/tailwindcss-oxide.wasi-browser.js +67 -0
- package/tailwindcss-oxide.wasi.cjs +123 -0
- package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
- package/wasi-worker-browser.mjs +41 -0
- package/wasi-worker.mjs +72 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
const __nodeFs = require('node:fs')
|
|
7
|
+
const __nodePath = require('node:path')
|
|
8
|
+
const { WASI: __nodeWASI } = require('node:wasi')
|
|
9
|
+
const { Worker } = require('node:worker_threads')
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
createOnMessage: __wasmCreateOnMessageForFsProxy,
|
|
13
|
+
getDefaultContext: __emnapiGetDefaultContext,
|
|
14
|
+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
|
15
|
+
} = require('@napi-rs/wasm-runtime')
|
|
16
|
+
|
|
17
|
+
const __rootDir = __nodePath.parse(process.cwd()).root
|
|
18
|
+
|
|
19
|
+
const __wasi = (() => {
|
|
20
|
+
// Preopening '/' fails with UVWASI_EACCES in sandboxed environments (e.g.
|
|
21
|
+
// OpenHarmony, Android), which would prevent the wasm binding from loading
|
|
22
|
+
// at all. Retry with narrower preopens instead. Without any preopens the
|
|
23
|
+
// binding still loads; only file system access is unavailable.
|
|
24
|
+
let lastError = null
|
|
25
|
+
for (const dir of [__rootDir, process.cwd(), null]) {
|
|
26
|
+
try {
|
|
27
|
+
return new __nodeWASI({
|
|
28
|
+
version: 'preview1',
|
|
29
|
+
env: process.env,
|
|
30
|
+
preopens: dir === null ? {} : { [dir]: dir },
|
|
31
|
+
})
|
|
32
|
+
} catch (error) {
|
|
33
|
+
lastError = error
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
throw lastError
|
|
37
|
+
})()
|
|
38
|
+
|
|
39
|
+
const __emnapiContext = __emnapiGetDefaultContext()
|
|
40
|
+
|
|
41
|
+
const __sharedMemory = new WebAssembly.Memory({
|
|
42
|
+
initial: 16384,
|
|
43
|
+
maximum: 65536,
|
|
44
|
+
shared: true,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
let __wasmFilePath = __nodePath.join(__dirname, 'tailwindcss-oxide.wasm32-wasi.wasm')
|
|
48
|
+
const __wasmDebugFilePath = __nodePath.join(__dirname, 'tailwindcss-oxide.wasm32-wasi.debug.wasm')
|
|
49
|
+
|
|
50
|
+
if (__nodeFs.existsSync(__wasmDebugFilePath)) {
|
|
51
|
+
__wasmFilePath = __wasmDebugFilePath
|
|
52
|
+
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
|
|
53
|
+
try {
|
|
54
|
+
__wasmFilePath = require.resolve('@tailwindcss/oxide-wasm32-wasi/tailwindcss-oxide.wasm32-wasi.wasm')
|
|
55
|
+
} catch {
|
|
56
|
+
throw new Error('Cannot find tailwindcss-oxide.wasm32-wasi.wasm file, and @tailwindcss/oxide-wasm32-wasi package is not installed.')
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
|
|
61
|
+
context: __emnapiContext,
|
|
62
|
+
asyncWorkPoolSize: (function() {
|
|
63
|
+
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
|
|
64
|
+
// NaN > 0 is false
|
|
65
|
+
if (threadsSizeFromEnv > 0) {
|
|
66
|
+
return threadsSizeFromEnv
|
|
67
|
+
} else {
|
|
68
|
+
return 4
|
|
69
|
+
}
|
|
70
|
+
})(),
|
|
71
|
+
reuseWorker: true,
|
|
72
|
+
wasi: __wasi,
|
|
73
|
+
onCreateWorker() {
|
|
74
|
+
const worker = new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), {
|
|
75
|
+
env: process.env,
|
|
76
|
+
})
|
|
77
|
+
worker.onmessage = ({ data }) => {
|
|
78
|
+
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The main thread of Node.js waits for all the active handles before exiting.
|
|
82
|
+
// But Rust threads are never waited without `thread::join`.
|
|
83
|
+
// So here we hack the code of Node.js to prevent the workers from being referenced (active).
|
|
84
|
+
// According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415,
|
|
85
|
+
// a worker is consist of two handles: kPublicPort and kHandle.
|
|
86
|
+
{
|
|
87
|
+
const kPublicPort = Object.getOwnPropertySymbols(worker).find(s =>
|
|
88
|
+
s.toString().includes("kPublicPort")
|
|
89
|
+
);
|
|
90
|
+
if (kPublicPort) {
|
|
91
|
+
worker[kPublicPort].ref = () => {};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
|
|
95
|
+
s.toString().includes("kHandle")
|
|
96
|
+
);
|
|
97
|
+
if (kHandle) {
|
|
98
|
+
worker[kHandle].ref = () => {};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
worker.unref();
|
|
102
|
+
}
|
|
103
|
+
return worker
|
|
104
|
+
},
|
|
105
|
+
overwriteImports(importObject) {
|
|
106
|
+
importObject.env = {
|
|
107
|
+
...importObject.env,
|
|
108
|
+
...importObject.napi,
|
|
109
|
+
...importObject.emnapi,
|
|
110
|
+
memory: __sharedMemory,
|
|
111
|
+
}
|
|
112
|
+
return importObject
|
|
113
|
+
},
|
|
114
|
+
beforeInit({ instance }) {
|
|
115
|
+
for (const name of Object.keys(instance.exports)) {
|
|
116
|
+
if (name.startsWith('__napi_register__')) {
|
|
117
|
+
instance.exports[name]()
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
module.exports = __napiModule.exports
|
|
123
|
+
module.exports.Scanner = __napiModule.exports.Scanner
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { instantiateNapiModuleSync, MessageHandler, WASI, createFsProxy } from '@napi-rs/wasm-runtime'
|
|
2
|
+
import { memfsExported as __memfsExported } from '@napi-rs/wasm-runtime/fs'
|
|
3
|
+
|
|
4
|
+
const fs = createFsProxy(__memfsExported)
|
|
5
|
+
|
|
6
|
+
const handler = new MessageHandler({
|
|
7
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
8
|
+
const wasi = new WASI({
|
|
9
|
+
fs,
|
|
10
|
+
preopens: {
|
|
11
|
+
'/': '/',
|
|
12
|
+
},
|
|
13
|
+
print: function () {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log.apply(console, arguments)
|
|
16
|
+
},
|
|
17
|
+
printErr: function() {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.error.apply(console, arguments)
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
24
|
+
childThread: true,
|
|
25
|
+
wasi,
|
|
26
|
+
overwriteImports(importObject) {
|
|
27
|
+
importObject.env = {
|
|
28
|
+
...importObject.env,
|
|
29
|
+
...importObject.napi,
|
|
30
|
+
...importObject.emnapi,
|
|
31
|
+
memory: wasmMemory,
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
globalThis.onmessage = function (e) {
|
|
40
|
+
handler.handle(e)
|
|
41
|
+
}
|
package/wasi-worker.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { parse } from "node:path";
|
|
4
|
+
import { WASI } from "node:wasi";
|
|
5
|
+
import { parentPort, Worker } from "node:worker_threads";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
const { instantiateNapiModuleSync, MessageHandler, getDefaultContext } = require("@napi-rs/wasm-runtime");
|
|
10
|
+
|
|
11
|
+
if (parentPort) {
|
|
12
|
+
parentPort.on("message", (data) => {
|
|
13
|
+
globalThis.onmessage({ data });
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Object.assign(globalThis, {
|
|
18
|
+
self: globalThis,
|
|
19
|
+
require,
|
|
20
|
+
Worker,
|
|
21
|
+
importScripts: function (f) {
|
|
22
|
+
;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
|
|
23
|
+
},
|
|
24
|
+
postMessage: function (msg) {
|
|
25
|
+
if (parentPort) {
|
|
26
|
+
parentPort.postMessage(msg);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const emnapiContext = getDefaultContext();
|
|
32
|
+
|
|
33
|
+
const __rootDir = parse(process.cwd()).root;
|
|
34
|
+
|
|
35
|
+
const handler = new MessageHandler({
|
|
36
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
37
|
+
// Keep in sync with the preopen fallback in the main-thread loader.
|
|
38
|
+
const wasi = (() => {
|
|
39
|
+
let lastError = null;
|
|
40
|
+
for (const dir of [__rootDir, process.cwd(), null]) {
|
|
41
|
+
try {
|
|
42
|
+
return new WASI({
|
|
43
|
+
version: 'preview1',
|
|
44
|
+
env: process.env,
|
|
45
|
+
preopens: dir === null ? {} : { [dir]: dir },
|
|
46
|
+
});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
lastError = error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw lastError;
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
55
|
+
childThread: true,
|
|
56
|
+
wasi,
|
|
57
|
+
context: emnapiContext,
|
|
58
|
+
overwriteImports(importObject) {
|
|
59
|
+
importObject.env = {
|
|
60
|
+
...importObject.env,
|
|
61
|
+
...importObject.napi,
|
|
62
|
+
...importObject.emnapi,
|
|
63
|
+
memory: wasmMemory
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
globalThis.onmessage = function (e) {
|
|
71
|
+
handler.handle(e);
|
|
72
|
+
};
|