zone5 1.6.2 → 1.6.4
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/processor/variants.js +11 -10
- package/package.json +2 -1
|
@@ -36,14 +36,13 @@ export async function generateImageVariants(options) {
|
|
|
36
36
|
await rm(cacheDir, { recursive: true, force: true });
|
|
37
37
|
}
|
|
38
38
|
await ensureDirectoryExists(cacheDir);
|
|
39
|
-
// Generate variants for each valid width
|
|
40
|
-
const
|
|
41
|
-
let generatedCount = 0;
|
|
42
|
-
for (const width of validWidths) {
|
|
39
|
+
// Generate variants for each valid width in parallel
|
|
40
|
+
const variantResults = await Promise.all(validWidths.map(async (width) => {
|
|
43
41
|
const variantFilename = `${fileBasename}-${width}${fileExtension}`;
|
|
44
42
|
const variantPath = join(cacheDir, variantFilename);
|
|
45
43
|
// Check if variant already exists and should be overwritten
|
|
46
44
|
const variantExists = await fileExists(variantPath);
|
|
45
|
+
let wasGenerated = false;
|
|
47
46
|
if (!variantExists || forceOverwrite) {
|
|
48
47
|
let img = sharp(sourceFile);
|
|
49
48
|
if (processor.resize_gamma) {
|
|
@@ -59,13 +58,15 @@ export async function generateImageVariants(options) {
|
|
|
59
58
|
img = await addDebugText(img, width, Math.ceil(h * scale));
|
|
60
59
|
}
|
|
61
60
|
await img.toFile(variantPath);
|
|
62
|
-
|
|
61
|
+
wasGenerated = true;
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
width,
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|
|
63
|
+
return {
|
|
64
|
+
variant: { width, path: variantPath },
|
|
65
|
+
wasGenerated,
|
|
66
|
+
};
|
|
67
|
+
}));
|
|
68
|
+
const variants = variantResults.map((r) => r.variant);
|
|
69
|
+
const generatedCount = variantResults.filter((r) => r.wasGenerated).length;
|
|
69
70
|
span.setAttributes({
|
|
70
71
|
'zone5.variantsGenerated': generatedCount,
|
|
71
72
|
'zone5.variantsTotal': variants.length,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zone5",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/cwygoda/zone5"
|
|
6
6
|
},
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"jsdom": "^27.1.0",
|
|
104
104
|
"mdsvex": "^0.12.6",
|
|
105
105
|
"publint": "^0.3.15",
|
|
106
|
+
"rehype-slug": "^6.0.0",
|
|
106
107
|
"semantic-release": "^25.0.2",
|
|
107
108
|
"svast": "^0.2.1",
|
|
108
109
|
"svelte": "^5.43.5",
|