@amboras-dev/storefront-core 2026.11.3 → 2026.11.5
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/CHANGELOG.md +47 -0
- package/bin/checks/check-redirect-boundaries.mjs +23 -5
- package/core-manifest.json +6 -1
- package/dist/lib/redirects.d.ts +22 -5
- package/dist/lib/redirects.d.ts.map +1 -1
- package/dist/lib/redirects.js +70 -9
- package/dist/lib/redirects.js.map +1 -1
- package/dist/lib/seo.d.ts +53 -0
- package/dist/lib/seo.d.ts.map +1 -0
- package/dist/lib/seo.js +155 -0
- package/dist/lib/seo.js.map +1 -0
- package/dist/lib/site-url.d.ts +14 -8
- package/dist/lib/site-url.d.ts.map +1 -1
- package/dist/lib/site-url.js +26 -16
- package/dist/lib/site-url.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2026.11.5
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- SEO (template #217, AMB-2176): `lib/seo` exports `generateSitemaps()`, `sitemap({ id })`, `sitemapIndex()`
|
|
10
|
+
and `robots()`. `/sitemap.xml` is a sitemap index (the store's `app/sitemap.xml/route.ts` re-exports
|
|
11
|
+
`sitemapIndex` as `GET`) over child sitemaps at `/sitemaps/sitemap/<id>.xml` (the store's
|
|
12
|
+
`app/sitemaps/sitemap.ts` re-exports `generateSitemaps` and `sitemap`; Next refuses a `sitemap.ts` next to
|
|
13
|
+
the `sitemap.xml` route at the app root): child `0` is the static pages and collections, child `n` is
|
|
14
|
+
products page `n` (250 per page, Shopify's page size, `order=id`). If Medusa answers a smaller page than
|
|
15
|
+
asked, or a child other than the last comes back short, the child rejects (5xx, crawlers retry) instead of
|
|
16
|
+
silently dropping the products between pages. Collections beyond Medusa's 250-per-page cap are left out of
|
|
17
|
+
child `0` (a warning is logged with the count); a store with more than 250 collections has an incomplete
|
|
18
|
+
sitemap until collections are paged. Each child is one Medusa call cached per URL (`fetch`
|
|
19
|
+
`revalidate` 3600, like `storeGetJson`), so no cache entry nears Vercel's 2 MB item limit and there is no
|
|
20
|
+
49k cap. Next also calls `generateSitemaps()` on every child request (one small count call, cached the
|
|
21
|
+
same way). `sitemap`, `sitemapIndex` and `robots` (now async) await `connection()`, so they are never prerendered and the
|
|
22
|
+
store's files need no `dynamic = 'force-dynamic'`; `generateSitemaps()` makes no Medusa call during
|
|
23
|
+
`next build`. Absolute URLs on the primary host, no sitemap when no origin is known.
|
|
24
|
+
`sitemap(props, { staticPaths })` takes the store's own list of static pages (default
|
|
25
|
+
`STATIC_SITEMAP_PATHS`, now also `/products` and `/collections`). Needs a new shim `lib/seo.ts` in the
|
|
26
|
+
store. `robots()` disallows `/cart /checkout /account /auth /search /kit-gallery`. A Vercel preview or
|
|
27
|
+
development deploy (a draft, an A/B variant: `VERCEL_ENV` set and not `production`) serves `Disallow: /`,
|
|
28
|
+
no `Sitemap:` line and an empty sitemap, with no Medusa call.
|
|
29
|
+
- URL redirects for any path (AMB-2044): `lib/redirects` exports `resolveUnmatchedPathRedirect` for the
|
|
30
|
+
store's new catch-all page `app/[...slug]/page.tsx`, which only renders when no other route matches. It
|
|
31
|
+
looks the path up once (encoded form, then raw), appends the request's query to a path target on the
|
|
32
|
+
store unless the target has its own (never to another site), treats an absolute target on the request's
|
|
33
|
+
own host or the primary host (and its `www.` twin) as a path, and drops a target that leads back to the
|
|
34
|
+
requested path. The page answers 308 (`permanentRedirect`) or the styled 404. Needs the new route
|
|
35
|
+
file in the store (no new shim). `resolveHandleRedirect` is unchanged. `amboras-check redirect-boundaries`
|
|
36
|
+
also refuses a `loading.tsx` in `app/[...slug]/`, which would turn the 308 into a 200 with a client
|
|
37
|
+
redirect. A root `app/loading.tsx` (which
|
|
38
|
+
does the same for every redirect) only prints a warning, so existing stores do not break at the bump.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- `siteMetadataBase()` reads `NEXT_PUBLIC_SITE_URL` (the store's primary host, written by the
|
|
43
|
+
orchestrator) before Vercel's `VERCEL_PROJECT_PRODUCTION_URL`. A malformed value falls through to the
|
|
44
|
+
next candidate, and a value with a path keeps only its origin.
|
|
45
|
+
|
|
46
|
+
## 2026.11.4
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- The `next` peer range is now `>=16.3.0` (was `>=16.3.6`), so stores on Next 16.3.0 through 16.3.5 can adopt core without upgrading Next.
|
|
51
|
+
|
|
5
52
|
## 2026.11.3
|
|
6
53
|
|
|
7
54
|
### Breaking
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Guard: no `loading.tsx` directly in `app/products/` or `app/
|
|
3
|
+
* Guard: no `loading.tsx` directly in `app/products/`, `app/collections/` or `app/[...slug]/`.
|
|
4
4
|
*
|
|
5
5
|
* WHY. A renamed product or collection must answer a real HTTP 308 (search
|
|
6
6
|
* engines move the ranking only on a server redirect). The decision is made in
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
* `app/products/(listing)/loading.tsx`, `app/collections/(listing)/loading.tsx`
|
|
17
17
|
* — same URLs, but they wrap only the listing page.
|
|
18
18
|
*
|
|
19
|
+
* The same holds for the catch-all `app/[...slug]/page.tsx` (a merchant URL redirect for any path):
|
|
20
|
+
* a `loading.tsx` next to it would turn its 308 into a 200 with a client redirect.
|
|
21
|
+
*
|
|
19
22
|
* Usage: `node scripts/check-redirect-boundaries.mjs [storefrontRoot]`.
|
|
20
23
|
* Exit 1 with the offending paths, exit 0 otherwise.
|
|
21
24
|
*/
|
|
@@ -23,7 +26,7 @@ import { existsSync } from 'node:fs'
|
|
|
23
26
|
import { join, resolve } from 'node:path'
|
|
24
27
|
import { fileURLToPath } from 'node:url'
|
|
25
28
|
|
|
26
|
-
export const GUARDED_DIRS = ['app/products', 'app/collections']
|
|
29
|
+
export const GUARDED_DIRS = ['app/products', 'app/collections', 'app/[...slug]']
|
|
27
30
|
const LOADING_FILES = ['loading.tsx', 'loading.ts', 'loading.jsx', 'loading.js']
|
|
28
31
|
|
|
29
32
|
/** Offending files (relative paths) under `root`. */
|
|
@@ -37,17 +40,32 @@ export function findRedirectBoundaryViolations(root) {
|
|
|
37
40
|
return found
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Warnings (relative paths) under `root`: a ROOT `app/loading.tsx` wraps every segment, so the 308s above
|
|
45
|
+
* become a 200 plus a client redirect too. Deliberately not a failure (existing stores would break at the
|
|
46
|
+
* core bump), but a store that adds one should see it.
|
|
47
|
+
*/
|
|
48
|
+
export function findRedirectBoundaryWarnings(root) {
|
|
49
|
+
return LOADING_FILES.filter((file) => existsSync(join(root, 'app', file))).map((file) => `app/${file}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
const isMain = process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
|
41
53
|
if (isMain) {
|
|
42
54
|
const root = resolve(process.argv[2] ?? process.env.AMBORAS_STORE_ROOT ?? process.cwd())
|
|
43
55
|
const violations = findRedirectBoundaryViolations(root)
|
|
56
|
+
for (const warning of findRedirectBoundaryWarnings(root)) {
|
|
57
|
+
console.warn(
|
|
58
|
+
`[check-redirect-boundaries] WARN: ${warning} wraps every segment, so product, collection and unmatched-path redirects ` +
|
|
59
|
+
'answer 200 + a client redirect instead of a 308. Prefer route-group loading boundaries.',
|
|
60
|
+
)
|
|
61
|
+
}
|
|
44
62
|
if (violations.length) {
|
|
45
63
|
console.error(
|
|
46
|
-
`[check-redirect-boundaries] FAIL: ${violations.join(', ')} wraps
|
|
47
|
-
'so a renamed product/collection gets a 200 + client redirect instead of a 308. ' +
|
|
64
|
+
`[check-redirect-boundaries] FAIL: ${violations.join(', ')} wraps a redirecting segment in a loading boundary, ` +
|
|
65
|
+
'so a renamed product/collection or a redirected path gets a 200 + client redirect instead of a 308. ' +
|
|
48
66
|
'Move the listing skeleton into the route group: app/products/(listing)/loading.tsx or app/collections/(listing)/loading.tsx.',
|
|
49
67
|
)
|
|
50
68
|
process.exit(1)
|
|
51
69
|
}
|
|
52
|
-
console.log('[check-redirect-boundaries] OK: no loading boundary above
|
|
70
|
+
console.log('[check-redirect-boundaries] OK: no loading boundary above a redirecting segment (products, collections, [...slug]).')
|
|
53
71
|
}
|
package/core-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated by scripts/build-manifest.mjs. Paths are relative to the storefront app root.",
|
|
3
3
|
"package": "@amboras-dev/storefront-core",
|
|
4
|
-
"version": "2026.11.
|
|
4
|
+
"version": "2026.11.5",
|
|
5
5
|
"shims": [
|
|
6
6
|
{
|
|
7
7
|
"path": "hooks/use-auth.ts",
|
|
@@ -443,6 +443,11 @@
|
|
|
443
443
|
"import": "@amboras-dev/storefront-core/lib/search-filters",
|
|
444
444
|
"kind": "reexport"
|
|
445
445
|
},
|
|
446
|
+
{
|
|
447
|
+
"path": "lib/seo.ts",
|
|
448
|
+
"import": "@amboras-dev/storefront-core/lib/seo",
|
|
449
|
+
"kind": "reexport"
|
|
450
|
+
},
|
|
446
451
|
{
|
|
447
452
|
"path": "lib/server-customer-auth.ts",
|
|
448
453
|
"import": "@amboras-dev/storefront-core/lib/server-customer-auth",
|
package/dist/lib/redirects.d.ts
CHANGED
|
@@ -14,13 +14,30 @@ export declare function safeRedirectTarget(target: unknown): string | null;
|
|
|
14
14
|
export declare function resolveRedirect(path: string): Promise<string | null>;
|
|
15
15
|
/** `decodeURIComponent`, or the value unchanged when it is not valid percent-encoding. */
|
|
16
16
|
export declare function safeDecode(value: string): string;
|
|
17
|
+
/** The redirect for a missing product/collection handle. */
|
|
18
|
+
export declare function resolveHandleRedirect(kind: 'product' | 'collection', handle: string): Promise<string | null>;
|
|
19
|
+
/** The query of a Next page's `searchParams`. */
|
|
20
|
+
export type RedirectSearchParams = Record<string, string | string[] | undefined>;
|
|
21
|
+
export interface UnmatchedPathRequest {
|
|
22
|
+
/** The `[...slug]` segments of the request, as Next hands them over (encoded or not). */
|
|
23
|
+
segments: readonly string[];
|
|
24
|
+
/** The request's query: appended to a path target on this store unless the target carries its own. */
|
|
25
|
+
searchParams?: RedirectSearchParams;
|
|
26
|
+
/** The request's `Host` (`x-forwarded-host` first): a target on this host is treated as a path. */
|
|
27
|
+
requestHost?: string | null;
|
|
28
|
+
}
|
|
17
29
|
/**
|
|
18
|
-
* The redirect for a
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
30
|
+
* The redirect for a path no route served (the store's `app/[...slug]` page,
|
|
31
|
+
* which only renders when nothing else matches): where to send the visitor
|
|
32
|
+
* (the page answers 308), or `null` for a real 404.
|
|
33
|
+
*
|
|
34
|
+
* One hop, never a second lookup. The store API refuses a cycle of RELATIVE
|
|
35
|
+
* stored redirects when they are created; a target that leads straight back to
|
|
36
|
+
* the requested path (also through the store's own hosts) is dropped here. A
|
|
37
|
+
* cycle of two redirects through an absolute URL on the store's own host is
|
|
38
|
+
* not refused by either side.
|
|
22
39
|
*/
|
|
23
|
-
export declare function
|
|
40
|
+
export declare function resolveUnmatchedPathRedirect({ segments, searchParams, requestHost, }: UnmatchedPathRequest): Promise<string | null>;
|
|
24
41
|
/**
|
|
25
42
|
* The API answers an OLD handle with the product's current one (the store API
|
|
26
43
|
* re-runs the lookup through the redirect). When the handles differ, the page
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../src/lib/redirects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../src/lib/redirects.ts"],"names":[],"mappings":"AAoBA,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAkBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAWjE;AAeD,qGAAqG;AACrG,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAK1E;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAcD,4DAA4D;AAC5D,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAIlH;AAED,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;AAEhF,MAAM,WAAW,oBAAoB;IACnC,yFAAyF;IACzF,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,sGAAsG;IACtG,YAAY,CAAC,EAAE,oBAAoB,CAAA;IACnC,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAwCD;;;;;;;;;;GAUG;AACH,wBAAsB,4BAA4B,CAAC,EACjD,QAAQ,EACR,YAAiB,EACjB,WAAW,GACZ,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG3F"}
|
package/dist/lib/redirects.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { collectionPath, productPath } from './paths.js';
|
|
2
|
+
import { siteMetadataBase } from './site-url.js';
|
|
2
3
|
import { storeGetJson } from './store-api.js';
|
|
3
4
|
/** `/store/url-redirects?path=<path>` — the path is query-encoded exactly once. */
|
|
4
5
|
export function buildRedirectLookupPath(path) {
|
|
@@ -76,21 +77,81 @@ export function safeDecode(value) {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
|
-
* The redirect for a
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* the
|
|
80
|
+
* The redirect for a path stored as the merchant typed it. Redirects keep the
|
|
81
|
+
* raw form (`/products/café`) but a browser sends the encoded one
|
|
82
|
+
* (`/products/caf%C3%A9`): the encoded form is tried first, as the contract
|
|
83
|
+
* names it, and the raw form only when the two differ.
|
|
83
84
|
*/
|
|
84
|
-
|
|
85
|
-
const decoded = safeDecode(handle);
|
|
86
|
-
const encodedPath = kind === 'product' ? productPath(decoded) : collectionPath(decoded);
|
|
85
|
+
async function resolveEncodedOrRaw(encodedPath, rawPath) {
|
|
87
86
|
const hit = await resolveRedirect(encodedPath);
|
|
88
87
|
if (hit)
|
|
89
88
|
return hit;
|
|
90
|
-
const prefix = kind === 'product' ? '/products/' : '/collections/';
|
|
91
|
-
const rawPath = prefix + decoded;
|
|
92
89
|
return rawPath !== encodedPath ? resolveRedirect(rawPath) : null;
|
|
93
90
|
}
|
|
91
|
+
/** The redirect for a missing product/collection handle. */
|
|
92
|
+
export async function resolveHandleRedirect(kind, handle) {
|
|
93
|
+
const decoded = safeDecode(handle);
|
|
94
|
+
const prefix = kind === 'product' ? '/products/' : '/collections/';
|
|
95
|
+
return resolveEncodedOrRaw(kind === 'product' ? productPath(decoded) : collectionPath(decoded), prefix + decoded);
|
|
96
|
+
}
|
|
97
|
+
function searchString(searchParams) {
|
|
98
|
+
const query = new URLSearchParams();
|
|
99
|
+
for (const [key, value] of Object.entries(searchParams)) {
|
|
100
|
+
if (Array.isArray(value))
|
|
101
|
+
value.forEach((v) => query.append(key, v));
|
|
102
|
+
else if (value !== undefined)
|
|
103
|
+
query.append(key, value);
|
|
104
|
+
}
|
|
105
|
+
return query.toString();
|
|
106
|
+
}
|
|
107
|
+
/** The path part of a same-site target, without its query or fragment. */
|
|
108
|
+
function pathOf(target) {
|
|
109
|
+
return target.split(/[?#]/, 1)[0];
|
|
110
|
+
}
|
|
111
|
+
/** `host` and its `www.` twin: the primary host of a store is answered on both (one 308s to the other). */
|
|
112
|
+
function withWwwTwin(host) {
|
|
113
|
+
return [host, host.startsWith('www.') ? host.slice(4) : `www.${host}`];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* An absolute target on one of the store's own hosts (the request's, or the primary host and its `www.`
|
|
117
|
+
* twin) becomes a path (null when that path is unsafe).
|
|
118
|
+
*/
|
|
119
|
+
function toSameSiteTarget(target, requestHost) {
|
|
120
|
+
if (target.startsWith('/'))
|
|
121
|
+
return target;
|
|
122
|
+
const primary = siteMetadataBase()?.host;
|
|
123
|
+
const ownHosts = [requestHost?.split(',', 1)[0].trim().toLowerCase(), ...(primary ? withWwwTwin(primary) : [])];
|
|
124
|
+
const url = new URL(target); // `safeRedirectTarget` guarantees an absolute http(s) URL here
|
|
125
|
+
return ownHosts.includes(url.host) ? safeRedirectTarget(url.pathname + url.search + url.hash) : target;
|
|
126
|
+
}
|
|
127
|
+
function withQuery(target, query) {
|
|
128
|
+
const hashAt = target.indexOf('#');
|
|
129
|
+
const base = hashAt < 0 ? target : target.slice(0, hashAt);
|
|
130
|
+
if (!query || base.includes('?'))
|
|
131
|
+
return target;
|
|
132
|
+
return `${base}?${query}${hashAt < 0 ? '' : target.slice(hashAt)}`;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The redirect for a path no route served (the store's `app/[...slug]` page,
|
|
136
|
+
* which only renders when nothing else matches): where to send the visitor
|
|
137
|
+
* (the page answers 308), or `null` for a real 404.
|
|
138
|
+
*
|
|
139
|
+
* One hop, never a second lookup. The store API refuses a cycle of RELATIVE
|
|
140
|
+
* stored redirects when they are created; a target that leads straight back to
|
|
141
|
+
* the requested path (also through the store's own hosts) is dropped here. A
|
|
142
|
+
* cycle of two redirects through an absolute URL on the store's own host is
|
|
143
|
+
* not refused by either side.
|
|
144
|
+
*/
|
|
145
|
+
export async function resolveUnmatchedPathRedirect({ segments, searchParams = {}, requestHost, }) {
|
|
146
|
+
const decoded = segments.map(safeDecode);
|
|
147
|
+
const encodedPath = `/${decoded.map(encodeURIComponent).join('/')}`;
|
|
148
|
+
const hit = await resolveEncodedOrRaw(encodedPath, `/${decoded.join('/')}`);
|
|
149
|
+
const target = hit && toSameSiteTarget(hit, requestHost);
|
|
150
|
+
if (!target || (target.startsWith('/') && samePath(pathOf(target), encodedPath)))
|
|
151
|
+
return null;
|
|
152
|
+
// The visitor's query (UTM, e-mail, discount params) stays on the store: never handed to another site.
|
|
153
|
+
return target.startsWith('/') ? withQuery(target, searchString(searchParams)) : target;
|
|
154
|
+
}
|
|
94
155
|
/**
|
|
95
156
|
* The API answers an OLD handle with the product's current one (the store API
|
|
96
157
|
* re-runs the lookup through the redirect). When the handles differ, the page
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.js","sourceRoot":"","sources":["../../src/lib/redirects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"redirects.js","sourceRoot":"","sources":["../../src/lib/redirects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAkB7C,mFAAmF;AACnF,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,wBAAwB,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAA;AAC3E,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC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ACxC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IACnE,MAAM,GAAG,GAAG,MAAM,mBAAmB,CAAC,WAAW,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC3E,MAAM,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACxD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IAC7F,uGAAuG;IACvG,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;AACxF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,MAAiC;IAChF,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACzB,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,UAAU,CAAC,SAAS,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { MetadataRoute } from 'next';
|
|
2
|
+
/** The static pages of the starter template: the default of `sitemap`'s `staticPaths`. A store that adds or deletes a page passes its own list. */
|
|
3
|
+
export declare const STATIC_SITEMAP_PATHS: readonly ["/", "/products", "/collections", "/about", "/contact", "/faq", "/shipping", "/refund-policy", "/privacy", "/terms", "/cookie-policy"];
|
|
4
|
+
interface Handled {
|
|
5
|
+
handle?: string | null;
|
|
6
|
+
updated_at?: string | Date | null;
|
|
7
|
+
}
|
|
8
|
+
/** Child 0: the static pages, then every collection with a handle. */
|
|
9
|
+
export declare function buildPagesSitemap(base: URL, collections: Handled[], staticPaths?: readonly string[]): MetadataRoute.Sitemap;
|
|
10
|
+
/** Children 1..N: the products of one page that have a handle. */
|
|
11
|
+
export declare function buildProductsSitemap(base: URL, products: Handled[]): MetadataRoute.Sitemap;
|
|
12
|
+
/**
|
|
13
|
+
* The ids Next serves under `<dir>/sitemap/<id>.xml` (it answers 404 for any other id, so it calls this on
|
|
14
|
+
* every child request: the count is one small cached Medusa call, shared by all children and the index).
|
|
15
|
+
* Re-export it from the store's `app/sitemaps/sitemap.ts` next to `sitemap`. No sitemap when no origin is
|
|
16
|
+
* known or off production.
|
|
17
|
+
*
|
|
18
|
+
* `next build` prerenders nothing here (the routes are request-time), so the build gets id `0` without
|
|
19
|
+
* calling Medusa: an outage must not fail the deploy.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateSitemaps(): Promise<Array<{
|
|
22
|
+
id: number;
|
|
23
|
+
}>>;
|
|
24
|
+
/**
|
|
25
|
+
* One child sitemap, from ONE Medusa call. Id `0` is the static pages and collections, id `n >= 1` is
|
|
26
|
+
* products page `n` (250 per page, ordered by `id` so paging is stable while the catalogue changes).
|
|
27
|
+
* `options.staticPaths` is the store's own list of static pages (default `STATIC_SITEMAP_PATHS`): the pages
|
|
28
|
+
* are store-owned, so a store that deletes `/faq` must stop advertising it. Rejects when Medusa fails rather
|
|
29
|
+
* than serving a partial sitemap.
|
|
30
|
+
*
|
|
31
|
+
* Awaits `connection()`: the sitemap is never prerendered, so `next build` does not call Medusa and the
|
|
32
|
+
* store's file needs no `dynamic = 'force-dynamic'` (which an edit could drop).
|
|
33
|
+
*/
|
|
34
|
+
export declare function sitemap(props: {
|
|
35
|
+
id: Promise<string> | string;
|
|
36
|
+
}, options?: {
|
|
37
|
+
staticPaths?: readonly string[];
|
|
38
|
+
}): Promise<MetadataRoute.Sitemap>;
|
|
39
|
+
/**
|
|
40
|
+
* The store's `/sitemap.xml`: a sitemap index linking every child on the primary host (Next generates
|
|
41
|
+
* the children, not the index). The store's `app/sitemap.xml/route.ts` re-exports it as `GET`. Children
|
|
42
|
+
* live at `/sitemaps/sitemap/<id>.xml`, i.e. in the store's `app/sitemaps/sitemap.ts`: Next refuses a
|
|
43
|
+
* `sitemap.ts` next to the `sitemap.xml` route at the app root. Awaits `connection()` like `sitemap`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sitemapIndex(): Promise<Response>;
|
|
46
|
+
/**
|
|
47
|
+
* The store's `robots.txt`: the sitemap is advertised on the primary host, so every host the store answers
|
|
48
|
+
* on agrees. Awaits `connection()` so the deploy kind is read per request, not frozen into a prerendered
|
|
49
|
+
* file (a preview build promoted to production would otherwise keep serving `Disallow: /`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function robots(): Promise<MetadataRoute.Robots>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=seo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../src/lib/seo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAOzC,mJAAmJ;AACnJ,eAAO,MAAM,oBAAoB,kJAYvB,CAAA;AAmCV,UAAU,OAAO;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;CAClC;AA0BD,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,GAAG,EACT,WAAW,EAAE,OAAO,EAAE,EACtB,WAAW,GAAE,SAAS,MAAM,EAAyB,GACpD,aAAa,CAAC,OAAO,CAKvB;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,OAAO,CAE1F;AAQD;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAIvE;AAED;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;CAAE,EACvC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAChD,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAmBhC;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAMtD;AAED;;;;GAIG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAQ5D"}
|
package/dist/lib/seo.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { connection } from 'next/server';
|
|
2
|
+
import { logger } from './logger.js';
|
|
3
|
+
import { collectionPath, productPath } from './paths.js';
|
|
4
|
+
import { siteMetadataBase } from './site-url.js';
|
|
5
|
+
import { medusaFetch } from './store-api.js';
|
|
6
|
+
/** The static pages of the starter template: the default of `sitemap`'s `staticPaths`. A store that adds or deletes a page passes its own list. */
|
|
7
|
+
export const STATIC_SITEMAP_PATHS = [
|
|
8
|
+
'/',
|
|
9
|
+
'/products',
|
|
10
|
+
'/collections',
|
|
11
|
+
'/about',
|
|
12
|
+
'/contact',
|
|
13
|
+
'/faq',
|
|
14
|
+
'/shipping',
|
|
15
|
+
'/refund-policy',
|
|
16
|
+
'/privacy',
|
|
17
|
+
'/terms',
|
|
18
|
+
'/cookie-policy',
|
|
19
|
+
];
|
|
20
|
+
const DISALLOWED_PATHS = ['/cart', '/checkout', '/account', '/auth', '/search', '/kit-gallery'];
|
|
21
|
+
/**
|
|
22
|
+
* A Vercel preview or development deploy (a draft, an A/B variant) is not for search engines: no
|
|
23
|
+
* sitemap and a blanket `Disallow`. Unset `VERCEL_ENV` (local dev, a non-Vercel host) is not a preview.
|
|
24
|
+
*/
|
|
25
|
+
function isPreviewDeploy() {
|
|
26
|
+
const env = process.env.VERCEL_ENV;
|
|
27
|
+
return !!env && env !== 'production';
|
|
28
|
+
}
|
|
29
|
+
/** The primary origin the sitemaps are built on; none off production. */
|
|
30
|
+
function sitemapBase() {
|
|
31
|
+
return isPreviewDeploy() ? undefined : siteMetadataBase();
|
|
32
|
+
}
|
|
33
|
+
// One Medusa call per child sitemap, so each child is one small data-cache entry and a crawler hit never
|
|
34
|
+
// walks the catalogue.
|
|
35
|
+
/**
|
|
36
|
+
* Products per child: Shopify's page size, and the cap Medusa plans to lower `/store/products` to (its
|
|
37
|
+
* `sort.ts` `clampStoreLimit`). The page size is also the offset step, so a larger store cap must never be
|
|
38
|
+
* assumed: `sitemap` throws when Medusa answers fewer products than a full page.
|
|
39
|
+
*/
|
|
40
|
+
const PRODUCTS_PER_SITEMAP = 250;
|
|
41
|
+
/** Medusa's store collections page cap. */
|
|
42
|
+
const COLLECTIONS_PER_SITEMAP = 250;
|
|
43
|
+
const REVALIDATE_SECONDS = 3600;
|
|
44
|
+
/** Where the store's `app/sitemaps/sitemap.ts` serves the children (`<dir>/sitemap/<id>.xml`). */
|
|
45
|
+
const SITEMAP_CHILDREN_PATH = '/sitemaps/sitemap';
|
|
46
|
+
const LIST_FIELDS = 'handle,updated_at';
|
|
47
|
+
/**
|
|
48
|
+
* One page of `/store/<resource>`, cached per URL by Next (the pattern of `storeGetJson`). Unlike
|
|
49
|
+
* `storeGetJson` it rejects on any failure, so the route answers 5xx (which crawlers retry) instead of
|
|
50
|
+
* serving a partial sitemap, and Next never caches a failure.
|
|
51
|
+
*/
|
|
52
|
+
async function listPage(resource, query) {
|
|
53
|
+
const params = new URLSearchParams(Object.entries(query).map(([key, value]) => [key, String(value)]));
|
|
54
|
+
const res = await medusaFetch(`/store/${resource}?${params}`, { next: { revalidate: REVALIDATE_SECONDS } });
|
|
55
|
+
if (!res.ok)
|
|
56
|
+
throw new Error(`Medusa /store/${resource} answered ${res.status}`);
|
|
57
|
+
const body = (await res.json());
|
|
58
|
+
return { items: body[resource] ?? [], count: body.count ?? 0, limit: body.limit };
|
|
59
|
+
}
|
|
60
|
+
function entry(base, path, updatedAt) {
|
|
61
|
+
return { url: new URL(path, base).href, ...(updatedAt ? { lastModified: updatedAt } : {}) };
|
|
62
|
+
}
|
|
63
|
+
/** Child 0: the static pages, then every collection with a handle. */
|
|
64
|
+
export function buildPagesSitemap(base, collections, staticPaths = STATIC_SITEMAP_PATHS) {
|
|
65
|
+
return [
|
|
66
|
+
...staticPaths.map((path) => entry(base, path)),
|
|
67
|
+
...collections.flatMap((c) => (c.handle ? [entry(base, collectionPath(c.handle), c.updated_at)] : [])),
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
/** Children 1..N: the products of one page that have a handle. */
|
|
71
|
+
export function buildProductsSitemap(base, products) {
|
|
72
|
+
return products.flatMap((p) => (p.handle ? [entry(base, productPath(p.handle), p.updated_at)] : []));
|
|
73
|
+
}
|
|
74
|
+
/** How many children the store has: `0` (static pages + collections), then one per 250 products. */
|
|
75
|
+
async function childIds() {
|
|
76
|
+
const { count } = await listPage('products', { limit: 1, fields: 'id' });
|
|
77
|
+
return Array.from({ length: 1 + Math.ceil(count / PRODUCTS_PER_SITEMAP) }, (_, id) => id);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The ids Next serves under `<dir>/sitemap/<id>.xml` (it answers 404 for any other id, so it calls this on
|
|
81
|
+
* every child request: the count is one small cached Medusa call, shared by all children and the index).
|
|
82
|
+
* Re-export it from the store's `app/sitemaps/sitemap.ts` next to `sitemap`. No sitemap when no origin is
|
|
83
|
+
* known or off production.
|
|
84
|
+
*
|
|
85
|
+
* `next build` prerenders nothing here (the routes are request-time), so the build gets id `0` without
|
|
86
|
+
* calling Medusa: an outage must not fail the deploy.
|
|
87
|
+
*/
|
|
88
|
+
export async function generateSitemaps() {
|
|
89
|
+
if (!sitemapBase())
|
|
90
|
+
return [];
|
|
91
|
+
if (process.env.NEXT_PHASE === 'phase-production-build')
|
|
92
|
+
return [{ id: 0 }];
|
|
93
|
+
return (await childIds()).map((id) => ({ id }));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* One child sitemap, from ONE Medusa call. Id `0` is the static pages and collections, id `n >= 1` is
|
|
97
|
+
* products page `n` (250 per page, ordered by `id` so paging is stable while the catalogue changes).
|
|
98
|
+
* `options.staticPaths` is the store's own list of static pages (default `STATIC_SITEMAP_PATHS`): the pages
|
|
99
|
+
* are store-owned, so a store that deletes `/faq` must stop advertising it. Rejects when Medusa fails rather
|
|
100
|
+
* than serving a partial sitemap.
|
|
101
|
+
*
|
|
102
|
+
* Awaits `connection()`: the sitemap is never prerendered, so `next build` does not call Medusa and the
|
|
103
|
+
* store's file needs no `dynamic = 'force-dynamic'` (which an edit could drop).
|
|
104
|
+
*/
|
|
105
|
+
export async function sitemap(props, options = {}) {
|
|
106
|
+
await connection();
|
|
107
|
+
const base = sitemapBase();
|
|
108
|
+
const id = Number(await props.id);
|
|
109
|
+
if (!base || !Number.isInteger(id) || id < 0)
|
|
110
|
+
return [];
|
|
111
|
+
if (id === 0) {
|
|
112
|
+
const { items, count } = await listPage('collections', { limit: COLLECTIONS_PER_SITEMAP, fields: LIST_FIELDS });
|
|
113
|
+
if (count > items.length)
|
|
114
|
+
logger.warn(`sitemap: ${count - items.length} of ${count} collections are over the page cap and left out`);
|
|
115
|
+
return buildPagesSitemap(base, items, options.staticPaths);
|
|
116
|
+
}
|
|
117
|
+
const offset = (id - 1) * PRODUCTS_PER_SITEMAP;
|
|
118
|
+
const { items, count, limit } = await listPage('products', { limit: PRODUCTS_PER_SITEMAP, offset, order: 'id', fields: LIST_FIELDS });
|
|
119
|
+
// Medusa clamps `limit` silently. Children are `PRODUCTS_PER_SITEMAP` apart, so a smaller page would drop
|
|
120
|
+
// the products between pages without an error: reject, and crawlers retry instead of indexing a hole.
|
|
121
|
+
const expected = Math.min(PRODUCTS_PER_SITEMAP, Math.max(count - offset, 0));
|
|
122
|
+
if ((limit !== undefined && limit < PRODUCTS_PER_SITEMAP) || items.length < expected) {
|
|
123
|
+
throw new Error(`Medusa /store/products returned ${items.length} of ${expected} products for sitemap ${id} (page size ${limit ?? 'unknown'}, wanted ${PRODUCTS_PER_SITEMAP})`);
|
|
124
|
+
}
|
|
125
|
+
return buildProductsSitemap(base, items);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The store's `/sitemap.xml`: a sitemap index linking every child on the primary host (Next generates
|
|
129
|
+
* the children, not the index). The store's `app/sitemap.xml/route.ts` re-exports it as `GET`. Children
|
|
130
|
+
* live at `/sitemaps/sitemap/<id>.xml`, i.e. in the store's `app/sitemaps/sitemap.ts`: Next refuses a
|
|
131
|
+
* `sitemap.ts` next to the `sitemap.xml` route at the app root. Awaits `connection()` like `sitemap`.
|
|
132
|
+
*/
|
|
133
|
+
export async function sitemapIndex() {
|
|
134
|
+
await connection();
|
|
135
|
+
const base = sitemapBase();
|
|
136
|
+
const locs = base ? (await childIds()).map((id) => `<sitemap><loc>${new URL(`${SITEMAP_CHILDREN_PATH}/${id}.xml`, base).href}</loc></sitemap>`) : [];
|
|
137
|
+
const xml = `<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${locs.join('')}</sitemapindex>`;
|
|
138
|
+
return new Response(xml, { headers: { 'Content-Type': 'application/xml' } });
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The store's `robots.txt`: the sitemap is advertised on the primary host, so every host the store answers
|
|
142
|
+
* on agrees. Awaits `connection()` so the deploy kind is read per request, not frozen into a prerendered
|
|
143
|
+
* file (a preview build promoted to production would otherwise keep serving `Disallow: /`).
|
|
144
|
+
*/
|
|
145
|
+
export async function robots() {
|
|
146
|
+
await connection();
|
|
147
|
+
if (isPreviewDeploy())
|
|
148
|
+
return { rules: { userAgent: '*', disallow: '/' } };
|
|
149
|
+
const base = siteMetadataBase();
|
|
150
|
+
return {
|
|
151
|
+
rules: { userAgent: '*', allow: '/', disallow: DISALLOWED_PATHS },
|
|
152
|
+
...(base ? { sitemap: new URL('/sitemap.xml', base).href } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=seo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seo.js","sourceRoot":"","sources":["../../src/lib/seo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,mJAAmJ;AACnJ,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG;IACH,WAAW;IACX,cAAc;IACd,QAAQ;IACR,UAAU;IACV,MAAM;IACN,WAAW;IACX,gBAAgB;IAChB,UAAU;IACV,QAAQ;IACR,gBAAgB;CACR,CAAA;AAEV,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAA;AAE/F;;;GAGG;AACH,SAAS,eAAe;IACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA;IAClC,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,YAAY,CAAA;AACtC,CAAC;AAED,yEAAyE;AACzE,SAAS,WAAW;IAClB,OAAO,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAA;AAC3D,CAAC;AAED,yGAAyG;AACzG,uBAAuB;AACvB;;;;GAIG;AACH,MAAM,oBA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E,EAAE,cAAc,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI,eAAe,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAA;IAC1E,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAA;IAC/B,OAAO;QACL,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,gBAAgB,EAAE;QACjE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAA;AACH,CAAC"}
|
package/dist/lib/site-url.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `openGraph.url` are relative
|
|
2
|
+
* The store's canonical public origin, shared by `metadataBase`, `robots` and
|
|
3
|
+
* `sitemap` (`lib/seo`): canonical URLs and `openGraph.url` are relative and
|
|
4
|
+
* Next resolves them against it.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* and
|
|
6
|
+
* `NEXT_PUBLIC_SITE_URL` is written by the orchestrator (`hosting_env`) as the
|
|
7
|
+
* store's PRIMARY host (`https://<host>`), else its slug URL, so every host the
|
|
8
|
+
* store answers on points search engines at one origin. Until that variable
|
|
9
|
+
* exists on a project (a store's first publish), fall back to Vercel's system
|
|
10
|
+
* env `VERCEL_PROJECT_PRODUCTION_URL` (a host without scheme). A malformed value falls
|
|
11
|
+
* through to the next candidate, and a value with a path keeps only its origin.
|
|
12
|
+
* Both unset (local dev) or malformed → `undefined`, and Next keeps its own default.
|
|
13
|
+
*
|
|
14
|
+
* Server-only read (the root layout's `generateMetadata` and the `robots` /
|
|
15
|
+
* `sitemap` routes), so it reads the runtime environment rather than going
|
|
16
|
+
* through `configureCore`, which exists for variables the browser needs too.
|
|
11
17
|
*/
|
|
12
18
|
export declare function siteMetadataBase(env?: Record<string, string | undefined>): URL | undefined;
|
|
13
19
|
//# sourceMappingURL=site-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-url.d.ts","sourceRoot":"","sources":["../../src/lib/site-url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"site-url.d.ts","sourceRoot":"","sources":["../../src/lib/site-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,GAAG,GAAG,SAAS,CAYvG"}
|
package/dist/lib/site-url.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `openGraph.url` are relative
|
|
2
|
+
* The store's canonical public origin, shared by `metadataBase`, `robots` and
|
|
3
|
+
* `sitemap` (`lib/seo`): canonical URLs and `openGraph.url` are relative and
|
|
4
|
+
* Next resolves them against it.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* and
|
|
6
|
+
* `NEXT_PUBLIC_SITE_URL` is written by the orchestrator (`hosting_env`) as the
|
|
7
|
+
* store's PRIMARY host (`https://<host>`), else its slug URL, so every host the
|
|
8
|
+
* store answers on points search engines at one origin. Until that variable
|
|
9
|
+
* exists on a project (a store's first publish), fall back to Vercel's system
|
|
10
|
+
* env `VERCEL_PROJECT_PRODUCTION_URL` (a host without scheme). A malformed value falls
|
|
11
|
+
* through to the next candidate, and a value with a path keeps only its origin.
|
|
12
|
+
* Both unset (local dev) or malformed → `undefined`, and Next keeps its own default.
|
|
13
|
+
*
|
|
14
|
+
* Server-only read (the root layout's `generateMetadata` and the `robots` /
|
|
15
|
+
* `sitemap` routes), so it reads the runtime environment rather than going
|
|
16
|
+
* through `configureCore`, which exists for variables the browser needs too.
|
|
11
17
|
*/
|
|
12
18
|
export function siteMetadataBase(env = process.env) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// Each candidate in order: a malformed primary value must not hide a usable fallback.
|
|
20
|
+
for (const candidate of [env.NEXT_PUBLIC_SITE_URL, env.VERCEL_PROJECT_PRODUCTION_URL]) {
|
|
21
|
+
const host = candidate?.trim().replace(/^https?:\/\//i, '');
|
|
22
|
+
if (!host)
|
|
23
|
+
continue;
|
|
24
|
+
try {
|
|
25
|
+
return new URL(new URL(`https://${host}`).origin);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
21
30
|
}
|
|
31
|
+
return undefined;
|
|
22
32
|
}
|
|
23
33
|
//# sourceMappingURL=site-url.js.map
|
package/dist/lib/site-url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-url.js","sourceRoot":"","sources":["../../src/lib/site-url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"site-url.js","sourceRoot":"","sources":["../../src/lib/site-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA0C,OAAO,CAAC,GAAG;IACpF,sFAAsF;IACtF,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC;QACtF,MAAM,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC3D,IAAI,CAAC,IAAI;YAAE,SAAQ;QACnB,IAAI,CAAC;YACH,OAAO,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;QACnD,CAAC;QAAC,MAAM,CAAC;YACP,SAAQ;QACV,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amboras-dev/storefront-core",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.5",
|
|
4
4
|
"description": "The platform half of every Amboras storefront: cart, checkout, payments, auth, orders, subscriptions, catalogue data, analytics, consent, plugin slots, edge proxy and the Next config. Stores keep only design; they import this. ESM, React 19, Next 16.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@stripe/stripe-js": ">=8.11.0",
|
|
103
103
|
"@tanstack/react-query": ">=5.17.19",
|
|
104
104
|
"lucide-react": ">=1.0.1",
|
|
105
|
-
"next": ">=16.3.
|
|
105
|
+
"next": ">=16.3.0",
|
|
106
106
|
"posthog-js": ">=1.200.0",
|
|
107
107
|
"react": ">=19.0.0",
|
|
108
108
|
"react-dom": ">=19.0.0",
|