bun-plugin-stx 0.2.131 → 0.2.133

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.
Files changed (2) hide show
  1. package/dist/serve.js +19 -0
  2. package/package.json +1 -1
package/dist/serve.js CHANGED
@@ -9541,6 +9541,7 @@ After installing: bun add bun-plugin-stx`);
9541
9541
  ...layoutsDir && { layoutsDir },
9542
9542
  ...partialsDir && { partialsDir },
9543
9543
  autoShell: true,
9544
+ buildMode: "serve",
9544
9545
  ssr: stxConfig.ssr ?? defaultStxConfig.ssr ?? true,
9545
9546
  app: stxConfig.app || {},
9546
9547
  ..."strict" in stxConfig && { strict: stxConfig.strict },
@@ -9716,6 +9717,7 @@ After installing: bun add bun-plugin-stx`);
9716
9717
  ...layoutsDir && { layoutsDir },
9717
9718
  ...partialsDir && { partialsDir },
9718
9719
  autoShell: true,
9720
+ buildMode: "serve",
9719
9721
  ssr: stxConfig.ssr ?? defaultStxConfig.ssr ?? true,
9720
9722
  app: stxConfig.app || {},
9721
9723
  ..."strict" in stxConfig && { strict: stxConfig.strict },
@@ -9784,6 +9786,7 @@ ${output}`;
9784
9786
  }
9785
9787
  function getRouterInjectOptions() {
9786
9788
  return {
9789
+ buildMode: "serve",
9787
9790
  router: {
9788
9791
  interceptAllLinks: true,
9789
9792
  container: "main",
@@ -9975,6 +9978,22 @@ ${html}`;
9975
9978
  }
9976
9979
  });
9977
9980
  }
9981
+ if (path === "/_stx/runtime.js" || path === "/_stx/router.js") {
9982
+ const stx = await stxModule;
9983
+ const content2 = path === "/_stx/runtime.js" ? await stx.getCachedSignalsRuntime(stxConfig.debug === true) : await stx.getCachedRouterScript();
9984
+ const etag = `"${Bun.hash(content2).toString(16)}"`;
9985
+ const headers = {
9986
+ "Content-Type": "application/javascript; charset=utf-8",
9987
+ "Cache-Control": "public, max-age=0, must-revalidate",
9988
+ ETag: etag,
9989
+ ...corsHeaders
9990
+ };
9991
+ if (req.headers.get("if-none-match") === etag)
9992
+ return new Response(null, { status: 304, headers });
9993
+ if (req.method === "HEAD")
9994
+ return new Response(null, { headers });
9995
+ return new Response(content2, { headers });
9996
+ }
9978
9997
  if (options.onRequest) {
9979
9998
  const hookResult = await options.onRequest(req);
9980
9999
  if (hookResult instanceof Response)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.131",
4
+ "version": "0.2.133",
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",