bun-plugin-stx 0.2.224 → 0.2.226
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 +17 -8
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -9108,14 +9108,10 @@ async function serve(options) {
|
|
|
9108
9108
|
const fallbackLayoutsDir = options.fallbackLayoutsDir ?? stxConfig.fallbackLayoutsDir;
|
|
9109
9109
|
const partialsDir = options.partialsDir ?? stxConfig.partialsDir ?? defaultStxConfig.partialsDir;
|
|
9110
9110
|
const publicDir = options.publicDir ?? stxConfig.publicDir ?? "public";
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
});
|
|
9116
|
-
if (derived > 0 && !production)
|
|
9117
|
-
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
9118
|
-
} catch {}
|
|
9111
|
+
let markPlaceholdersReady = () => {};
|
|
9112
|
+
const placeholdersReady = new Promise((resolve13) => {
|
|
9113
|
+
markPlaceholdersReady = resolve13;
|
|
9114
|
+
});
|
|
9119
9115
|
const stxModule = options.stxModule ? Promise.resolve(options.stxModule) : defaultStxModule;
|
|
9120
9116
|
let resolvedStxModule = null;
|
|
9121
9117
|
Promise.resolve(stxModule).then((m) => {
|
|
@@ -10187,6 +10183,7 @@ ${html}`;
|
|
|
10187
10183
|
reusePort: options.reusePort ?? false,
|
|
10188
10184
|
idleTimeout: production ? 30 : 0,
|
|
10189
10185
|
async fetch(req, server) {
|
|
10186
|
+
await placeholdersReady;
|
|
10190
10187
|
return compressResponse(req, await (async () => {
|
|
10191
10188
|
const url = new URL(req.url);
|
|
10192
10189
|
let path = url.pathname;
|
|
@@ -10860,6 +10857,18 @@ ${trailingPageScripts.join(`
|
|
|
10860
10857
|
if (actualPort !== port && !options.quiet) {
|
|
10861
10858
|
console.warn(`\x1B[33m[stx]\x1B[0m port ${port} in use \u2014 using \x1B[1m${actualPort}\x1B[0m instead`);
|
|
10862
10859
|
}
|
|
10860
|
+
(async () => {
|
|
10861
|
+
try {
|
|
10862
|
+
const { warmImagePlaceholders } = await import("@stacksjs/stx");
|
|
10863
|
+
const derived = await warmImagePlaceholders(nodePath.resolve(process19.cwd(), publicDir), {
|
|
10864
|
+
cachePath: stateDir(process19.cwd(), "image-placeholders.json")
|
|
10865
|
+
});
|
|
10866
|
+
if (derived > 0 && !production)
|
|
10867
|
+
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
10868
|
+
} catch {} finally {
|
|
10869
|
+
markPlaceholdersReady();
|
|
10870
|
+
}
|
|
10871
|
+
})();
|
|
10863
10872
|
if (ENABLE_HTML_CACHE && options.prewarmRenderCache) {
|
|
10864
10873
|
const requestedConcurrency = typeof options.prewarmRenderCache === "number" ? Math.floor(options.prewarmRenderCache) : 4;
|
|
10865
10874
|
const concurrency = Math.max(1, requestedConcurrency);
|
package/package.json
CHANGED