@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.cbe0669 → 0.0.0-insiders.ce0e775

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 (30) hide show
  1. package/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +1 -1
  2. package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -1
  3. package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +1 -1
  4. package/node_modules/@emnapi/core/dist/emnapi-core.js +13 -8
  5. package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -1
  6. package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -1
  7. package/node_modules/@emnapi/core/dist/emnapi-core.mjs +1 -1
  8. package/node_modules/@emnapi/core/package.json +2 -2
  9. package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1 -1
  10. package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -1
  11. package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1 -1
  12. package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1 -1
  13. package/node_modules/@emnapi/runtime/dist/emnapi.js +1 -1
  14. package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -1
  15. package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -1
  16. package/node_modules/@emnapi/runtime/dist/emnapi.mjs +1 -1
  17. package/node_modules/@emnapi/runtime/package.json +1 -1
  18. package/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +6 -0
  19. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +19 -16
  20. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +19 -16
  21. package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -1
  22. package/node_modules/@tybys/wasm-util/dist/wasm-util.js +19 -16
  23. package/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -1
  24. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +12 -14
  25. package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +7 -2
  26. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +12 -14
  27. package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +7 -2
  28. package/node_modules/@tybys/wasm-util/package.json +1 -1
  29. package/package.json +4 -4
  30. package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
@@ -233,7 +233,7 @@ class WASI {
233
233
  case types_1.WasiClockid.MONOTONIC:
234
234
  case types_1.WasiClockid.PROCESS_CPUTIME_ID:
235
235
  case types_1.WasiClockid.THREAD_CPUTIME_ID: {
236
- const t = performance.now();
236
+ const t = performance.now() / 1000;
237
237
  const s = Math.trunc(t);
238
238
  const ms = Math.floor((t - s) * 1000);
239
239
  const result = BigInt(s) * BigInt(1000000000) + BigInt(ms) * BigInt(1000000);
@@ -1251,7 +1251,9 @@ class WASI {
1251
1251
  const resolved_path = resolvePathSync(fs, fileDescriptor, pathString, dirflags);
1252
1252
  const r = fs.openSync(resolved_path, flagsRes, 0o666);
1253
1253
  const filetype = wasi.fds.getFileTypeByFd(r);
1254
- if ((o_flags & types_1.WasiFileControlFlag.O_DIRECTORY) !== 0 && filetype !== types_1.WasiFileType.DIRECTORY) {
1254
+ if ((filetype !== types_1.WasiFileType.DIRECTORY) &&
1255
+ ((o_flags & types_1.WasiFileControlFlag.O_DIRECTORY) !== 0 ||
1256
+ (resolved_path.endsWith('/')))) {
1255
1257
  return types_1.WasiErrno.ENOTDIR;
1256
1258
  }
1257
1259
  const { base: max_base, inheriting: max_inheriting } = (0, rights_1.getRights)(wasi.fds.stdio, r, flagsRes, filetype);
@@ -1440,6 +1442,9 @@ class WASI {
1440
1442
  const wasi = _wasi.get(this);
1441
1443
  const fileDescriptor = wasi.fds.get(fd, types_1.WasiRights.PATH_SYMLINK, BigInt(0));
1442
1444
  const oldPath = decoder.decode((0, util_1.unsharedSlice)(HEAPU8, old_path, old_path + old_path_len));
1445
+ if (oldPath.length > 0 && oldPath[0] === '/') {
1446
+ return types_1.WasiErrno.EPERM;
1447
+ }
1443
1448
  let newPath = decoder.decode((0, util_1.unsharedSlice)(HEAPU8, new_path, new_path + new_path_len));
1444
1449
  newPath = (0, path_1.resolve)(fileDescriptor.realPath, newPath);
1445
1450
  const fs = getFs(this);
@@ -7,12 +7,6 @@ const kSetMemory = Symbol('kSetMemory');
7
7
  const kStarted = Symbol('kStarted');
8
8
  const kInstance = Symbol('kInstance');
9
9
  const kBindingName = Symbol('kBindingName');
10
- function setupInstance(self, instance) {
11
- validateObject(instance, 'instance');
12
- validateObject(instance.exports, 'instance.exports');
13
- self[kInstance] = instance;
14
- self[kSetMemory](instance.exports.memory);
15
- }
16
10
  function validateOptions(options) {
17
11
  var _a;
18
12
  validateObject(options, 'options');
@@ -117,13 +111,21 @@ export class WASI {
117
111
  wrap.proc_exit = wasiReturnOnProcExit.bind(this);
118
112
  }
119
113
  }
120
- // Must not export _initialize, must export _start
121
- start(instance) {
114
+ finalizeBindings(instance, _a) {
115
+ var _b;
116
+ var { memory = (_b = instance === null || instance === void 0 ? void 0 : instance.exports) === null || _b === void 0 ? void 0 : _b.memory } = _a === void 0 ? {} : _a;
122
117
  if (this[kStarted]) {
123
118
  throw new Error('WASI instance has already started');
124
119
  }
120
+ validateObject(instance, 'instance');
121
+ validateObject(instance.exports, 'instance.exports');
122
+ this[kSetMemory](memory);
123
+ this[kInstance] = instance;
125
124
  this[kStarted] = true;
126
- setupInstance(this, instance);
125
+ }
126
+ // Must not export _initialize, must export _start
127
+ start(instance) {
128
+ this.finalizeBindings(instance);
127
129
  const { _start, _initialize } = this[kInstance].exports;
128
130
  validateFunction(_start, 'instance.exports._start');
129
131
  validateUndefined(_initialize, 'instance.exports._initialize');
@@ -148,11 +150,7 @@ export class WASI {
148
150
  }
149
151
  // Must not export _start, may optionally export _initialize
150
152
  initialize(instance) {
151
- if (this[kStarted]) {
152
- throw new Error('WASI instance has already started');
153
- }
154
- this[kStarted] = true;
155
- setupInstance(this, instance);
153
+ this.finalizeBindings(instance);
156
154
  const { _start, _initialize } = this[kInstance].exports;
157
155
  validateUndefined(_start, 'instance.exports._start');
158
156
  if (_initialize !== undefined) {
@@ -230,7 +230,7 @@ export class WASI {
230
230
  case WasiClockid.MONOTONIC:
231
231
  case WasiClockid.PROCESS_CPUTIME_ID:
232
232
  case WasiClockid.THREAD_CPUTIME_ID: {
233
- const t = performance.now();
233
+ const t = performance.now() / 1000;
234
234
  const s = Math.trunc(t);
235
235
  const ms = Math.floor((t - s) * 1000);
236
236
  const result = BigInt(s) * BigInt(1000000000) + BigInt(ms) * BigInt(1000000);
@@ -1248,7 +1248,9 @@ export class WASI {
1248
1248
  const resolved_path = resolvePathSync(fs, fileDescriptor, pathString, dirflags);
1249
1249
  const r = fs.openSync(resolved_path, flagsRes, 0o666);
1250
1250
  const filetype = wasi.fds.getFileTypeByFd(r);
1251
- if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 && filetype !== WasiFileType.DIRECTORY) {
1251
+ if ((filetype !== WasiFileType.DIRECTORY) &&
1252
+ ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 ||
1253
+ (resolved_path.endsWith('/')))) {
1252
1254
  return WasiErrno.ENOTDIR;
1253
1255
  }
1254
1256
  const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r, flagsRes, filetype);
@@ -1437,6 +1439,9 @@ export class WASI {
1437
1439
  const wasi = _wasi.get(this);
1438
1440
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
1439
1441
  const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
1442
+ if (oldPath.length > 0 && oldPath[0] === '/') {
1443
+ return WasiErrno.EPERM;
1444
+ }
1440
1445
  let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
1441
1446
  newPath = resolve(fileDescriptor.realPath, newPath);
1442
1447
  const fs = getFs(this);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tybys/wasm-util",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "WASI polyfill for browser and some wasm util",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./dist/wasm-util.esm-bundler.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss/oxide-wasm32-wasi",
3
- "version": "0.0.0-insiders.cbe0669",
3
+ "version": "0.0.0-insiders.ce0e775",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
@@ -28,9 +28,9 @@
28
28
  "browser": "tailwindcss-oxide.wasi-browser.js",
29
29
  "dependencies": {
30
30
  "@napi-rs/wasm-runtime": "^0.2.11",
31
- "@emnapi/core": "^1.4.3",
32
- "@emnapi/runtime": "^1.4.3",
33
- "@tybys/wasm-util": "^0.9.0",
31
+ "@emnapi/core": "^1.4.4",
32
+ "@emnapi/runtime": "^1.4.4",
33
+ "@tybys/wasm-util": "^0.10.0",
34
34
  "@emnapi/wasi-threads": "^1.0.3",
35
35
  "tslib": "^2.8.0"
36
36
  },
Binary file