sim 2.3.0-preview.325.1 → 2.3.0-preview.327.1

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/dist/index.js CHANGED
@@ -37779,7 +37779,11 @@ function readArgumentDescriptor(descriptor) {
37779
37779
  throw new SimApiError("JSON input exceeds 10 MiB", 0);
37780
37780
  chunks.push(Buffer.from(buffer.subarray(0, read)));
37781
37781
  }
37782
- return Buffer.concat(chunks).toString("utf8");
37782
+ return decodeArgumentBytes(Buffer.concat(chunks));
37783
+ }
37784
+ function decodeArgumentBytes(bytes) {
37785
+ const utf16le = bytes[0] === 255 && bytes[1] === 254;
37786
+ return new TextDecoder(utf16le ? "utf-16le" : "utf-8").decode(bytes);
37783
37787
  }
37784
37788
  function literalAtHint(error, path) {
37785
37789
  return error?.code === "ENOENT" ? `. To pass the literal value @${path}, write @@${path}` : "";
@@ -53721,7 +53725,7 @@ function isAlive(pid) {
53721
53725
  }
53722
53726
  }
53723
53727
  async function isStaleLock(lock, seen) {
53724
- const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text), () => null));
53728
+ const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text)).catch(() => null));
53725
53729
  if (typeof owner.pid === "number" && typeof owner.host === "string") {
53726
53730
  return owner.host === hostname() && !isAlive(owner.pid);
53727
53731
  }
package/dist/runtime.js CHANGED
@@ -37828,7 +37828,11 @@ function readArgumentDescriptor(descriptor) {
37828
37828
  throw new SimApiError("JSON input exceeds 10 MiB", 0);
37829
37829
  chunks.push(Buffer.from(buffer.subarray(0, read)));
37830
37830
  }
37831
- return Buffer.concat(chunks).toString("utf8");
37831
+ return decodeArgumentBytes(Buffer.concat(chunks));
37832
+ }
37833
+ function decodeArgumentBytes(bytes) {
37834
+ const utf16le = bytes[0] === 255 && bytes[1] === 254;
37835
+ return new TextDecoder(utf16le ? "utf-16le" : "utf-8").decode(bytes);
37832
37836
  }
37833
37837
  function literalAtHint(error, path) {
37834
37838
  return error?.code === "ENOENT" ? `. To pass the literal value @${path}, write @@${path}` : "";
@@ -53770,7 +53774,7 @@ function isAlive(pid) {
53770
53774
  }
53771
53775
  }
53772
53776
  async function isStaleLock(lock, seen) {
53773
- const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text), () => null));
53777
+ const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text)).catch(() => null));
53774
53778
  if (typeof owner.pid === "number" && typeof owner.host === "string") {
53775
53779
  return owner.host === hostname() && !isAlive(owner.pid);
53776
53780
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.3.0-preview.325.1",
3
+ "version": "2.3.0-preview.327.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {