bun-plugin-stx 0.2.224 → 0.2.225
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 +11 -8
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -9108,14 +9108,16 @@ 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
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9111
|
+
const placeholdersReady = (async () => {
|
|
9112
|
+
try {
|
|
9113
|
+
const { warmImagePlaceholders } = await import("@stacksjs/stx");
|
|
9114
|
+
const derived = await warmImagePlaceholders(nodePath.resolve(process19.cwd(), publicDir), {
|
|
9115
|
+
cachePath: stateDir(process19.cwd(), "image-placeholders.json")
|
|
9116
|
+
});
|
|
9117
|
+
if (derived > 0 && !production)
|
|
9118
|
+
console.log(`[stx] derived ${derived} image placeholder(s)`);
|
|
9119
|
+
} catch {}
|
|
9120
|
+
})();
|
|
9119
9121
|
const stxModule = options.stxModule ? Promise.resolve(options.stxModule) : defaultStxModule;
|
|
9120
9122
|
let resolvedStxModule = null;
|
|
9121
9123
|
Promise.resolve(stxModule).then((m) => {
|
|
@@ -10187,6 +10189,7 @@ ${html}`;
|
|
|
10187
10189
|
reusePort: options.reusePort ?? false,
|
|
10188
10190
|
idleTimeout: production ? 30 : 0,
|
|
10189
10191
|
async fetch(req, server) {
|
|
10192
|
+
await placeholdersReady;
|
|
10190
10193
|
return compressResponse(req, await (async () => {
|
|
10191
10194
|
const url = new URL(req.url);
|
|
10192
10195
|
let path = url.pathname;
|
package/package.json
CHANGED