@hkdigital/lib-core 0.5.23 → 0.5.24

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.
@@ -116,8 +116,7 @@ export function generateResponseConfigs(options) {
116
116
  ...configPairs,
117
117
  w: String(w),
118
118
  format: 'png',
119
- ensureAlpha: '1',
120
- png: JSON.stringify({ palette: false })
119
+ ensureAlpha: 'true'
121
120
  };
122
121
  });
123
122
  // console.log('Returning favicon configs:', faviconConfigs);
@@ -131,8 +130,7 @@ export function generateResponseConfigs(options) {
131
130
  ...configPairs,
132
131
  w: String(w),
133
132
  format: 'png',
134
- ensureAlpha: '1',
135
- png: JSON.stringify({ palette: false })
133
+ ensureAlpha: 'true'
136
134
  };
137
135
  });
138
136
  // console.log('Returning apple-touch-icon configs:', appleTouchConfigs);
@@ -68,10 +68,24 @@ export async function generateViteConfig(options = {}) {
68
68
  generateResponseConfigs
69
69
  } = await import('./imagetools.js');
70
70
 
71
+ // Custom transform to ensure alpha channel based on directive
72
+ const ensureAlphaTransform = (config) => {
73
+ // Only apply if ensureAlpha directive is present
74
+ if (!config.ensureAlpha) return undefined;
75
+
76
+ return (image) => {
77
+ return image.ensureAlpha();
78
+ };
79
+ };
80
+
71
81
  plugins.push(
72
82
  imagetools({
73
83
  defaultDirectives: generateDefaultDirectives(imagetoolsOptions),
74
- resolveConfigs: generateResponseConfigs(imagetoolsOptions)
84
+ resolveConfigs: generateResponseConfigs(imagetoolsOptions),
85
+ extendTransforms: (builtins) => [
86
+ ...builtins,
87
+ ensureAlphaTransform
88
+ ]
75
89
  })
76
90
  );
77
91
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"