bun-plugin-stx 0.2.323 → 0.2.324
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/serve.js +13 -1
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -10384,6 +10384,12 @@ ${block}`;
|
|
|
10384
10384
|
headers
|
|
10385
10385
|
});
|
|
10386
10386
|
}
|
|
10387
|
+
function reportImageWarmupFailure(stage, error) {
|
|
10388
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10389
|
+
console.warn(`\x1B[33m[stx]\x1B[0m ${stage} failed during the image warm-up: ${message}. <StxImage> serves the original files without them until a start where the warm-up succeeds.`);
|
|
10390
|
+
if (!production && error instanceof Error && error.stack)
|
|
10391
|
+
console.warn(`\x1B[2m${error.stack}\x1B[0m`);
|
|
10392
|
+
}
|
|
10387
10393
|
async function runImageWarmup() {
|
|
10388
10394
|
const imageWarmupEnabled = imageWarmupSetting === "auto" ? await projectUsesImageBuiltins(process19.cwd()) : imageWarmupSetting !== false;
|
|
10389
10395
|
if (!imageWarmupEnabled) {
|
|
@@ -10401,12 +10407,18 @@ ${block}`;
|
|
|
10401
10407
|
}),
|
|
10402
10408
|
stx.prepareImageDelivery(publicRoot, imageDeliveryOutputDir, { offThread: true })
|
|
10403
10409
|
]);
|
|
10410
|
+
if (placeholderResult.status === "rejected")
|
|
10411
|
+
reportImageWarmupFailure("image placeholders", placeholderResult.reason);
|
|
10412
|
+
if (deliveryResult.status === "rejected")
|
|
10413
|
+
reportImageWarmupFailure("responsive image variants", deliveryResult.reason);
|
|
10404
10414
|
const derived = placeholderResult.status === "fulfilled" ? placeholderResult.value : 0;
|
|
10405
10415
|
if (derived > 0 && !production)
|
|
10406
10416
|
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
10407
10417
|
if (deliveryResult.status === "fulfilled" && deliveryResult.value.count > 0 && !production)
|
|
10408
10418
|
console.log(`[stx] optimized ${deliveryResult.value.count} image(s) for responsive delivery`);
|
|
10409
|
-
} catch
|
|
10419
|
+
} catch (error) {
|
|
10420
|
+
reportImageWarmupFailure("image warm-up", error);
|
|
10421
|
+
} finally {
|
|
10410
10422
|
placeholdersAreReady = true;
|
|
10411
10423
|
markPlaceholdersReady();
|
|
10412
10424
|
}
|
package/package.json
CHANGED