@tokenoftrust/storefront-runner 6.11.7 → 6.11.8

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.
@@ -19,7 +19,7 @@ export const STATIC_SCRIPT_HASHES: readonly string[] = [
19
19
  "'sha256-YicfxUFBkKrQapZ/tzZKlaKTdNHgwVfv7y2Wa0NC6/k='",
20
20
  "'sha256-eIXWvAmxkr251LJZkjniEK5LcPF3NkapbJepohwYRIc='",
21
21
  "'sha256-elMLh/6Oubj8u9FRLwZLyRa6TqKikGs75mf0jfWcoxI='",
22
- "'sha256-MG9XnFVbN8UmLcNws9A8ckOhQJI+MnAKxpCI7oBMS3Q='",
22
+ "'sha256-UkiZ314bvR+s0LxD1/lKWFoqCiDGgfNEnuNm1TIFWsQ='",
23
23
  ];
24
24
 
25
25
  export const STATIC_STYLE_HASHES: readonly string[] = [
@@ -126,6 +126,39 @@ export async function resolveTenantRouting(
126
126
  }
127
127
  }
128
128
 
129
+ // Root-mounted tenant-scoped paths (`/tenants/<tenant>/<rel...>` and
130
+ // `/preview/render/<tenant>/<changeId>/...`) keep their full route path for
131
+ // Astro's router (`basePath: ""`), while resolving `tenant` from the embedded
132
+ // segment so middleware preview-context and session checks bind to `<tenant>`
133
+ // rather than the shared preview host's default tenant.
134
+ const embeddedRaw =
135
+ first === "tenants" && segments.length >= 3 && segments.slice(2).some((s) => s.length > 0)
136
+ ? segments[1]
137
+ : first === "preview" &&
138
+ segments[1] === "render" &&
139
+ (segments[2]?.length ?? 0) > 0 &&
140
+ (segments[3]?.length ?? 0) > 0
141
+ ? segments[2]
142
+ : undefined;
143
+ if (embeddedRaw) {
144
+ let embedded = embeddedRaw;
145
+ try {
146
+ embedded = decodeURIComponent(embeddedRaw);
147
+ } catch {
148
+ /* leave as-is if it isn't valid percent-encoding */
149
+ }
150
+ if (looksLikeHost(embedded)) {
151
+ const byEmbedded = await resolver.resolveStrict(embedded);
152
+ if (byEmbedded) {
153
+ return {
154
+ tenant: byEmbedded,
155
+ basePath: "",
156
+ renderPath: normalizePath(pathname),
157
+ };
158
+ }
159
+ }
160
+ }
161
+
129
162
  // 3. A path-prefix host whose prefix named no known tenant serves its OWN
130
163
  // content — that is the root case, and any other path on it.
131
164
  if (byHost) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "6.11.7",
3
+ "version": "6.11.8",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",