@secure-exec/browser 0.2.0-rc.1 → 0.2.0-rc.2

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.
@@ -5,7 +5,7 @@
5
5
  * extensions (symlinks, hard links, chmod, chown, utimes, truncate)
6
6
  * needed by the kernel VFS interface.
7
7
  */
8
- import type { VirtualFileSystem, VirtualStat, VirtualDirEntry } from "@secure-exec/core";
8
+ import type { VirtualDirEntry, VirtualFileSystem, VirtualStat } from "@secure-exec/core";
9
9
  export declare class InMemoryFileSystem implements VirtualFileSystem {
10
10
  private entries;
11
11
  constructor();
@@ -87,9 +87,7 @@ export class InMemoryFileSystem {
87
87
  const normalized = normalizePath(path);
88
88
  // Ensure parent exists
89
89
  await this.mkdir(dirname(normalized), { recursive: true });
90
- const data = typeof content === "string"
91
- ? new TextEncoder().encode(content)
92
- : content;
90
+ const data = typeof content === "string" ? new TextEncoder().encode(content) : content;
93
91
  const existing = this.entries.get(normalized);
94
92
  if (existing && existing.type === "file") {
95
93
  existing.data = data;
@@ -210,9 +208,7 @@ export class InMemoryFileSystem {
210
208
  this.entries.delete(key);
211
209
  }
212
210
  for (const [key, val] of toMove) {
213
- const newKey = key === oldResolved
214
- ? newNorm
215
- : newNorm + key.slice(oldResolved.length);
211
+ const newKey = key === oldResolved ? newNorm : newNorm + key.slice(oldResolved.length);
216
212
  this.entries.set(newKey, val);
217
213
  }
218
214
  }
@@ -270,8 +266,13 @@ export class InMemoryFileSystem {
270
266
  const entry = this.resolveEntry(path);
271
267
  if (!entry)
272
268
  throw this.enoent("chmod", path);
273
- // Preserve file type bits, update permission bits
274
- entry.mode = (entry.mode & 0o170000) | (mode & 0o7777);
269
+ const callerTypeBits = mode & 0o170000;
270
+ if (callerTypeBits !== 0) {
271
+ entry.mode = mode;
272
+ }
273
+ else {
274
+ entry.mode = (entry.mode & 0o170000) | (mode & 0o7777);
275
+ }
275
276
  entry.ctimeMs = Date.now();
276
277
  }
277
278
  async chown(path, uid, gid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secure-exec/browser",
3
- "version": "0.2.0-rc.1",
3
+ "version": "0.2.0-rc.2",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "sucrase": "^3.35.0",
56
- "@secure-exec/core": "0.2.0-rc.1"
56
+ "@secure-exec/core": "0.2.0-rc.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node": "^22.10.2",