bun-plugin-stx 0.2.418 → 0.2.420

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 +11 -4
  2. package/package.json +3 -3
package/dist/serve.js CHANGED
@@ -8716,7 +8716,7 @@ var defaultConfigDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "config");
8716
8716
  var defaultGeneratedDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "src/generated");
8717
8717
 
8718
8718
  // src/serve.ts
8719
- import { BUILD_ID_HEADER, decodeTitleEntities, extractPageResponseStatus, findContainerRegion, FRAGMENT_CACHE_CONTROL, getBuildId, mergeCssConfig, readResponseHeaders, readResponseStatus, SPA_NAV_HEADER, spaNavVaryHeaders, stateDir, stateDirName } from "@stacksjs/stx";
8719
+ import { BUILD_ID_HEADER, decodeTitleEntities, extractPageResponseStatus, findContainerRegion, FRAGMENT_CACHE_CONTROL, getBuildId, mergeCssConfig, readResponseHeaders, readResponseStatus, renderFontCSS, SPA_NAV_HEADER, spaNavVaryHeaders, stateDir, stateDirName } from "@stacksjs/stx";
8720
8720
  import { buildCodeFrame, locateFailureLine } from "@stacksjs/stx/build-message";
8721
8721
  import { clearBundleFailures, getBundleFailures } from "@stacksjs/stx/client-script-bundler";
8722
8722
  import { actionRedirectResponse, compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
@@ -9005,7 +9005,11 @@ function csrfCookieHeader(token, secure) {
9005
9005
  ].filter(Boolean).join("; ");
9006
9006
  }
9007
9007
  function buildDynamicRouteRegexes(fileRouteBase) {
9008
- const toPattern = (p) => p.replace(/\[\.\.\.([^\]]+)\]/g, "(.+)").replace(/\[([^\]]+)\]/g, (param, _name, offset, whole) => offset + param.length === whole.length ? `${FILE_SEGMENT_GUARD}([^/]+)` : "([^/]+)").replace(/\//g, "\\/");
9008
+ const paramGroup = (param, _name, offset, whole) => {
9009
+ const last = offset + param.length === whole.length;
9010
+ return last ? `${FILE_SEGMENT_GUARD}([^/]+)` : "([^/]+)";
9011
+ };
9012
+ const toPattern = (p) => p.replace(/\[\.\.\.([^\]]+)\]/g, "(.+)").replace(/\[([^\]]+)\]/g, paramGroup).replace(/\//g, "\\/");
9009
9013
  const patterns = [new RegExp(`^${toPattern(fileRouteBase)}$`)];
9010
9014
  const noIndex = fileRouteBase.replace(/\/index$/, "");
9011
9015
  if (noIndex !== fileRouteBase)
@@ -10102,7 +10106,7 @@ function __stxOverlay(errs){
10102
10106
  shortcutCSS += `@media (prefers-color-scheme: dark) { .dark .${name} { ${darkDecls.join(" ")} } }
10103
10107
  `;
10104
10108
  }
10105
- return cssCssCache.remember(cacheKey, tokenCSS + baseCss + shortcutCSS);
10109
+ return cssCssCache.remember(cacheKey, renderFontCSS(cw.CSSGenerator, merged) + tokenCSS + baseCss + shortcutCSS);
10106
10110
  } catch (error) {
10107
10111
  console.warn("Failed to generate Css CSS:", error);
10108
10112
  return "";
@@ -10601,7 +10605,10 @@ ${block}`;
10601
10605
  headers.set("x-stx-domain-route", requestHost(req));
10602
10606
  req = new Request(original, { headers, method: req.method, body: req.body, redirect: req.redirect, duplex: "half" });
10603
10607
  } else if (req.method === "GET" || req.method === "HEAD") {
10604
- const location = resolveDomainElsewhere(requestHost(req), original.pathname, original.search, domainRoutes, (pathname) => pathname.startsWith("/api/") || pathname.startsWith("/_stx/") || pathname.startsWith("/.well-known/") || isStaticAssetPath(pathname) || publicFileExists(pathname, publicDir));
10608
+ const staysHere = (pathname) => {
10609
+ return pathname.startsWith("/api/") || pathname.startsWith("/_stx/") || pathname.startsWith("/.well-known/") || isStaticAssetPath(pathname) || publicFileExists(pathname, publicDir);
10610
+ };
10611
+ const location = resolveDomainElsewhere(requestHost(req), original.pathname, original.search, domainRoutes, staysHere);
10605
10612
  if (location) {
10606
10613
  if (req.headers.get(SPA_NAV_HEADER) === "true")
10607
10614
  return new Response(null, { status: 200, headers: { "X-STX-Location": location, "Cache-Control": "no-store", Vary: SPA_NAV_HEADER } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.418",
4
+ "version": "0.2.420",
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",
@@ -74,7 +74,7 @@
74
74
  "typecheck": "bun tsc --noEmit"
75
75
  },
76
76
  "dependencies": {
77
- "@stacksjs/stx": "0.2.418",
78
- "stx-router": "0.2.418"
77
+ "@stacksjs/stx": "0.2.420",
78
+ "stx-router": "0.2.420"
79
79
  }
80
80
  }