bun-plugin-stx 0.2.417 → 0.2.419

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 +9 -2
  2. package/package.json +3 -3
package/dist/serve.js CHANGED
@@ -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)
@@ -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.417",
4
+ "version": "0.2.419",
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.417",
78
- "stx-router": "0.2.417"
77
+ "@stacksjs/stx": "0.2.419",
78
+ "stx-router": "0.2.419"
79
79
  }
80
80
  }