@fern-api/fern-api-dev 3.55.6 → 3.55.7
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/cli.cjs +89 -64
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1661592,7 +1661592,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1661592
1661592
|
properties: {
|
|
1661593
1661593
|
...event,
|
|
1661594
1661594
|
...event.properties,
|
|
1661595
|
-
version: "3.55.
|
|
1661595
|
+
version: "3.55.7",
|
|
1661596
1661596
|
usingAccessToken: true
|
|
1661597
1661597
|
}
|
|
1661598
1661598
|
});
|
|
@@ -1661642,7 +1661642,7 @@ var UserPosthogManager = class {
|
|
|
1661642
1661642
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1661643
1661643
|
event: "CLI",
|
|
1661644
1661644
|
properties: {
|
|
1661645
|
-
version: "3.55.
|
|
1661645
|
+
version: "3.55.7",
|
|
1661646
1661646
|
...event,
|
|
1661647
1661647
|
...event.properties,
|
|
1661648
1661648
|
usingAccessToken: false,
|
|
@@ -1693560,7 +1693560,7 @@ var CliContext = class {
|
|
|
1693560
1693560
|
if (false) {
|
|
1693561
1693561
|
this.logger.error("CLI_VERSION is not defined");
|
|
1693562
1693562
|
}
|
|
1693563
|
-
return "3.55.
|
|
1693563
|
+
return "3.55.7";
|
|
1693564
1693564
|
}
|
|
1693565
1693565
|
getCliName() {
|
|
1693566
1693566
|
if (false) {
|
|
@@ -1696673,7 +1696673,7 @@ var import_path54 = __toESM(require("path"), 1);
|
|
|
1696673
1696673
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1696674
1696674
|
var LOGS_FOLDER_NAME = "logs";
|
|
1696675
1696675
|
function getCliSource() {
|
|
1696676
|
-
const version7 = "3.55.
|
|
1696676
|
+
const version7 = "3.55.7";
|
|
1696677
1696677
|
return `cli@${version7}`;
|
|
1696678
1696678
|
}
|
|
1696679
1696679
|
var DebugLogger = class {
|
|
@@ -1713762,81 +1713762,104 @@ async function captureScreenshot({
|
|
|
1713762
1713762
|
function slugToFilename(slug) {
|
|
1713763
1713763
|
return slug.replace(/\//g, "-");
|
|
1713764
1713764
|
}
|
|
1713765
|
-
function
|
|
1713765
|
+
function rowHasDifference(beforeData, afterData, beforeY, afterY, width, thresholdValue) {
|
|
1713766
|
+
for (let x15 = 0; x15 < width; x15++) {
|
|
1713767
|
+
const beforeIdx = (beforeY * width + x15) * 4;
|
|
1713768
|
+
const afterIdx = (afterY * width + x15) * 4;
|
|
1713769
|
+
const rDiff = Math.abs((beforeData[beforeIdx] ?? 0) - (afterData[afterIdx] ?? 0));
|
|
1713770
|
+
const gDiff = Math.abs((beforeData[beforeIdx + 1] ?? 0) - (afterData[afterIdx + 1] ?? 0));
|
|
1713771
|
+
const bDiff = Math.abs((beforeData[beforeIdx + 2] ?? 0) - (afterData[afterIdx + 2] ?? 0));
|
|
1713772
|
+
if (rDiff > thresholdValue || gDiff > thresholdValue || bDiff > thresholdValue) {
|
|
1713773
|
+
return true;
|
|
1713774
|
+
}
|
|
1713775
|
+
}
|
|
1713776
|
+
return false;
|
|
1713777
|
+
}
|
|
1713778
|
+
function findChangedRegions(beforeData, afterData, width, height3, beforeOriginalHeight, afterOriginalHeight, threshold = 0.1, minArea = 5e3, buffer = 100) {
|
|
1713766
1713779
|
const thresholdValue = Math.floor(threshold * 255);
|
|
1713767
|
-
|
|
1713768
|
-
|
|
1713769
|
-
|
|
1713770
|
-
|
|
1713771
|
-
|
|
1713772
|
-
|
|
1713773
|
-
const gDiff = Math.abs((beforeData[idx + 1] ?? 0) - (afterData[idx + 1] ?? 0));
|
|
1713774
|
-
const bDiff = Math.abs((beforeData[idx + 2] ?? 0) - (afterData[idx + 2] ?? 0));
|
|
1713775
|
-
if (rDiff > thresholdValue || gDiff > thresholdValue || bDiff > thresholdValue) {
|
|
1713776
|
-
has3 = true;
|
|
1713777
|
-
break;
|
|
1713778
|
-
}
|
|
1713780
|
+
let firstChangeY = -1;
|
|
1713781
|
+
const minOriginalHeight = Math.min(beforeOriginalHeight, afterOriginalHeight);
|
|
1713782
|
+
for (let y23 = 0; y23 < minOriginalHeight; y23++) {
|
|
1713783
|
+
if (rowHasDifference(beforeData, afterData, y23, y23, width, thresholdValue)) {
|
|
1713784
|
+
firstChangeY = y23;
|
|
1713785
|
+
break;
|
|
1713779
1713786
|
}
|
|
1713780
|
-
rowHasDiff[y24] = has3;
|
|
1713781
1713787
|
}
|
|
1713782
|
-
|
|
1713783
|
-
|
|
1713784
|
-
|
|
1713785
|
-
|
|
1713786
|
-
|
|
1713788
|
+
if (firstChangeY === -1) {
|
|
1713789
|
+
if (beforeOriginalHeight !== afterOriginalHeight) {
|
|
1713790
|
+
firstChangeY = minOriginalHeight;
|
|
1713791
|
+
} else {
|
|
1713792
|
+
return [];
|
|
1713787
1713793
|
}
|
|
1713788
|
-
|
|
1713794
|
+
}
|
|
1713795
|
+
const minConsecutiveRows = 20;
|
|
1713796
|
+
let lastChangeY = firstChangeY;
|
|
1713797
|
+
const maxOriginalHeight = Math.max(beforeOriginalHeight, afterOriginalHeight);
|
|
1713798
|
+
for (let y23 = 0; y23 < maxOriginalHeight; y23++) {
|
|
1713799
|
+
const beforeY = beforeOriginalHeight - 1 - y23;
|
|
1713800
|
+
const afterY = afterOriginalHeight - 1 - y23;
|
|
1713801
|
+
if (beforeY < 0 || afterY < 0) {
|
|
1713802
|
+
lastChangeY = Math.max(beforeOriginalHeight, afterOriginalHeight) - 1 - y23 + 1;
|
|
1713789
1713803
|
break;
|
|
1713790
1713804
|
}
|
|
1713791
|
-
|
|
1713792
|
-
|
|
1713793
|
-
|
|
1713794
|
-
|
|
1713795
|
-
|
|
1713796
|
-
|
|
1713797
|
-
|
|
1713798
|
-
|
|
1713799
|
-
let gap = 0;
|
|
1713800
|
-
while (y23 < height3 && !rowHasDiff[y23] && gap < gapRows) {
|
|
1713801
|
-
gap++;
|
|
1713802
|
-
y23++;
|
|
1713805
|
+
if (rowHasDifference(beforeData, afterData, beforeY, afterY, width, thresholdValue)) {
|
|
1713806
|
+
let consecutiveCount = 1;
|
|
1713807
|
+
for (let checkY = y23 + 1; checkY < Math.min(y23 + minConsecutiveRows, maxOriginalHeight); checkY++) {
|
|
1713808
|
+
const checkBeforeY = beforeOriginalHeight - 1 - checkY;
|
|
1713809
|
+
const checkAfterY = afterOriginalHeight - 1 - checkY;
|
|
1713810
|
+
if (checkBeforeY < 0 || checkAfterY < 0) {
|
|
1713811
|
+
consecutiveCount++;
|
|
1713812
|
+
continue;
|
|
1713803
1713813
|
}
|
|
1713804
|
-
if (
|
|
1713805
|
-
|
|
1713806
|
-
y23++;
|
|
1713814
|
+
if (rowHasDifference(beforeData, afterData, checkBeforeY, checkAfterY, width, thresholdValue)) {
|
|
1713815
|
+
consecutiveCount++;
|
|
1713807
1713816
|
} else {
|
|
1713808
1713817
|
break;
|
|
1713809
1713818
|
}
|
|
1713810
1713819
|
}
|
|
1713811
|
-
|
|
1713812
|
-
|
|
1713813
|
-
|
|
1713814
|
-
let maxX = 0;
|
|
1713815
|
-
for (let yy = startY; yy <= endY; yy++) {
|
|
1713816
|
-
for (let xx = 0; xx < width; xx++) {
|
|
1713817
|
-
const idx = (yy * width + xx) * 4;
|
|
1713818
|
-
const rDiff = Math.abs((beforeData[idx] ?? 0) - (afterData[idx] ?? 0));
|
|
1713819
|
-
const gDiff = Math.abs((beforeData[idx + 1] ?? 0) - (afterData[idx + 1] ?? 0));
|
|
1713820
|
-
const bDiff = Math.abs((beforeData[idx + 2] ?? 0) - (afterData[idx + 2] ?? 0));
|
|
1713821
|
-
if (rDiff > thresholdValue || gDiff > thresholdValue || bDiff > thresholdValue) {
|
|
1713822
|
-
if (xx < minX) {
|
|
1713823
|
-
minX = xx;
|
|
1713824
|
-
}
|
|
1713825
|
-
if (xx > maxX) {
|
|
1713826
|
-
maxX = xx;
|
|
1713827
|
-
}
|
|
1713828
|
-
}
|
|
1713820
|
+
if (consecutiveCount >= minConsecutiveRows) {
|
|
1713821
|
+
lastChangeY = Math.min(beforeY, afterY);
|
|
1713822
|
+
break;
|
|
1713829
1713823
|
}
|
|
1713830
1713824
|
}
|
|
1713831
|
-
|
|
1713832
|
-
|
|
1713833
|
-
|
|
1713834
|
-
|
|
1713835
|
-
|
|
1713825
|
+
}
|
|
1713826
|
+
if (lastChangeY < firstChangeY) {
|
|
1713827
|
+
lastChangeY = firstChangeY;
|
|
1713828
|
+
}
|
|
1713829
|
+
const startY = Math.max(0, firstChangeY - buffer);
|
|
1713830
|
+
const endY = Math.min(height3 - 1, lastChangeY + buffer);
|
|
1713831
|
+
const minXBuffer = 100;
|
|
1713832
|
+
let minX = width;
|
|
1713833
|
+
let maxX = 0;
|
|
1713834
|
+
for (let y23 = firstChangeY; y23 <= Math.min(lastChangeY, height3 - 1); y23++) {
|
|
1713835
|
+
for (let x15 = 0; x15 < width; x15++) {
|
|
1713836
|
+
const idx = (y23 * width + x15) * 4;
|
|
1713837
|
+
const rDiff = Math.abs((beforeData[idx] ?? 0) - (afterData[idx] ?? 0));
|
|
1713838
|
+
const gDiff = Math.abs((beforeData[idx + 1] ?? 0) - (afterData[idx + 1] ?? 0));
|
|
1713839
|
+
const bDiff = Math.abs((beforeData[idx + 2] ?? 0) - (afterData[idx + 2] ?? 0));
|
|
1713840
|
+
if (rDiff > thresholdValue || gDiff > thresholdValue || bDiff > thresholdValue) {
|
|
1713841
|
+
if (x15 < minX) {
|
|
1713842
|
+
minX = x15;
|
|
1713843
|
+
}
|
|
1713844
|
+
if (x15 > maxX) {
|
|
1713845
|
+
maxX = x15;
|
|
1713846
|
+
}
|
|
1713836
1713847
|
}
|
|
1713837
1713848
|
}
|
|
1713838
1713849
|
}
|
|
1713839
|
-
|
|
1713850
|
+
if (minX > maxX) {
|
|
1713851
|
+
minX = 0;
|
|
1713852
|
+
maxX = width - 1;
|
|
1713853
|
+
} else {
|
|
1713854
|
+
minX = Math.max(0, minX - minXBuffer);
|
|
1713855
|
+
maxX = Math.min(width - 1, maxX + minXBuffer);
|
|
1713856
|
+
}
|
|
1713857
|
+
const box = { minX, minY: startY, maxX, maxY: endY };
|
|
1713858
|
+
const area = (box.maxX - box.minX) * (box.maxY - box.minY);
|
|
1713859
|
+
if (area < minArea) {
|
|
1713860
|
+
return [];
|
|
1713861
|
+
}
|
|
1713862
|
+
return [box];
|
|
1713840
1713863
|
}
|
|
1713841
1713864
|
function cropPng(png, box, padding = 50) {
|
|
1713842
1713865
|
const x1 = Math.max(0, box.minX - padding);
|
|
@@ -1713900,6 +1713923,8 @@ async function generateComparisons({
|
|
|
1713900
1713923
|
}) {
|
|
1713901
1713924
|
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises110.readFile)(beforePath));
|
|
1713902
1713925
|
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises110.readFile)(afterPath));
|
|
1713926
|
+
const beforeOriginalHeight = beforePng.height;
|
|
1713927
|
+
const afterOriginalHeight = afterPng.height;
|
|
1713903
1713928
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
1713904
1713929
|
const height3 = Math.max(beforePng.height, afterPng.height);
|
|
1713905
1713930
|
const resizedBefore = new import_pngjs.PNG({ width, height: height3 });
|
|
@@ -1713914,7 +1713939,7 @@ async function generateComparisons({
|
|
|
1713914
1713939
|
resizedBefore.data.length
|
|
1713915
1713940
|
);
|
|
1713916
1713941
|
const afterData = new Uint8Array(resizedAfter.data.buffer, resizedAfter.data.byteOffset, resizedAfter.data.length);
|
|
1713917
|
-
const regions = findChangedRegions(beforeData, afterData, width, height3);
|
|
1713942
|
+
const regions = findChangedRegions(beforeData, afterData, width, height3, beforeOriginalHeight, afterOriginalHeight);
|
|
1713918
1713943
|
const results = [];
|
|
1713919
1713944
|
if (regions.length === 0) {
|
|
1713920
1713945
|
return results;
|
package/package.json
CHANGED