bun-plugin-stx 0.2.292 → 0.2.293
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 +24 -20
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -10276,6 +10276,28 @@ ${block}`;
|
|
|
10276
10276
|
headers
|
|
10277
10277
|
});
|
|
10278
10278
|
}
|
|
10279
|
+
async function runImageWarmup() {
|
|
10280
|
+
try {
|
|
10281
|
+
const stx = await stxModule;
|
|
10282
|
+
const publicRoot = nodePath.resolve(process19.cwd(), publicDir);
|
|
10283
|
+
const [placeholderResult, deliveryResult] = await Promise.allSettled([
|
|
10284
|
+
stx.warmImagePlaceholders(publicRoot, {
|
|
10285
|
+
cachePath: stateDir(process19.cwd(), "image-placeholders.json")
|
|
10286
|
+
}),
|
|
10287
|
+
stx.prepareImageDelivery(publicRoot, imageDeliveryOutputDir)
|
|
10288
|
+
]);
|
|
10289
|
+
const derived = placeholderResult.status === "fulfilled" ? placeholderResult.value : 0;
|
|
10290
|
+
if (derived > 0 && !production)
|
|
10291
|
+
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
10292
|
+
if (deliveryResult.status === "fulfilled" && deliveryResult.value.count > 0 && !production)
|
|
10293
|
+
console.log(`[stx] optimized ${deliveryResult.value.count} image(s) for responsive delivery`);
|
|
10294
|
+
} catch {} finally {
|
|
10295
|
+
placeholdersAreReady = true;
|
|
10296
|
+
markPlaceholdersReady();
|
|
10297
|
+
}
|
|
10298
|
+
}
|
|
10299
|
+
if (production)
|
|
10300
|
+
await runImageWarmup();
|
|
10279
10301
|
const portAutoIncrement = options.autoIncrementPort ?? true;
|
|
10280
10302
|
const maxPortAttempts = portAutoIncrement === false ? 1 : typeof portAutoIncrement === "number" ? Math.max(1, portAutoIncrement) : 10;
|
|
10281
10303
|
let actualPort = port;
|
|
@@ -10992,26 +11014,8 @@ ${trailingPageScripts.join(`
|
|
|
10992
11014
|
if (actualPort !== port && !options.quiet) {
|
|
10993
11015
|
console.warn(`\x1B[33m[stx]\x1B[0m port ${port} in use \u2014 using \x1B[1m${actualPort}\x1B[0m instead`);
|
|
10994
11016
|
}
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
const stx = await stxModule;
|
|
10998
|
-
const publicRoot = nodePath.resolve(process19.cwd(), publicDir);
|
|
10999
|
-
const [placeholderResult, deliveryResult] = await Promise.allSettled([
|
|
11000
|
-
stx.warmImagePlaceholders(publicRoot, {
|
|
11001
|
-
cachePath: stateDir(process19.cwd(), "image-placeholders.json")
|
|
11002
|
-
}),
|
|
11003
|
-
stx.prepareImageDelivery(publicRoot, imageDeliveryOutputDir)
|
|
11004
|
-
]);
|
|
11005
|
-
const derived = placeholderResult.status === "fulfilled" ? placeholderResult.value : 0;
|
|
11006
|
-
if (derived > 0 && !production)
|
|
11007
|
-
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
11008
|
-
if (deliveryResult.status === "fulfilled" && deliveryResult.value.count > 0 && !production)
|
|
11009
|
-
console.log(`[stx] optimized ${deliveryResult.value.count} image(s) for responsive delivery`);
|
|
11010
|
-
} catch {} finally {
|
|
11011
|
-
placeholdersAreReady = true;
|
|
11012
|
-
markPlaceholdersReady();
|
|
11013
|
-
}
|
|
11014
|
-
})();
|
|
11017
|
+
if (!production)
|
|
11018
|
+
runImageWarmup();
|
|
11015
11019
|
if (ENABLE_HTML_CACHE && options.prewarmRenderCache) {
|
|
11016
11020
|
const requestedConcurrency = typeof options.prewarmRenderCache === "number" ? Math.floor(options.prewarmRenderCache) : 4;
|
|
11017
11021
|
const concurrency = Math.max(1, requestedConcurrency);
|
package/package.json
CHANGED