@tscircuit/cli 0.1.2057 → 0.1.2058

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/cli/main.js CHANGED
@@ -153438,7 +153438,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
153438
153438
  // lib/getVersion.ts
153439
153439
  import { createRequire as createRequire2 } from "node:module";
153440
153440
  // package.json
153441
- var version = "0.1.2056";
153441
+ var version = "0.1.2057";
153442
153442
  var package_default = {
153443
153443
  name: "@tscircuit/cli",
153444
153444
  version,
@@ -366471,8 +366471,12 @@ import {
366471
366471
  import looksSame from "@tscircuit/image-utils/looks-same";
366472
366472
  import fs72 from "node:fs/promises";
366473
366473
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath, createDiff = true) => {
366474
- const b1 = Buffer.from(buffer1);
366475
- const b2 = Buffer.from(buffer2);
366474
+ if (Buffer.from(buffer1).equals(Buffer.from(buffer2))) {
366475
+ return { equal: true };
366476
+ }
366477
+ const toImageBuffer = (buffer) => Buffer.from(diffPath.endsWith(".svg") ? convertSvgToPngBuffer(Buffer.from(buffer).toString("utf8")) : buffer);
366478
+ const b1 = toImageBuffer(buffer1);
366479
+ const b2 = toImageBuffer(buffer2);
366476
366480
  const { equal } = await looksSame(b1, b2, {
366477
366481
  strict: false,
366478
366482
  tolerance: 2
@@ -366697,12 +366701,14 @@ var processSnapshotFile = async ({
366697
366701
  const oldContentBuffer = fs73.readFileSync(snapPath);
366698
366702
  let equal;
366699
366703
  let diffPath;
366700
- if (createDiff) {
366701
- diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
366702
- const comparison = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath, true);
366703
- equal = comparison.equal;
366704
- } else {
366704
+ if (update && !createDiff) {
366705
366705
  equal = oldContentBuffer.equals(newContentBuffer);
366706
+ } else {
366707
+ const comparisonPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
366708
+ if (createDiff)
366709
+ diffPath = comparisonPath;
366710
+ const comparison = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, comparisonPath, createDiff);
366711
+ equal = comparison.equal;
366706
366712
  }
366707
366713
  if (update) {
366708
366714
  if (!forceUpdate && equal) {
@@ -4138,8 +4138,12 @@ var getSimulationSvgAssetsFromCircuitJson = (circuitJson) => {
4138
4138
  import looksSame from "@tscircuit/image-utils/looks-same";
4139
4139
  import fs8 from "node:fs/promises";
4140
4140
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath, createDiff = true) => {
4141
- const b1 = Buffer.from(buffer1);
4142
- const b2 = Buffer.from(buffer2);
4141
+ if (Buffer.from(buffer1).equals(Buffer.from(buffer2))) {
4142
+ return { equal: true };
4143
+ }
4144
+ const toImageBuffer = (buffer) => Buffer.from(diffPath.endsWith(".svg") ? convertSvgToPngBuffer(Buffer.from(buffer).toString("utf8")) : buffer);
4145
+ const b1 = toImageBuffer(buffer1);
4146
+ const b2 = toImageBuffer(buffer2);
4143
4147
  const { equal } = await looksSame(b1, b2, {
4144
4148
  strict: false,
4145
4149
  tolerance: 2
@@ -4370,12 +4374,14 @@ var processSnapshotFile = async ({
4370
4374
  const oldContentBuffer = fs9.readFileSync(snapPath);
4371
4375
  let equal;
4372
4376
  let diffPath;
4373
- if (createDiff) {
4374
- diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
4375
- const comparison = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath, true);
4376
- equal = comparison.equal;
4377
- } else {
4377
+ if (update && !createDiff) {
4378
4378
  equal = oldContentBuffer.equals(newContentBuffer);
4379
+ } else {
4380
+ const comparisonPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
4381
+ if (createDiff)
4382
+ diffPath = comparisonPath;
4383
+ const comparison = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, comparisonPath, createDiff);
4384
+ equal = comparison.equal;
4379
4385
  }
4380
4386
  if (update) {
4381
4387
  if (!forceUpdate && equal) {
package/dist/lib/index.js CHANGED
@@ -69109,7 +69109,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
69109
69109
  }));
69110
69110
  };
69111
69111
  // package.json
69112
- var version = "0.1.2056";
69112
+ var version = "0.1.2057";
69113
69113
  var package_default = {
69114
69114
  name: "@tscircuit/cli",
69115
69115
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2057",
3
+ "version": "0.1.2058",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"