@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.bd9cf92 → 0.0.0-insiders.bdcd708
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 +1469 -511
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +61 -5
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +61 -5
- package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +61 -5
- package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +1628 -523
- package/node_modules/@emnapi/core/dist/emnapi-core.js +1705 -585
- package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +61 -5
- 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 +1469 -511
- package/node_modules/@emnapi/core/package.json +2 -2
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +44 -14
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +15 -7
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.d.mts +15 -7
- package/node_modules/@emnapi/runtime/dist/emnapi.d.ts +15 -7
- package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +45 -14
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +12 -6
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +45 -14
- package/node_modules/@emnapi/runtime/dist/emnapi.js +45 -14
- package/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +15 -7
- 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 +44 -14
- package/node_modules/@emnapi/runtime/package.json +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +67 -63
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +59 -2
- 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 +59 -2
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +59 -2
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +67 -63
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +67 -63
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +59 -2
- 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 +67 -63
- package/node_modules/@emnapi/wasi-threads/package.json +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +299 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +22125 -20726
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +294 -0
- package/node_modules/@napi-rs/wasm-runtime/package.json +25 -16
- 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 +215 -33
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +215 -33
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -1
- package/node_modules/@tybys/wasm-util/dist/wasm-util.js +215 -33
- 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/path.js +142 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +61 -19
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +12 -14
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +142 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +61 -19
- 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 +7 -3
- package/tailwindcss-oxide.wasi.cjs +27 -4
- package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
- package/wasi-worker-browser.mjs +2 -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,6 +1,141 @@
|
|
|
1
1
|
import { validateString } from "./util.mjs";
|
|
2
2
|
const CHAR_DOT = 46; /* . */
|
|
3
3
|
const CHAR_FORWARD_SLASH = 47; /* / */
|
|
4
|
+
const CHAR_BACKWARD_SLASH = 92; /* \ */
|
|
5
|
+
const CHAR_COLON = 58; /* : */
|
|
6
|
+
const CHAR_UPPERCASE_A = 65; /* A */
|
|
7
|
+
const CHAR_UPPERCASE_Z = 90; /* Z */
|
|
8
|
+
const CHAR_LOWERCASE_A = 97; /* a */
|
|
9
|
+
const CHAR_LOWERCASE_Z = 122; /* z */
|
|
10
|
+
function isPathSeparatorWin(code) {
|
|
11
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
12
|
+
}
|
|
13
|
+
function isWindowsDeviceRoot(code) {
|
|
14
|
+
return (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
|
|
15
|
+
(code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z);
|
|
16
|
+
}
|
|
17
|
+
const _isWin32 = typeof process !== 'undefined' && process.platform === 'win32';
|
|
18
|
+
/**
|
|
19
|
+
* Windows variant of `resolve()`. Mirrors Node's `path.win32.resolve`
|
|
20
|
+
* semantics enough for the WASI shim's needs (drive-letter absolutes
|
|
21
|
+
* + UNC paths + per-drive cwd lookups via `process.env`/`process.cwd`).
|
|
22
|
+
*
|
|
23
|
+
* Why this is needed: on Windows, `FileDescriptor.realPath` is the
|
|
24
|
+
* host realpath returned by `fs.realpathSync(realPath, 'utf8')` — the
|
|
25
|
+
* backslash form `D:\…`. The POSIX-only `resolveImpl` below only
|
|
26
|
+
* treats `/` as a separator, reads `D` as non-`/`, decides realPath
|
|
27
|
+
* is "relative", and produces a garbage joined path. Downstream
|
|
28
|
+
* `fs.openSync(garbage)` then returns `EINVAL` and the WASI caller
|
|
29
|
+
* sees a permanent failure. This function gives us the correct
|
|
30
|
+
* Windows-style resolution without taking a Node-only `path` import
|
|
31
|
+
* (which would break browser bundles of this package).
|
|
32
|
+
*
|
|
33
|
+
* Cribbed from Node's `lib/path.js` `win32.resolve()` (MIT-licensed),
|
|
34
|
+
* trimmed to what WASI realpath resolution actually exercises.
|
|
35
|
+
*/
|
|
36
|
+
function resolveWin32(args) {
|
|
37
|
+
let resolvedDevice = '';
|
|
38
|
+
let resolvedTail = '';
|
|
39
|
+
let resolvedAbsolute = false;
|
|
40
|
+
for (let i = args.length - 1; i >= -1; i--) {
|
|
41
|
+
let path;
|
|
42
|
+
if (i >= 0) {
|
|
43
|
+
path = args[i];
|
|
44
|
+
validateString(path, 'path');
|
|
45
|
+
if (path.length === 0)
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
else if (resolvedDevice.length === 0) {
|
|
49
|
+
path = (typeof process !== 'undefined' && typeof process.cwd === 'function')
|
|
50
|
+
? process.cwd()
|
|
51
|
+
: '';
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Look up per-drive cwd via the `=X:` env var convention; fall back
|
|
55
|
+
// to the global cwd if absent.
|
|
56
|
+
const envKey = `=${resolvedDevice}`;
|
|
57
|
+
const env = (typeof process !== 'undefined') ? process.env : undefined;
|
|
58
|
+
path = (env && typeof env[envKey] === 'string')
|
|
59
|
+
? env[envKey]
|
|
60
|
+
: (typeof process !== 'undefined' && typeof process.cwd === 'function')
|
|
61
|
+
? process.cwd()
|
|
62
|
+
: '';
|
|
63
|
+
if (path === undefined ||
|
|
64
|
+
(path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&
|
|
65
|
+
path.charCodeAt(2) === CHAR_BACKWARD_SLASH)) {
|
|
66
|
+
path = `${resolvedDevice}\\`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const len = path.length;
|
|
70
|
+
let rootEnd = 0;
|
|
71
|
+
let device = '';
|
|
72
|
+
let isAbsolute = false;
|
|
73
|
+
const code = path.charCodeAt(0);
|
|
74
|
+
if (len === 1) {
|
|
75
|
+
if (isPathSeparatorWin(code)) {
|
|
76
|
+
rootEnd = 1;
|
|
77
|
+
isAbsolute = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (isPathSeparatorWin(code)) {
|
|
81
|
+
isAbsolute = true;
|
|
82
|
+
if (isPathSeparatorWin(path.charCodeAt(1))) {
|
|
83
|
+
// UNC path: `\\server\share\…`
|
|
84
|
+
let j = 2;
|
|
85
|
+
let last = j;
|
|
86
|
+
while (j < len && !isPathSeparatorWin(path.charCodeAt(j)))
|
|
87
|
+
j++;
|
|
88
|
+
if (j < len && j !== last) {
|
|
89
|
+
const firstPart = path.slice(last, j);
|
|
90
|
+
last = j;
|
|
91
|
+
while (j < len && isPathSeparatorWin(path.charCodeAt(j)))
|
|
92
|
+
j++;
|
|
93
|
+
if (j < len && j !== last) {
|
|
94
|
+
last = j;
|
|
95
|
+
while (j < len && !isPathSeparatorWin(path.charCodeAt(j)))
|
|
96
|
+
j++;
|
|
97
|
+
if (j === len || j !== last) {
|
|
98
|
+
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
|
99
|
+
rootEnd = j;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
rootEnd = 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {
|
|
109
|
+
device = path.slice(0, 2);
|
|
110
|
+
rootEnd = 2;
|
|
111
|
+
if (len > 2 && isPathSeparatorWin(path.charCodeAt(2))) {
|
|
112
|
+
isAbsolute = true;
|
|
113
|
+
rootEnd = 3;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (device.length > 0) {
|
|
117
|
+
if (resolvedDevice.length > 0) {
|
|
118
|
+
if (device.toLowerCase() !== resolvedDevice.toLowerCase())
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
resolvedDevice = device;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (resolvedAbsolute) {
|
|
126
|
+
if (resolvedDevice.length > 0)
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
|
|
131
|
+
resolvedAbsolute = isAbsolute;
|
|
132
|
+
if (isAbsolute && resolvedDevice.length > 0)
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\', isPathSeparatorWin);
|
|
137
|
+
return resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail || '.';
|
|
138
|
+
}
|
|
4
139
|
function isPosixPathSeparator(code) {
|
|
5
140
|
return code === CHAR_FORWARD_SLASH;
|
|
6
141
|
}
|
|
@@ -78,6 +213,13 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
|
|
|
78
213
|
return res;
|
|
79
214
|
}
|
|
80
215
|
export function resolve(...args) {
|
|
216
|
+
// On Windows, host paths are `D:\…` style. The POSIX-only resolver
|
|
217
|
+
// below treats `D` as a non-`/` character and produces garbage; route
|
|
218
|
+
// to the Windows-aware variant. POSIX hosts (Linux/macOS/browser)
|
|
219
|
+
// run the original code path unchanged — `_isWin32` is constant-folded
|
|
220
|
+
// away on those targets.
|
|
221
|
+
if (_isWin32)
|
|
222
|
+
return resolveWin32(args);
|
|
81
223
|
let resolvedPath = '';
|
|
82
224
|
let resolvedAbsolute = false;
|
|
83
225
|
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { _WebAssembly } from "../webassembly.mjs";
|
|
2
2
|
import { resolve } from "./path.mjs";
|
|
3
|
+
// Linux fcntl flag bits ↔ Windows libuv flag bits. `pathOpen()` builds
|
|
4
|
+
// `flagsRes` using Linux constants (O_CREAT=0x40, O_EXCL=0x80,
|
|
5
|
+
// O_APPEND=0x400). Windows libuv expects different bits (O_CREAT=0x100,
|
|
6
|
+
// O_EXCL=0x400, O_APPEND=0x8). Without translation,
|
|
7
|
+
// `fs.openSync(path, 0x241 /* L:WRONLY|CREAT|TRUNC */)` is rejected
|
|
8
|
+
// with EINVAL because Linux's 0x40 happens to mean O_TEMPORARY on
|
|
9
|
+
// Windows — and O_TEMPORARY without O_CREAT is invalid.
|
|
10
|
+
const _isWin32Flags = typeof process !== 'undefined' && process.platform === 'win32';
|
|
11
|
+
function _toWinOpenFlags(f) {
|
|
12
|
+
let r = f & 3; // RDONLY/WRONLY/RDWR — same on both
|
|
13
|
+
if ((f & 0x40) !== 0)
|
|
14
|
+
r |= 0x100; // O_CREAT: Linux 0x40 -> Windows 0x100
|
|
15
|
+
if ((f & 0x80) !== 0)
|
|
16
|
+
r |= 0x400; // O_EXCL: Linux 0x80 -> Windows 0x400
|
|
17
|
+
if ((f & 0x200) !== 0)
|
|
18
|
+
r |= 0x200; // O_TRUNC: same value on both
|
|
19
|
+
if ((f & 0x400) !== 0)
|
|
20
|
+
r |= 0x8; // O_APPEND: Linux 0x400 -> Windows 0x8
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
3
23
|
import { WasiErrno, WasiRights, FileControlFlag, WasiFileControlFlag, WasiFdFlag, WasiFileType, WasiClockid, WasiFstFlag, WasiEventType, WasiSubclockflags } from "./types.mjs";
|
|
4
24
|
import { concatBuffer, toFileStat, AsyncTable, SyncTable } from "./fd.mjs";
|
|
5
25
|
import { WasiError } from "./error.mjs";
|
|
@@ -65,26 +85,43 @@ function defineName(name, f) {
|
|
|
65
85
|
Object.defineProperty(f, 'name', { value: name });
|
|
66
86
|
return f;
|
|
67
87
|
}
|
|
88
|
+
function tryCall(f, wasi, args) {
|
|
89
|
+
let r;
|
|
90
|
+
try {
|
|
91
|
+
r = f.apply(wasi, args);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
return handleError(err);
|
|
95
|
+
}
|
|
96
|
+
if (isPromiseLike(r)) {
|
|
97
|
+
return r.then(_ => _, handleError);
|
|
98
|
+
}
|
|
99
|
+
return r;
|
|
100
|
+
}
|
|
68
101
|
function syscallWrap(self, name, f) {
|
|
69
|
-
|
|
70
|
-
|
|
102
|
+
let debug = false;
|
|
103
|
+
const NODE_DEBUG_NATIVE = (() => {
|
|
104
|
+
try {
|
|
105
|
+
return process.env.NODE_DEBUG_NATIVE;
|
|
106
|
+
}
|
|
107
|
+
catch (_) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
if (typeof NODE_DEBUG_NATIVE === 'string' && NODE_DEBUG_NATIVE.split(',').includes('wasi')) {
|
|
112
|
+
debug = true;
|
|
113
|
+
}
|
|
114
|
+
return debug
|
|
115
|
+
? defineName(name, function () {
|
|
71
116
|
const args = Array.prototype.slice.call(arguments);
|
|
72
117
|
let debugArgs = [`${name}(${Array.from({ length: arguments.length }).map(() => '%d').join(', ')})`];
|
|
73
118
|
debugArgs = debugArgs.concat(args);
|
|
74
119
|
console.debug.apply(console, debugArgs);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
return handleError(err);
|
|
82
|
-
}
|
|
83
|
-
if (isPromiseLike(r)) {
|
|
84
|
-
return r.then(_ => _, handleError);
|
|
85
|
-
}
|
|
86
|
-
return r;
|
|
87
|
-
});
|
|
120
|
+
return tryCall(f, self, args);
|
|
121
|
+
})
|
|
122
|
+
: defineName(name, function () {
|
|
123
|
+
return tryCall(f, self, arguments);
|
|
124
|
+
});
|
|
88
125
|
}
|
|
89
126
|
function resolvePathSync(fs, fileDescriptor, path, flags) {
|
|
90
127
|
let resolvedPath = resolve(fileDescriptor.realPath, path);
|
|
@@ -230,7 +267,7 @@ export class WASI {
|
|
|
230
267
|
case WasiClockid.MONOTONIC:
|
|
231
268
|
case WasiClockid.PROCESS_CPUTIME_ID:
|
|
232
269
|
case WasiClockid.THREAD_CPUTIME_ID: {
|
|
233
|
-
const t = performance.now();
|
|
270
|
+
const t = performance.now() / 1000;
|
|
234
271
|
const s = Math.trunc(t);
|
|
235
272
|
const ms = Math.floor((t - s) * 1000);
|
|
236
273
|
const result = BigInt(s) * BigInt(1000000000) + BigInt(ms) * BigInt(1000000);
|
|
@@ -1246,9 +1283,11 @@ export class WASI {
|
|
|
1246
1283
|
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
1247
1284
|
const fs = getFs(this);
|
|
1248
1285
|
const resolved_path = resolvePathSync(fs, fileDescriptor, pathString, dirflags);
|
|
1249
|
-
const r = fs.openSync(resolved_path, flagsRes, 0o666);
|
|
1286
|
+
const r = fs.openSync(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666);
|
|
1250
1287
|
const filetype = wasi.fds.getFileTypeByFd(r);
|
|
1251
|
-
if ((
|
|
1288
|
+
if ((filetype !== WasiFileType.DIRECTORY) &&
|
|
1289
|
+
((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 ||
|
|
1290
|
+
(resolved_path.endsWith('/')))) {
|
|
1252
1291
|
return WasiErrno.ENOTDIR;
|
|
1253
1292
|
}
|
|
1254
1293
|
const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r, flagsRes, filetype);
|
|
@@ -1280,7 +1319,7 @@ export class WASI {
|
|
|
1280
1319
|
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
1281
1320
|
const fs = getFs(this);
|
|
1282
1321
|
const resolved_path = await resolvePathAsync(fs, fileDescriptor, pathString, dirflags);
|
|
1283
|
-
const r = await fs.promises.open(resolved_path, flagsRes, 0o666);
|
|
1322
|
+
const r = await fs.promises.open(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666);
|
|
1284
1323
|
const filetype = await wasi.fds.getFileTypeByFd(r);
|
|
1285
1324
|
if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 && filetype !== WasiFileType.DIRECTORY) {
|
|
1286
1325
|
return WasiErrno.ENOTDIR;
|
|
@@ -1437,6 +1476,9 @@ export class WASI {
|
|
|
1437
1476
|
const wasi = _wasi.get(this);
|
|
1438
1477
|
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
|
|
1439
1478
|
const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
|
|
1479
|
+
if (oldPath.length > 0 && oldPath[0] === '/') {
|
|
1480
|
+
return WasiErrno.EPERM;
|
|
1481
|
+
}
|
|
1440
1482
|
let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
|
|
1441
1483
|
newPath = resolve(fileDescriptor.realPath, newPath);
|
|
1442
1484
|
const fs = getFs(this);
|
|
@@ -263,10 +263,19 @@ var __setModuleDefault = Object.create ? (function(o, v) {
|
|
|
263
263
|
o["default"] = v;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
+
var ownKeys = function(o) {
|
|
267
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
268
|
+
var ar = [];
|
|
269
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
270
|
+
return ar;
|
|
271
|
+
};
|
|
272
|
+
return ownKeys(o);
|
|
273
|
+
};
|
|
274
|
+
|
|
266
275
|
export function __importStar(mod) {
|
|
267
276
|
if (mod && mod.__esModule) return mod;
|
|
268
277
|
var result = {};
|
|
269
|
-
if (mod != null) for (var k
|
|
278
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
270
279
|
__setModuleDefault(result, mod);
|
|
271
280
|
return result;
|
|
272
281
|
}
|
|
@@ -263,10 +263,19 @@ var __setModuleDefault = Object.create ? (function(o, v) {
|
|
|
263
263
|
o["default"] = v;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
+
var ownKeys = function(o) {
|
|
267
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
268
|
+
var ar = [];
|
|
269
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
270
|
+
return ar;
|
|
271
|
+
};
|
|
272
|
+
return ownKeys(o);
|
|
273
|
+
};
|
|
274
|
+
|
|
266
275
|
export function __importStar(mod) {
|
|
267
276
|
if (mod && mod.__esModule) return mod;
|
|
268
277
|
var result = {};
|
|
269
|
-
if (mod != null) for (var k
|
|
278
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
270
279
|
__setModuleDefault(result, mod);
|
|
271
280
|
return result;
|
|
272
281
|
}
|
|
@@ -312,10 +312,19 @@ var __rewriteRelativeImportExtension;
|
|
|
312
312
|
o["default"] = v;
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
+
var ownKeys = function(o) {
|
|
316
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
317
|
+
var ar = [];
|
|
318
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
319
|
+
return ar;
|
|
320
|
+
};
|
|
321
|
+
return ownKeys(o);
|
|
322
|
+
};
|
|
323
|
+
|
|
315
324
|
__importStar = function (mod) {
|
|
316
325
|
if (mod && mod.__esModule) return mod;
|
|
317
326
|
var result = {};
|
|
318
|
-
if (mod != null) for (var k
|
|
327
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
319
328
|
__setModuleDefault(result, mod);
|
|
320
329
|
return result;
|
|
321
330
|
};
|
|
@@ -440,36 +449,36 @@ var __rewriteRelativeImportExtension;
|
|
|
440
449
|
});
|
|
441
450
|
|
|
442
451
|
0 && (module.exports = {
|
|
443
|
-
__extends,
|
|
444
|
-
__assign,
|
|
445
|
-
__rest,
|
|
446
|
-
__decorate,
|
|
447
|
-
__param,
|
|
448
|
-
__esDecorate,
|
|
449
|
-
__runInitializers,
|
|
450
|
-
__propKey,
|
|
451
|
-
__setFunctionName,
|
|
452
|
-
__metadata,
|
|
453
|
-
__awaiter,
|
|
454
|
-
__generator,
|
|
455
|
-
__exportStar,
|
|
456
|
-
__createBinding,
|
|
457
|
-
__values,
|
|
458
|
-
__read,
|
|
459
|
-
__spread,
|
|
460
|
-
__spreadArrays,
|
|
461
|
-
__spreadArray,
|
|
462
|
-
__await,
|
|
463
|
-
__asyncGenerator,
|
|
464
|
-
__asyncDelegator,
|
|
465
|
-
__asyncValues,
|
|
466
|
-
__makeTemplateObject,
|
|
467
|
-
__importStar,
|
|
468
|
-
__importDefault,
|
|
469
|
-
__classPrivateFieldGet,
|
|
470
|
-
__classPrivateFieldSet,
|
|
471
|
-
__classPrivateFieldIn,
|
|
472
|
-
__addDisposableResource,
|
|
473
|
-
__disposeResources,
|
|
474
|
-
__rewriteRelativeImportExtension,
|
|
452
|
+
__extends: __extends,
|
|
453
|
+
__assign: __assign,
|
|
454
|
+
__rest: __rest,
|
|
455
|
+
__decorate: __decorate,
|
|
456
|
+
__param: __param,
|
|
457
|
+
__esDecorate: __esDecorate,
|
|
458
|
+
__runInitializers: __runInitializers,
|
|
459
|
+
__propKey: __propKey,
|
|
460
|
+
__setFunctionName: __setFunctionName,
|
|
461
|
+
__metadata: __metadata,
|
|
462
|
+
__awaiter: __awaiter,
|
|
463
|
+
__generator: __generator,
|
|
464
|
+
__exportStar: __exportStar,
|
|
465
|
+
__createBinding: __createBinding,
|
|
466
|
+
__values: __values,
|
|
467
|
+
__read: __read,
|
|
468
|
+
__spread: __spread,
|
|
469
|
+
__spreadArrays: __spreadArrays,
|
|
470
|
+
__spreadArray: __spreadArray,
|
|
471
|
+
__await: __await,
|
|
472
|
+
__asyncGenerator: __asyncGenerator,
|
|
473
|
+
__asyncDelegator: __asyncDelegator,
|
|
474
|
+
__asyncValues: __asyncValues,
|
|
475
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
476
|
+
__importStar: __importStar,
|
|
477
|
+
__importDefault: __importDefault,
|
|
478
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
479
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
480
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
481
|
+
__addDisposableResource: __addDisposableResource,
|
|
482
|
+
__disposeResources: __disposeResources,
|
|
483
|
+
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
|
|
475
484
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/oxide-wasm32-wasi",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.bdcd708",
|
|
4
4
|
"cpu": [
|
|
5
5
|
"wasm32"
|
|
6
6
|
],
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"browser": "tailwindcss-oxide.wasi-browser.js",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@napi-rs/wasm-runtime": "^
|
|
31
|
-
"@emnapi/core": "^1.
|
|
32
|
-
"@emnapi/runtime": "^1.
|
|
33
|
-
"@tybys/wasm-util": "^0.
|
|
34
|
-
"@emnapi/wasi-threads": "^1.
|
|
35
|
-
"tslib": "^2.8.
|
|
30
|
+
"@napi-rs/wasm-runtime": "^1.1.4",
|
|
31
|
+
"@emnapi/core": "^1.11.1",
|
|
32
|
+
"@emnapi/runtime": "^1.11.1",
|
|
33
|
+
"@tybys/wasm-util": "^0.10.2",
|
|
34
|
+
"@emnapi/wasi-threads": "^1.2.2",
|
|
35
|
+
"tslib": "^2.8.1"
|
|
36
36
|
},
|
|
37
37
|
"bundledDependencies": [
|
|
38
38
|
"@napi-rs/wasm-runtime",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
3
3
|
getDefaultContext as __emnapiGetDefaultContext,
|
|
4
|
+
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
|
|
4
5
|
WASI as __WASI,
|
|
5
|
-
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
6
6
|
} from '@napi-rs/wasm-runtime'
|
|
7
7
|
import { memfs } from '@napi-rs/wasm-runtime/fs'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
|
|
10
10
|
export const { fs: __fs, vol: __volume } = memfs()
|
|
11
11
|
|
|
@@ -17,8 +17,10 @@ const __wasi = new __WASI({
|
|
|
17
17
|
},
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
+
const __wasmUrl = new URL('./tailwindcss-oxide.wasm32-wasi.wasm', import.meta.url).href
|
|
20
21
|
const __emnapiContext = __emnapiGetDefaultContext()
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
const __sharedMemory = new WebAssembly.Memory({
|
|
23
25
|
initial: 16384,
|
|
24
26
|
maximum: 65536,
|
|
@@ -41,6 +43,7 @@ const {
|
|
|
41
43
|
})
|
|
42
44
|
worker.addEventListener('message', __wasmCreateOnMessageForFsProxy(__fs))
|
|
43
45
|
|
|
46
|
+
|
|
44
47
|
return worker
|
|
45
48
|
},
|
|
46
49
|
overwriteImports(importObject) {
|
|
@@ -60,4 +63,5 @@ const {
|
|
|
60
63
|
}
|
|
61
64
|
},
|
|
62
65
|
})
|
|
66
|
+
export default __napiModule.exports
|
|
63
67
|
export const Scanner = __napiModule.exports.Scanner
|
|
@@ -9,9 +9,9 @@ const { WASI: __nodeWASI } = require('node:wasi')
|
|
|
9
9
|
const { Worker } = require('node:worker_threads')
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
|
-
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
|
13
|
-
getDefaultContext: __emnapiGetDefaultContext,
|
|
14
12
|
createOnMessage: __wasmCreateOnMessageForFsProxy,
|
|
13
|
+
getDefaultContext: __emnapiGetDefaultContext,
|
|
14
|
+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
|
15
15
|
} = require('@napi-rs/wasm-runtime')
|
|
16
16
|
|
|
17
17
|
const __rootDir = __nodePath.parse(process.cwd()).root
|
|
@@ -39,7 +39,7 @@ if (__nodeFs.existsSync(__wasmDebugFilePath)) {
|
|
|
39
39
|
__wasmFilePath = __wasmDebugFilePath
|
|
40
40
|
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
|
|
41
41
|
try {
|
|
42
|
-
__wasmFilePath =
|
|
42
|
+
__wasmFilePath = require.resolve('@tailwindcss/oxide-wasm32-wasi/tailwindcss-oxide.wasm32-wasi.wasm')
|
|
43
43
|
} catch {
|
|
44
44
|
throw new Error('Cannot find tailwindcss-oxide.wasm32-wasi.wasm file, and @tailwindcss/oxide-wasm32-wasi package is not installed.')
|
|
45
45
|
}
|
|
@@ -65,6 +65,29 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
65
65
|
worker.onmessage = ({ data }) => {
|
|
66
66
|
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
// The main thread of Node.js waits for all the active handles before exiting.
|
|
70
|
+
// But Rust threads are never waited without `thread::join`.
|
|
71
|
+
// So here we hack the code of Node.js to prevent the workers from being referenced (active).
|
|
72
|
+
// According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415,
|
|
73
|
+
// a worker is consist of two handles: kPublicPort and kHandle.
|
|
74
|
+
{
|
|
75
|
+
const kPublicPort = Object.getOwnPropertySymbols(worker).find(s =>
|
|
76
|
+
s.toString().includes("kPublicPort")
|
|
77
|
+
);
|
|
78
|
+
if (kPublicPort) {
|
|
79
|
+
worker[kPublicPort].ref = () => {};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
|
|
83
|
+
s.toString().includes("kHandle")
|
|
84
|
+
);
|
|
85
|
+
if (kHandle) {
|
|
86
|
+
worker[kHandle].ref = () => {};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
worker.unref();
|
|
90
|
+
}
|
|
68
91
|
return worker
|
|
69
92
|
},
|
|
70
93
|
overwriteImports(importObject) {
|
|
@@ -84,5 +107,5 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
|
|
|
84
107
|
}
|
|
85
108
|
},
|
|
86
109
|
})
|
|
87
|
-
|
|
110
|
+
module.exports = __napiModule.exports
|
|
88
111
|
module.exports.Scanner = __napiModule.exports.Scanner
|
|
Binary file
|
package/wasi-worker-browser.mjs
CHANGED
|
@@ -17,6 +17,7 @@ const handler = new MessageHandler({
|
|
|
17
17
|
printErr: function() {
|
|
18
18
|
// eslint-disable-next-line no-console
|
|
19
19
|
console.error.apply(console, arguments)
|
|
20
|
+
|
|
20
21
|
},
|
|
21
22
|
})
|
|
22
23
|
return instantiateNapiModuleSync(wasmModule, {
|
|
@@ -32,6 +33,7 @@ const handler = new MessageHandler({
|
|
|
32
33
|
},
|
|
33
34
|
})
|
|
34
35
|
},
|
|
36
|
+
|
|
35
37
|
})
|
|
36
38
|
|
|
37
39
|
globalThis.onmessage = function (e) {
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020-present LongYinan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
MIT License
|
|
24
|
-
|
|
25
|
-
Copyright (c) 2018 GitHub
|
|
26
|
-
|
|
27
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
-
in the Software without restriction, including without limitation the rights
|
|
30
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
-
furnished to do so, subject to the following conditions:
|
|
33
|
-
|
|
34
|
-
The above copyright notice and this permission notice shall be included in all
|
|
35
|
-
copies or substantial portions of the Software.
|
|
36
|
-
|
|
37
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
-
SOFTWARE.
|