bun-plugin-stx 0.2.141 → 0.2.143

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.d.ts CHANGED
@@ -65,6 +65,7 @@ export declare function render404Page(opts: {
65
65
  routes?: string[]
66
66
  isProduction: boolean
67
67
  }): string;
68
+ export declare function isRenderableCacheCandidate(html: string): boolean;
68
69
  export declare function bundleBrowserAsset(entrypoint: string): Promise<Response>;
69
70
  /**
70
71
  * Start the STX development server
package/dist/serve.js CHANGED
@@ -8860,6 +8860,9 @@ function render404Page(opts) {
8860
8860
  </body>
8861
8861
  </html>`;
8862
8862
  }
8863
+ function isRenderableCacheCandidate(html) {
8864
+ return !html.includes("<!-- Template Processing failed:") && !html.includes("<!-- stx rendering error -->");
8865
+ }
8863
8866
  var defaultStxConfig = {
8864
8867
  partialsDir: "partials",
8865
8868
  componentsDir: "components",
@@ -9597,7 +9600,7 @@ After installing: bun add bun-plugin-stx`);
9597
9600
  } else {
9598
9601
  output = output.replace(/<template[^>]*>/gi, "").replace(/<\/template>/gi, "");
9599
9602
  }
9600
- if (ENABLE_HTML_CACHE && !context.__stx_skip_cache && !skipCacheHint) {
9603
+ if (ENABLE_HTML_CACHE && !context.__stx_skip_cache && !skipCacheHint && isRenderableCacheCandidate(output)) {
9601
9604
  const signature = await buildTemplateSignature(filePath, dependencies);
9602
9605
  htmlCache.set(htmlCacheKey(filePath, reqCtx), { html: output, signature });
9603
9606
  }
@@ -10561,6 +10564,7 @@ export {
10561
10564
  staticCacheControl,
10562
10565
  serve,
10563
10566
  render404Page,
10567
+ isRenderableCacheCandidate,
10564
10568
  isProductionServe,
10565
10569
  extractServerScriptsFromTemplate,
10566
10570
  bundleBrowserAsset,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.141",
4
+ "version": "0.2.143",
5
5
  "description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",