@hkdigital/lib-core 0.5.24 → 0.5.25
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.
|
@@ -73,8 +73,20 @@ export async function generateViteConfig(options = {}) {
|
|
|
73
73
|
// Only apply if ensureAlpha directive is present
|
|
74
74
|
if (!config.ensureAlpha) return undefined;
|
|
75
75
|
|
|
76
|
-
return (image) => {
|
|
77
|
-
|
|
76
|
+
return async (image) => {
|
|
77
|
+
// Force RGBA output by making one pixel slightly transparent
|
|
78
|
+
// This prevents Sharp from optimizing back to RGB palette
|
|
79
|
+
const metadata = await image.metadata();
|
|
80
|
+
|
|
81
|
+
return image
|
|
82
|
+
.ensureAlpha()
|
|
83
|
+
.composite([{
|
|
84
|
+
input: Buffer.from([0, 0, 0, 254]), // RGBA: black with 254 alpha (nearly opaque)
|
|
85
|
+
raw: { width: 1, height: 1, channels: 4 },
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
blend: 'over'
|
|
89
|
+
}]);
|
|
78
90
|
};
|
|
79
91
|
};
|
|
80
92
|
|