@se-studio/core-ui 1.48.7 → 1.50.0
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 +27 -0
- package/dist/__mocks__/core-ui-self.d.ts +5 -0
- package/dist/__mocks__/core-ui-self.d.ts.map +1 -0
- package/dist/__mocks__/core-ui-self.js +5 -0
- package/dist/__mocks__/core-ui-self.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/proxy/index.d.ts +29 -0
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/index.js +34 -0
- package/dist/proxy/index.js.map +1 -0
- package/dist/server/createPreviewPage.d.ts +87 -0
- package/dist/server/createPreviewPage.d.ts.map +1 -0
- package/dist/server/createPreviewPage.js +75 -0
- package/dist/server/createPreviewPage.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/utils/impossibleCmsSlug.d.ts +2 -2
- package/dist/utils/impossibleCmsSlug.d.ts.map +1 -1
- package/dist/utils/impossibleCmsSlug.js +2 -2
- package/dist/utils/impossibleCmsSlug.js.map +1 -1
- package/dist/utils/previewPageUtils.d.ts +15 -0
- package/dist/utils/previewPageUtils.d.ts.map +1 -1
- package/dist/utils/previewPageUtils.js +26 -0
- package/dist/utils/previewPageUtils.js.map +1 -1
- package/dist/well-known/generated.d.ts +1 -1
- package/dist/well-known/generated.js +1 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @se-studio/core-ui
|
|
2
2
|
|
|
3
|
+
## 1.50.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2eda093: Add `createPreviewPage` to `@se-studio/core-ui/server`: a core-owned `/preview` route for Contentful "Open preview". Default `mode: 'redirect'` sends the editor to the entry's live URL; `mode: 'render'` draws the draft in place through a site-supplied `render(info)` shell. Core owns the secret check (`strictSecret` fails closed, default on for `render`), the entry lookup, a same-site redirect-target check (`isSafePreviewRedirectTarget`, new, also exported from the root), and route metadata (`PREVIEW_PAGE_METADATA`: noindex, nofollow, nocache, no referrer, because the URL carries the secret). The core template's `/preview` page now uses it with no behaviour change in redirect mode apart from the redirect-target check and the page-level noindex.
|
|
8
|
+
|
|
9
|
+
## 1.49.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 1b8c130: Core now owns the site proxy redirect rules, so sites stop hand-copying them. core-data-types adds the pure `pagePathNeedingTrailingSlashRedirect(pathname)` and `findCmsRedirect(pathname, map)` (plus the `CmsRedirectMap`, `CmsRedirectRule` and `CmsRedirectMatch` types), re-exported by core-ui. core-ui adds a `@se-studio/core-ui/proxy` subpath with the Next adapters `applyTrailingSlashRedirect(request)` (308, query string kept) and `applyCmsRedirects(request, map, { preserveSearch })`, which return a `NextResponse` or null so a site keeps its own `proxy()` order. A dotted last segment is treated as `hasStaticAssetExtension` and `hasDotfileSegment` do: real asset extensions and dotfiles are skipped, while a dotted CMS slug (`/blog/st.-louis`) still gets the trailing-slash 308 and its CMS redirect. The core template app now uses the export. Not a breaking change; sites switch in the next bump pass.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [1b8c130]
|
|
18
|
+
- @se-studio/core-data-types@2.3.0
|
|
19
|
+
- @se-studio/contentful-rest-api@2.9.5
|
|
20
|
+
|
|
21
|
+
## 1.48.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- c82e3a6: Follow-up to the dotted From path fix. In 2.9.3, a From path with a dot is kept unless it ends in a static-asset extension, so `/.env`, `/.git`, `/wp-login.php`, `/backup.tar.gz` and `/feed.rss` were also kept; now they are rejected. `hasStaticAssetExtension` (core-data-types, re-exported by core-ui) also treats `.php`, `.gz` and `.rss` as files; the impossible-slug guard's own exemption list is unchanged, so a `.php` sitemap URL is still flagged. New `hasDotfileSegment` rejects any dotfile path segment except `/.well-known`. The site proxy template's trailing-slash helper now uses both, so `/blog/st.-louis` gets its 308 to `/blog/st.-louis/` while `/feed.xml` and `/.env` do not. site-check's sitemap parity stage now recognises a sitemap by its root element only (a prolog, comment, stylesheet or namespace prefix is fine; an HTML page that mentions `<urlset>` is not).
|
|
26
|
+
- Updated dependencies [c82e3a6]
|
|
27
|
+
- @se-studio/contentful-rest-api@2.9.4
|
|
28
|
+
- @se-studio/core-data-types@2.2.2
|
|
29
|
+
|
|
3
30
|
## 1.48.7
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { cacheableNotFoundResponseInit, hasDotfileSegment, hasStaticAssetExtension, } from '../utils/impossibleCmsSlug';
|
|
2
|
+
export declare const apiPathNeedingTrailingSlash: () => null;
|
|
3
|
+
export declare const appendAgentDiscoveryLinkHeaders: () => void;
|
|
4
|
+
export declare const resolveMarkdownNegotiationPath: () => null;
|
|
5
|
+
//# sourceMappingURL=core-ui-self.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-ui-self.d.ts","sourceRoot":"","sources":["../../src/__mocks__/core-ui-self.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,2BAA2B,QAAO,IAAY,CAAC;AAC5D,eAAO,MAAM,+BAA+B,QAAO,IAAiB,CAAC;AACrE,eAAO,MAAM,8BAA8B,QAAO,IAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { cacheableNotFoundResponseInit, hasDotfileSegment, hasStaticAssetExtension, } from '../utils/impossibleCmsSlug';
|
|
2
|
+
export const apiPathNeedingTrailingSlash = () => null;
|
|
3
|
+
export const appendAgentDiscoveryLinkHeaders = () => undefined;
|
|
4
|
+
export const resolveMarkdownNegotiationPath = () => null;
|
|
5
|
+
//# sourceMappingURL=core-ui-self.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-ui-self.js","sourceRoot":"","sources":["../../src/__mocks__/core-ui-self.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAS,EAAE,CAAC,IAAI,CAAC;AAC5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AACrE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAS,EAAE,CAAC,IAAI,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type { RenderMark, RenderNode, RenderText } from '@contentful/rich-text-react-renderer';
|
|
2
|
+
export type { CmsRedirectMap, CmsRedirectMatch, CmsRedirectRule, } from '@se-studio/core-data-types';
|
|
3
|
+
export { findCmsRedirect, pagePathNeedingTrailingSlashRedirect, } from '@se-studio/core-data-types';
|
|
2
4
|
export type { AnalyticsPageTrackerProps } from './analytics/AnalyticsPageTracker';
|
|
3
5
|
export { AnalyticsPageTracker } from './analytics/AnalyticsPageTracker';
|
|
4
6
|
export { AnalyticsProvider, useAnalyticsContext } from './analytics/AnalyticsProvider';
|
|
@@ -84,7 +86,7 @@ export { handleCmsError } from './utils/errorHandling';
|
|
|
84
86
|
export { captureException, initErrorMonitoring } from './utils/errorMonitoring';
|
|
85
87
|
export type { HtmlComponentExternalScriptAllowlist } from './utils/htmlComponentExternalScripts';
|
|
86
88
|
export { filterAllowedHtmlComponentScriptUrls, htmlComponentExternalScriptId, isAllowedHtmlComponentScriptUrl, } from './utils/htmlComponentExternalScripts';
|
|
87
|
-
export { CACHEABLE_NOT_FOUND_CACHE_CONTROL, CMS_PROXY_MATCHERS, cacheableNotFoundResponseInit, hasStaticAssetExtension, isImpossibleCmsSlug, pathnameHasImpossibleCmsSlug, } from './utils/impossibleCmsSlug';
|
|
89
|
+
export { CACHEABLE_NOT_FOUND_CACHE_CONTROL, CMS_PROXY_MATCHERS, cacheableNotFoundResponseInit, hasDotfileSegment, hasStaticAssetExtension, isImpossibleCmsSlug, pathnameHasImpossibleCmsSlug, } from './utils/impossibleCmsSlug';
|
|
88
90
|
export { joinCmsPathSegments } from './utils/joinCmsPathSegments';
|
|
89
91
|
export { getLinkAriaLabel } from './utils/linkAccessibility';
|
|
90
92
|
export type { ListingPageContext, ListingScope } from './utils/listing-page-heading';
|
|
@@ -92,7 +94,7 @@ export { resolveListingPageHeading } from './utils/listing-page-heading';
|
|
|
92
94
|
export type { MarketingSiteSitemapConfig } from './utils/marketingSiteSitemap';
|
|
93
95
|
export { CMS_HOMEPAGE_SLUG, controlSlugFromCanonicalPath, resolvePageTestControlSlug, } from './utils/pageTestControlSlug';
|
|
94
96
|
export type { PreviewSecretValidation } from './utils/previewPageUtils';
|
|
95
|
-
export { validatePreviewSecret } from './utils/previewPageUtils';
|
|
97
|
+
export { isSafePreviewRedirectTarget, validatePreviewSecret } from './utils/previewPageUtils';
|
|
96
98
|
export type { IContent } from './utils/previewUtils';
|
|
97
99
|
export { coreGetPreviewAssetIdProps, coreGetPreviewFieldIdProps, coreGetPreviewParentProps, coreGetPreviewProps, getPreviewFieldProps, getPreviewResponsiveVisualFieldProps, } from './utils/previewUtils';
|
|
98
100
|
export { processCollectionLinks } from './utils/processCollectionLinks';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAC/F,YAAY,EA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,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { findCmsRedirect, pagePathNeedingTrailingSlashRedirect, } from '@se-studio/core-data-types';
|
|
1
2
|
export { AnalyticsPageTracker } from './analytics/AnalyticsPageTracker';
|
|
2
3
|
export { AnalyticsProvider, useAnalyticsContext } from './analytics/AnalyticsProvider';
|
|
3
4
|
export { CompositeAnalyticsAdapter, ConsentAwareAdapter, ConsoleAnalyticsAdapter, GoogleTagManagerAdapter, isProductionAnalytics, } from './analytics/adapters';
|
|
@@ -59,12 +60,12 @@ export { createDefaultRenderText } from './utils/createDefaultRenderText';
|
|
|
59
60
|
export { handleCmsError } from './utils/errorHandling';
|
|
60
61
|
export { captureException, initErrorMonitoring } from './utils/errorMonitoring';
|
|
61
62
|
export { filterAllowedHtmlComponentScriptUrls, htmlComponentExternalScriptId, isAllowedHtmlComponentScriptUrl, } from './utils/htmlComponentExternalScripts';
|
|
62
|
-
export { CACHEABLE_NOT_FOUND_CACHE_CONTROL, CMS_PROXY_MATCHERS, cacheableNotFoundResponseInit, hasStaticAssetExtension, isImpossibleCmsSlug, pathnameHasImpossibleCmsSlug, } from './utils/impossibleCmsSlug';
|
|
63
|
+
export { CACHEABLE_NOT_FOUND_CACHE_CONTROL, CMS_PROXY_MATCHERS, cacheableNotFoundResponseInit, hasDotfileSegment, hasStaticAssetExtension, isImpossibleCmsSlug, pathnameHasImpossibleCmsSlug, } from './utils/impossibleCmsSlug';
|
|
63
64
|
export { joinCmsPathSegments } from './utils/joinCmsPathSegments';
|
|
64
65
|
export { getLinkAriaLabel } from './utils/linkAccessibility';
|
|
65
66
|
export { resolveListingPageHeading } from './utils/listing-page-heading';
|
|
66
67
|
export { CMS_HOMEPAGE_SLUG, controlSlugFromCanonicalPath, resolvePageTestControlSlug, } from './utils/pageTestControlSlug';
|
|
67
|
-
export { validatePreviewSecret } from './utils/previewPageUtils';
|
|
68
|
+
export { isSafePreviewRedirectTarget, validatePreviewSecret } from './utils/previewPageUtils';
|
|
68
69
|
export { coreGetPreviewAssetIdProps, coreGetPreviewFieldIdProps, coreGetPreviewParentProps, coreGetPreviewProps, getPreviewFieldProps, getPreviewResponsiveVisualFieldProps, } from './utils/previewUtils';
|
|
69
70
|
export { processCollectionLinks } from './utils/processCollectionLinks';
|
|
70
71
|
export { processTextContent } from './utils/processTextContent';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,eAAe,EACf,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEvF,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,mBAAmB,EACnB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Z,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CmsRedirectMap } from '@se-studio/core-data-types';
|
|
2
|
+
import { type NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
/**
|
|
4
|
+
* Site `proxy.ts` redirect rules (`@se-studio/core-ui/proxy`). Core owns the rules, the site owns the
|
|
5
|
+
* order: call these from your own `proxy()` where the old local copies ran. Import from this subpath, not
|
|
6
|
+
* the core-ui barrel, so the Edge bundle stays small.
|
|
7
|
+
*/
|
|
8
|
+
export type { CmsRedirectMap, CmsRedirectMatch, CmsRedirectRule, } from '@se-studio/core-data-types';
|
|
9
|
+
export { findCmsRedirect, hasDotfileSegment, hasStaticAssetExtension, pagePathNeedingTrailingSlashRedirect, } from '@se-studio/core-data-types';
|
|
10
|
+
/**
|
|
11
|
+
* `preserveSearch` copies the request's query string onto the redirect target when the rule's `to` has
|
|
12
|
+
* none. Default false: the editor-managed rule is followed exactly, as the site proxies always have.
|
|
13
|
+
*/
|
|
14
|
+
export interface ApplyCmsRedirectsOptions {
|
|
15
|
+
preserveSearch?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 308 to the slashed path for a page path without a trailing slash (`/about` to `/about/`), keeping the
|
|
19
|
+
* query string. Reads the raw URL pathname, so a rewritten `nextUrl` cannot hide the missing slash.
|
|
20
|
+
* Returns null for `/`, asset files, dotfiles, `/api` and `/.well-known`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyTrailingSlashRedirect(request: NextRequest): NextResponse | null;
|
|
23
|
+
/**
|
|
24
|
+
* Applies the editor-managed CMS redirect map to `request.nextUrl.pathname` (see `findCmsRedirect` for
|
|
25
|
+
* the skip rules and matching order). Returns the redirect response, or null for the site proxy to carry
|
|
26
|
+
* on. The rule's `to` is resolved against the request URL, so it may be relative or absolute.
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyCmsRedirects(request: NextRequest, map: CmsRedirectMap, options?: ApplyCmsRedirectsOptions): NextResponse | null;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;GAIG;AACH,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,GAAG,IAAI,CAQpF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,OAAO,GAAE,wBAA6B,GACrC,YAAY,GAAG,IAAI,CAUrB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { findCmsRedirect, pagePathNeedingTrailingSlashRedirect, } from '@se-studio/core-data-types';
|
|
2
|
+
import { NextResponse } from 'next/server';
|
|
3
|
+
export { findCmsRedirect, hasDotfileSegment, hasStaticAssetExtension, pagePathNeedingTrailingSlashRedirect, } from '@se-studio/core-data-types';
|
|
4
|
+
/**
|
|
5
|
+
* 308 to the slashed path for a page path without a trailing slash (`/about` to `/about/`), keeping the
|
|
6
|
+
* query string. Reads the raw URL pathname, so a rewritten `nextUrl` cannot hide the missing slash.
|
|
7
|
+
* Returns null for `/`, asset files, dotfiles, `/api` and `/.well-known`.
|
|
8
|
+
*/
|
|
9
|
+
export function applyTrailingSlashRedirect(request) {
|
|
10
|
+
const url = new URL(request.url);
|
|
11
|
+
const slashPath = pagePathNeedingTrailingSlashRedirect(url.pathname);
|
|
12
|
+
if (!slashPath) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
url.pathname = slashPath;
|
|
16
|
+
return NextResponse.redirect(url, 308);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Applies the editor-managed CMS redirect map to `request.nextUrl.pathname` (see `findCmsRedirect` for
|
|
20
|
+
* the skip rules and matching order). Returns the redirect response, or null for the site proxy to carry
|
|
21
|
+
* on. The rule's `to` is resolved against the request URL, so it may be relative or absolute.
|
|
22
|
+
*/
|
|
23
|
+
export function applyCmsRedirects(request, map, options = {}) {
|
|
24
|
+
const match = findCmsRedirect(request.nextUrl.pathname, map);
|
|
25
|
+
if (!match) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const target = new URL(match.to, request.url);
|
|
29
|
+
if (options.preserveSearch && !target.search) {
|
|
30
|
+
target.search = request.nextUrl.search;
|
|
31
|
+
}
|
|
32
|
+
return NextResponse.redirect(target, { status: match.status });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingUR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AAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import type { BaseConverterContext, ContentfulConfig, FetchOptions, PreviewEntryInfo } from '@se-studio/contentful-rest-api';
|
|
3
|
+
import type { Metadata } from 'next';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
/** `redirect` sends the editor to the live URL of the entry; `render` draws the draft on /preview. */
|
|
6
|
+
export type PreviewPageMode = 'redirect' | 'render';
|
|
7
|
+
/**
|
|
8
|
+
* Shared options for both modes.
|
|
9
|
+
*
|
|
10
|
+
* - `converterContext`: resolves an entry id to its URL.
|
|
11
|
+
* - `getConfig`: Contentful config, always called with `true` (the lookup uses the Preview API).
|
|
12
|
+
* Sites pass `getContentfulConfig` from `@/lib/cms-server`.
|
|
13
|
+
* - `getFetchOptions`: extra fetch options for the lookup, for example `buildOptions()`.
|
|
14
|
+
* - `isEnabled`: gate for the whole route. False 404s before any query is read. The template
|
|
15
|
+
* passes `() => buildInformation.preview ?? false`. Omit for an always-on route that the
|
|
16
|
+
* secret alone protects.
|
|
17
|
+
* - `getSecret`: source of the expected secret. Default `process.env.PREVIEW_SECRET`.
|
|
18
|
+
* - `strictSecret`: fail closed. True: a missing `PREVIEW_SECRET` and a missing or wrong
|
|
19
|
+
* `secret` query all 404. False: no `PREVIEW_SECRET` means open, and a missing or wrong
|
|
20
|
+
* secret throws. Default false for `redirect`, true for `render` (a draft drawn in place is
|
|
21
|
+
* the higher risk).
|
|
22
|
+
* - `beforeLookup`: runs after the secret check, before the `id` check and the lookup. A site
|
|
23
|
+
* can use it to switch the fetches in this render onto the Preview API.
|
|
24
|
+
*/
|
|
25
|
+
export interface PreviewPageBaseConfig {
|
|
26
|
+
converterContext: BaseConverterContext;
|
|
27
|
+
getConfig: (preview: boolean) => ContentfulConfig;
|
|
28
|
+
getFetchOptions?: () => Omit<FetchOptions, 'preview'>;
|
|
29
|
+
isEnabled?: () => boolean;
|
|
30
|
+
getSecret?: () => string | undefined;
|
|
31
|
+
strictSecret?: boolean;
|
|
32
|
+
beforeLookup?: () => void;
|
|
33
|
+
}
|
|
34
|
+
/** Redirect mode (the default): send the editor to the entry's live URL. */
|
|
35
|
+
export interface RedirectPreviewPageConfig extends PreviewPageBaseConfig {
|
|
36
|
+
mode?: 'redirect';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Render mode: draw the draft on /preview. `render` is the site shell. It receives the resolved
|
|
40
|
+
* entry and returns the element to draw (layout, banners, per-content-type dispatch), and calls
|
|
41
|
+
* `notFound()` for entries it cannot render.
|
|
42
|
+
*/
|
|
43
|
+
export interface RenderPreviewPageConfig extends PreviewPageBaseConfig {
|
|
44
|
+
mode: 'render';
|
|
45
|
+
render: (info: PreviewEntryInfo) => ReactNode | Promise<ReactNode>;
|
|
46
|
+
}
|
|
47
|
+
export type PreviewPageConfig = RedirectPreviewPageConfig | RenderPreviewPageConfig;
|
|
48
|
+
export interface PreviewPageSearchParams {
|
|
49
|
+
id?: string | string[];
|
|
50
|
+
secret?: string | string[];
|
|
51
|
+
}
|
|
52
|
+
export interface PreviewPageProps {
|
|
53
|
+
searchParams: Promise<PreviewPageSearchParams>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* What the factory returns. `Page` is the default export of `src/app/preview/page.tsx`.
|
|
57
|
+
* `metadata` is re-exported as `metadata`: noindex, nofollow, nocache and no referrer (the URL
|
|
58
|
+
* carries the secret).
|
|
59
|
+
*/
|
|
60
|
+
export interface PreviewPage {
|
|
61
|
+
Page: (props: PreviewPageProps) => Promise<ReactNode>;
|
|
62
|
+
metadata: Metadata;
|
|
63
|
+
}
|
|
64
|
+
/** Metadata for the preview route: never indexed, never cached, never leaked through Referer. */
|
|
65
|
+
export declare const PREVIEW_PAGE_METADATA: Metadata;
|
|
66
|
+
/**
|
|
67
|
+
* Core-owned `/preview` route for Contentful "Open preview".
|
|
68
|
+
*
|
|
69
|
+
* Checks, in order: `isEnabled`, the preview secret, `beforeLookup`, the `id`, the entry
|
|
70
|
+
* lookup. Then either redirects to the entry's URL (only if it is a same-site path) or
|
|
71
|
+
* hands the entry to the site's `render` shell.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* // src/app/preview/page.tsx (default: redirect)
|
|
76
|
+
* const preview = createPreviewPage({
|
|
77
|
+
* converterContext,
|
|
78
|
+
* getConfig: getContentfulConfig,
|
|
79
|
+
* isEnabled: () => buildInformation.preview ?? false,
|
|
80
|
+
* });
|
|
81
|
+
* export const metadata = preview.metadata;
|
|
82
|
+
* export const dynamic = 'force-dynamic';
|
|
83
|
+
* export default preview.Page;
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function createPreviewPage(config: PreviewPageConfig): PreviewPage;
|
|
87
|
+
//# sourceMappingURL=createPreviewPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPreviewPage.d.ts","sourceRoot":"","sources":["../../src/server/createPreviewPage.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,sGAAsG;AACtG,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,gBAAgB,CAAC;IAClD,eAAe,CAAC,EAAE,MAAM,IAAI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ect } from 'next/navigation';
|
|
4
|
+
import { isSafePreviewRedirectTarget, validatePreviewSecret } from '../utils/previewPageUtils';
|
|
5
|
+
/** Metadata for the preview route: never indexed, never cached, never leaked through Referer. */
|
|
6
|
+
export const PREVIEW_PAGE_METADATA = {
|
|
7
|
+
robots: { index: false, follow: false, nocache: true },
|
|
8
|
+
referrer: 'no-referrer',
|
|
9
|
+
};
|
|
10
|
+
function single(value) {
|
|
11
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Core-owned `/preview` route for Contentful "Open preview".
|
|
15
|
+
*
|
|
16
|
+
* Checks, in order: `isEnabled`, the preview secret, `beforeLookup`, the `id`, the entry
|
|
17
|
+
* lookup. Then either redirects to the entry's URL (only if it is a same-site path) or
|
|
18
|
+
* hands the entry to the site's `render` shell.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // src/app/preview/page.tsx (default: redirect)
|
|
23
|
+
* const preview = createPreviewPage({
|
|
24
|
+
* converterContext,
|
|
25
|
+
* getConfig: getContentfulConfig,
|
|
26
|
+
* isEnabled: () => buildInformation.preview ?? false,
|
|
27
|
+
* });
|
|
28
|
+
* export const metadata = preview.metadata;
|
|
29
|
+
* export const dynamic = 'force-dynamic';
|
|
30
|
+
* export default preview.Page;
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function createPreviewPage(config) {
|
|
34
|
+
const mode = config.mode ?? 'redirect';
|
|
35
|
+
if (mode === 'render' && typeof config.render !== 'function') {
|
|
36
|
+
throw new Error("createPreviewPage: mode 'render' needs a render(info) function");
|
|
37
|
+
}
|
|
38
|
+
const strict = config.strictSecret ?? mode === 'render';
|
|
39
|
+
const getSecret = config.getSecret ?? (() => process.env.PREVIEW_SECRET);
|
|
40
|
+
async function renderPreviewRoute({ searchParams }) {
|
|
41
|
+
if (config.isEnabled && !config.isEnabled()) {
|
|
42
|
+
return notFound();
|
|
43
|
+
}
|
|
44
|
+
const params = await searchParams;
|
|
45
|
+
const secret = single(params.secret);
|
|
46
|
+
const envSecret = getSecret() || undefined;
|
|
47
|
+
if (strict && !envSecret) {
|
|
48
|
+
return notFound();
|
|
49
|
+
}
|
|
50
|
+
const validation = validatePreviewSecret(secret, envSecret);
|
|
51
|
+
if (!validation.valid) {
|
|
52
|
+
if (strict)
|
|
53
|
+
return notFound();
|
|
54
|
+
throw new Error(validation.error ?? 'Invalid preview secret');
|
|
55
|
+
}
|
|
56
|
+
config.beforeLookup?.();
|
|
57
|
+
const id = single(params.id);
|
|
58
|
+
if (!id) {
|
|
59
|
+
throw new Error('Preview ID is required');
|
|
60
|
+
}
|
|
61
|
+
const info = await getPreviewEntryInfo(config.converterContext, config.getConfig(true), id, config.getFetchOptions?.());
|
|
62
|
+
if (!info) {
|
|
63
|
+
return notFound();
|
|
64
|
+
}
|
|
65
|
+
if (mode === 'render') {
|
|
66
|
+
return await config.render(info);
|
|
67
|
+
}
|
|
68
|
+
if (!isSafePreviewRedirectTarget(info.href)) {
|
|
69
|
+
return notFound();
|
|
70
|
+
}
|
|
71
|
+
return redirect(info.href);
|
|
72
|
+
}
|
|
73
|
+
return { Page: renderPreviewRoute, metadata: PREVIEW_PAGE_METADATA };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=createPreviewPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPreviewPage.js","sourceRoot":"","sources":["../../src/server/createPreviewPage.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAQrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAqE/F,iGAAiG;AACjG,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC7C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,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,MAAM;gBAAE,OAAO,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,wBAAwB,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QAExB,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,mBAAmB,CACpC,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EACtB,EAAE,EACF,MAAM,CAAC,eAAe,EAAE,EAAE,CAC3B,CAAC;QACF,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,QAAQ,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,OAAO,MAAO,MAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,OAAO,QAAQ,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAsC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC;AACvE,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { buildListingItems, buildListingStructuredDataContext, } from '../utils/
|
|
|
12
12
|
export { CMS_HOMEPAGE_SLUG, controlSlugFromCanonicalPath, resolvePageTestControlSlug, } from '../utils/pageTestControlSlug';
|
|
13
13
|
export type { ContentSignalPreference, ContentSignals, CreateRobotsConfigOptions, FormatRobotsTxtOptions, RobotsTxtGroupOptions, RobotsUserAgentPreset, } from '../utils/robots';
|
|
14
14
|
export { AI_AGENT_USER_AGENTS, buildRobotsDisallow, createRobotsConfig, createRobotsTxtResponse, DEFAULT_ROBOTS_DISALLOW, formatContentSignalLine, formatRobotsTxt, resolveRobotsUserAgents, TRACKING_QUERY_ROBOTS_DISALLOW, } from '../utils/robots';
|
|
15
|
+
export type { PreviewPage, PreviewPageConfig, PreviewPageMode, PreviewPageProps, PreviewPageSearchParams, RedirectPreviewPageConfig, RenderPreviewPageConfig, } from './createPreviewPage';
|
|
16
|
+
export { createPreviewPage, PREVIEW_PAGE_METADATA } from './createPreviewPage';
|
|
15
17
|
export { notFoundIfImpossibleCmsSlug } from './impossible-cms-slug';
|
|
16
18
|
export type { GenerateNotFoundPage, GenerateSlimNotFoundPage, RouteHandlersConfig, } from './route-handlers';
|
|
17
19
|
export { createRouteHandlers } from './route-handlers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,6BAA6B,EAAE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,eAAe,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,wCAAwC,EACxC,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oCAAoC,GACrC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,iCAAiC,EACjC,8BAA8B,EAC9B,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { DEFAULT_RELATED_ARTICLES_FALLBACK_POLICY, getRelatedArticles, getRelate
|
|
|
6
6
|
export { buildListingItems, buildListingStructuredDataContext, } from '../utils/listingStructuredData';
|
|
7
7
|
export { CMS_HOMEPAGE_SLUG, controlSlugFromCanonicalPath, resolvePageTestControlSlug, } from '../utils/pageTestControlSlug';
|
|
8
8
|
export { AI_AGENT_USER_AGENTS, buildRobotsDisallow, createRobotsConfig, createRobotsTxtResponse, DEFAULT_ROBOTS_DISALLOW, formatContentSignalLine, formatRobotsTxt, resolveRobotsUserAgents, TRACKING_QUERY_ROBOTS_DISALLOW, } from '../utils/robots';
|
|
9
|
+
export { createPreviewPage, PREVIEW_PAGE_METADATA } from './createPreviewPage';
|
|
9
10
|
export { notFoundIfImpossibleCmsSlug } from './impossible-cms-slug';
|
|
10
11
|
export { createRouteHandlers } from './route-handlers';
|
|
11
12
|
export { toBreadcrumbOptions } from './route-types';
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAM9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,wCAAwC,EACxC,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oCAAoC,GACrC,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAStC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAM9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,wCAAwC,EACxC,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oCAAoC,GACrC,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAStC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAMpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAyBvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasStaticAssetExtension } from '@se-studio/core-data-types';
|
|
1
|
+
import { hasDotfileSegment, hasStaticAssetExtension } from '@se-studio/core-data-types';
|
|
2
2
|
/** Browser stays fresh; the CDN may serve the 404 for a day. */
|
|
3
3
|
export declare const CACHEABLE_NOT_FOUND_CACHE_CONTROL = "public, max-age=0, s-maxage=86400, stale-while-revalidate=604800";
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ export declare const CACHEABLE_NOT_FOUND_CACHE_CONTROL = "public, max-age=0, s-m
|
|
|
8
8
|
* svg/png/jpg/jpeg/gif/webp/ico/txt/xml.
|
|
9
9
|
*/
|
|
10
10
|
export declare const CMS_PROXY_MATCHERS: readonly ['/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|txt|xml)$).*)', '/((?!_next/static|_next/image|favicon.ico).*(?:%|:|,|f_auto|wp-).*)'];
|
|
11
|
-
export { hasStaticAssetExtension };
|
|
11
|
+
export { hasDotfileSegment, hasStaticAssetExtension };
|
|
12
12
|
/**
|
|
13
13
|
* A CMS slug is a page route segment, so a real file or probe extension on the segment means a crawler
|
|
14
14
|
* or scanner, not an entry. Only the extension is rejected: a bare `.` is allowed because editors keep
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impossibleCmsSlug.d.ts","sourceRoot":"","sources":["../../src/utils/impossibleCmsSlug.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"impossibleCmsSlug.d.ts","sourceRoot":"","sources":["../../src/utils/impossibleCmsSlug.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,4BAA4B,CAAC;AAIpC,gEAAgE;AAChE,eAAO,MAAM,iCAAiC,qEACsB,CAAC;AAMrE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,YAC7B,+FAA+F,EAC/F,qEAAqE,CAC7D,CAAC;AAEX,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;AAUtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWzD;AAmBD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAuBtE;AAED,uFAAuF;AACvF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG;IAC/D,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,GAAG,IAAI,CAeP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasStaticAssetExtension, STATIC_ASSET_EXTENSION } from '@se-studio/core-data-types';
|
|
1
|
+
import { hasDotfileSegment, hasStaticAssetExtension, STATIC_ASSET_EXTENSION, } from '@se-studio/core-data-types';
|
|
2
2
|
const IMPOSSIBLE_CMS_SLUG_MARKERS = ['%', ':', ',', 'f_auto', 'wp-'];
|
|
3
3
|
/** Browser stays fresh; the CDN may serve the 404 for a day. */
|
|
4
4
|
export const CACHEABLE_NOT_FOUND_CACHE_CONTROL = 'public, max-age=0, s-maxage=86400, stale-while-revalidate=604800';
|
|
@@ -14,7 +14,7 @@ export const CMS_PROXY_MATCHERS = [
|
|
|
14
14
|
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|txt|xml)$).*)',
|
|
15
15
|
'/((?!_next/static|_next/image|favicon.ico).*(?:%|:|,|f_auto|wp-).*)',
|
|
16
16
|
];
|
|
17
|
-
export { hasStaticAssetExtension };
|
|
17
|
+
export { hasDotfileSegment, hasStaticAssetExtension };
|
|
18
18
|
const IMPOSSIBLE_SLUG_FILE_EXTENSION = /\.(?:js|mjs|cjs|css|map|png|jpe?g|gif|webp|avif|svg|ico|txt|xml|json|php|aspx?|jsp|cgi|env|ya?ml|zip|gz|tgz|tar|rar|7z|sql|bak|old|log|ini|conf|htm|html|mp4|woff2?|action|docx?|exe|cfm|pl|py|sh|php\d|pdf)$/i;
|
|
19
19
|
const HOSTNAME_SLUG = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*\.(?:net|com|org|io|dev|app|co)$/i;
|
|
20
20
|
const MULTI_LABEL_HOST_SLUG = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*\.(?:co|com|org|net|ac|gov|edu|or|ne)\.[a-z]{2}$/i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impossibleCmsSlug.js","sourceRoot":"","sources":["../../src/utils/impossibleCmsSlug.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"impossibleCmsSlug.js","sourceRoot":"","sources":["../../src/utils/impossibleCmsSlug.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE9E,gEAAgE;AAChE,MAAM,CAAC,MAAM,iCAAiC,GAC5C,kEAAkE,CAAC;AAErE,MAAM,+BAA+B,GAAG,uDAAuD,CAAC;AAEhG,MAAM,wBAAwB,GAAG,yCAAyC,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,+FAA+F;IAC/F,qEAAqE;CAC7D,CAAC;AAEX,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;AAEtD,MAAM,8BAA8B,GAClC,gNAAgN,CAAC;AAEnN,MAAM,aAAa,GAAG,+DAA+D,CAAC;AAEtF,MAAM,qBAAqB,GACzB,+EAA+E,CAAC;AAElF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,OAAO,CACL,2BAA2B,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC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,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;YACpC,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACrB,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACxB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CACtB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,6BAA6B,CAAC,QAAgB;IAK5D,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE;YACP,eAAe,EAAE,iCAAiC;YAClD,mBAAmB,EAAE,+BAA+B;YACpD,0BAA0B,EAAE,+BAA+B;YAC3D,cAAc,EAAE,0BAA0B;YAC1C,cAAc,EAAE,SAAS;SAC1B;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -28,4 +28,19 @@ export interface PreviewSecretValidation {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export declare function validatePreviewSecret(providedSecret: string | undefined, envSecret: string | undefined): PreviewSecretValidation;
|
|
31
|
+
/**
|
|
32
|
+
* True when `href` is a same-site path that is safe to pass to `redirect()`.
|
|
33
|
+
*
|
|
34
|
+
* Accepts only a single leading `/` followed by a non-slash, non-backslash character
|
|
35
|
+
* (or a bare `/`). Rejects protocol-relative (`//host`), backslash variants (`/\host`),
|
|
36
|
+
* absolute URLs (`https://host`, `javascript:`), relative paths without a leading slash,
|
|
37
|
+
* and any control character (CR/LF/tab are stripped by some browsers and can hide a host).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* isSafePreviewRedirectTarget('/about/'); // true
|
|
42
|
+
* isSafePreviewRedirectTarget('//evil.example'); // false
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function isSafePreviewRedirectTarget(href: unknown): href is string;
|
|
31
46
|
//# sourceMappingURL=previewPageUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewPageUtils.d.ts","sourceRoot":"","sources":["../../src/utils/previewPageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,uBAAuB,CAoBzB"}
|
|
1
|
+
{"version":3,"file":"previewPageUtils.d.ts","sourceRoot":"","sources":["../../src/utils/previewPageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,uBAAuB,CAoBzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAOzE"}
|
|
@@ -38,4 +38,30 @@ export function validatePreviewSecret(providedSecret, envSecret) {
|
|
|
38
38
|
}
|
|
39
39
|
return { valid: true };
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* True when `href` is a same-site path that is safe to pass to `redirect()`.
|
|
43
|
+
*
|
|
44
|
+
* Accepts only a single leading `/` followed by a non-slash, non-backslash character
|
|
45
|
+
* (or a bare `/`). Rejects protocol-relative (`//host`), backslash variants (`/\host`),
|
|
46
|
+
* absolute URLs (`https://host`, `javascript:`), relative paths without a leading slash,
|
|
47
|
+
* and any control character (CR/LF/tab are stripped by some browsers and can hide a host).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* isSafePreviewRedirectTarget('/about/'); // true
|
|
52
|
+
* isSafePreviewRedirectTarget('//evil.example'); // false
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function isSafePreviewRedirectTarget(href) {
|
|
56
|
+
if (typeof href !== 'string' || href.length === 0)
|
|
57
|
+
return false;
|
|
58
|
+
if (!href.startsWith('/'))
|
|
59
|
+
return false;
|
|
60
|
+
if (href.length > 1 && (href[1] === '/' || href[1] === '\\'))
|
|
61
|
+
return false;
|
|
62
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: rejecting control characters is the point
|
|
63
|
+
if (/[\u0000-\u001f\u007f\\]/.test(href))
|
|
64
|
+
return false;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
41
67
|
//# sourceMappingURL=previewPageUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewPageUtils.js","sourceRoot":"","sources":["../../src/utils/previewPageUtils.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAkC,EAClC,SAA6B;IAE7B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,CA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QAAE,OAAO,KAAK,CAAC;IAC3E,qGAAqG;IACrG,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.
|
|
1
|
+
export declare const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.50.0";
|
|
2
2
|
export declare const CMS_EDIT_WELL_KNOWN_CONTENT_VERSION = "a5ac82ff7d83";
|
|
3
3
|
export declare const CMS_EDIT_WELL_KNOWN_FILES: Record<string, string>;
|
|
4
4
|
export declare const CMS_EDIT_WELL_KNOWN_SKILLS: ReadonlyArray<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-cms-edit-well-known.mjs — do not edit manually.
|
|
2
|
-
export const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.
|
|
2
|
+
export const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.50.0";
|
|
3
3
|
export const CMS_EDIT_WELL_KNOWN_CONTENT_VERSION = "a5ac82ff7d83";
|
|
4
4
|
export const CMS_EDIT_WELL_KNOWN_FILES = { "core/article-structure.md": "---\nid: article-structure\ntitle: Article structure\nsummary: Article fields, article types, tags, and how templates and body content split responsibilities.\nintents: [create article, blog post, press release, case study, publication, article tags]\n---\n\n# Article structure\n\nAn `article` always belongs to an **article type**; the type decides its URL base and its template.\n\n## Fields to settle before create\n\n- `title`, `slug`, `date`, `articleType` (resolve with `list --type articleType`).\n- `description`: under about 160 characters when used for SEO.\n- `tags` and the primary tag, when the URL includes a topic segment.\n- `featuredImage` (landscape if used for social) and `visuals`, as the site playbook requires.\n- `indexed` / `hidden` per the site playbook.\n\n## Template hierarchy\n\nPeek `articleType.articleTemplate`. Its `preContent` and `postContent` already provide hero, byline or CTA components. Do not repeat those in the article's `content`.\n\n## Body content\n\n- Follow the **source order**. Do not invent side-by-side layouts unless the source is a true pair.\n- Merge continuous prose into fewer body blocks when nothing visual sits between.\n- Do not rewrite source copy. Structure and place it; flag problems to the human.\n- Rename every `cmsLabel` away from \"New ...\".\n\n## Flow\n\nRead site playbooks (`articles`, `defaults`, `routing`) → `index sync` → `create from-json --dry-run --strict` → confirm → create → `diff` → `save` → preview-verify. Save is draft only.\n", "core/core-cms-rules.md": "---\nid: core-cms-rules\ntitle: Core CMS editing rules\nsummary: Draft-only saves, publish gates, asset reuse, staged uploads, and what an agent must never do.\nintents: [cms rules, safety, publish, upload image, edit content, get started, help]\n---\n\n# Core CMS editing rules\n\n## Drafts and publishing\n\n- `save` writes **drafts only**. Publish, unpublish, archive and delete go through `plan`, then `apply` after an explicit yes from the user, and only when the signed-in role allows it.\n- A plan publishes only the ids it lists. Pass `--with-parents` when a parent or listing page must go live too.\n- For a published entry that is being deleted, ask whether to unpublish-then-delete or unpublish-then-archive. Never choose for the user.\n\n## Editing\n\n- Work from the real space: `schema` for fields and enums, `index sync` for lookups. Do not guess field names.\n- Build whole trees with `create from-json` (`--dry-run --strict` first) or `export from-json` / `apply from-json`. Use `set`, `rtf` and `add` only for small patches.\n- Always `diff` before `save`.\n- Hosted MCP rejects inline JSON or text over 8192 bytes: use a staged upload (`kind=json` or `kind=text`) and the `--staged` flag.\n- Other locales: pass `--locale <code>`; an edit in the default locale can leave other locales stale.\n\n## Assets\n\n- **Reuse first.** `index sync`, then `asset search` (by title, file name or concept).\n- Raster and video go through `cms_edit_request_staged_upload`, then `cms_edit_media` prepare, wait, catalog, import with real alt text. Never `asset upload` jpeg, png, webp, gif or mp4.\n- SVG, PDF and Lottie use a staged upload, then `asset upload --staged`.\n- Write alt text from what the picture shows. Do not emotion-score people, logos, icons or illustrations.\n\n## Never\n\n- Never publish as a side effect of saving.\n- Never rewrite source copy while structuring it.\n- Never put secrets, tokens or personal data into content, feedback reports, or tool arguments.\n- If a tag, type or field you need does not exist and CMS writes to the model are off, stop and ask.\n\n## Feedback\n\nIf a tool misbehaves or something is missing, offer the user a `report_feedback` report. Send it only after they agree, and keep code, secrets and personal data out of it.\n", "core/page-structure.md": "---\nid: page-structure\ntitle: Page structure\nsummary: The three content slots of a page, required fields, and how to build a page tree safely.\nintents: [create page, create landing page, new marketing page, page layout, clone page]\n---\n\n# Page structure\n\nA `page` is the root of a web page's content tree.\n\n## Fields\n\n| Field | Notes |\n|---|---|\n| `slug` | Required. No leading or trailing slash. `index` is the home page. Multi-level: `part1/part2`. |\n| `title` | Required. On-page heading, and the document title when `metaTitle` is empty. |\n| `metaTitle` | Optional search-result title. Does not change the on-page heading. |\n| `description` | SEO meta description. Aim for 120-160 characters. |\n| `indexed`, `hidden` | Search indexing and sitemap exclusion. Test or agent pages: `indexed: false`. |\n| `template` | Link to a template for shared layout slots. |\n| `featuredImage` | Asset used for social sharing. Landscape. |\n| `cmsLabel` | Label in the CMS entry list. Defaults to `title`. |\n\n## Content slots (rendered in order)\n\n- `topContent`: above the main area (nav, announcement, hero when the page owns its hero).\n- `content`: the main area. **Default target for `add` and `create from-json`.**\n- `bottomContent`: below the main area (newsletter, closing CTA).\n\nEach slot holds links to `component`, `collection` or `externalComponent` entries.\n\n## Building a page\n\n1. Read the site's own playbooks first (`cms_edit_customer`: `index`, `routing`, `components-index`).\n2. `cms_edit schema component` for this space's real fields and enums.\n3. Draft one `create from-json` payload (nested `components`, discriminator `type`). Use staged JSON above 8 KB.\n4. `create from-json --dry-run --strict`, review, then create.\n5. After each `add`, set `heading`, then rename `cmsLabel` away from \"New ...\".\n6. Confirm slug, title and template with the user. `diff` before `save`.\n\nDo not hand-write a code route for a marketing URL. A page is a CMS slug on the catch-all route.\n", "core/spacing-rules.md": "---\nid: spacing-rules\ntitle: Spacing rules\nsummary: Vertical rhythm between sections is set by the section component and tokens, never by empty components.\nintents: [spacing, gap, padding, margin, empty section, whitespace, layout gap]\n---\n\n# Spacing rules\n\nSpacing is a property of the design system, not of the content.\n\n1. **Sections own their spacing.** Every marketing block renders inside the shared section wrapper, which applies the project's section spacing and column grid. Content does not add its own.\n2. **Do not add filler.** No empty components, blank paragraphs, ` ` or line-break stacks to push sections apart. If the gap looks wrong, the cause is a component choice or a token, and the fix is there.\n3. **Adjacent sections share a background rhythm.** Two neighbours with the same background colour read as one block; vary background colours deliberately, or use the component's own spacing options if it has them.\n4. **Width is columns, not pixels.** Layout width inside a section is a column span from the project's grid. Do not request fixed pixel widths from content.\n5. **If a gap needs a code change** (a new spacing option, a token), stop and report it. Do not work around it in CMS content.\n6. **Verify at four widths**: 375, 1024, 1440 and 1920 px. Spacing that looks right at 1440 often collapses or balloons at the extremes.\n", "core/templates.md": "---\nid: templates\ntitle: Templates (layout shells)\nsummary: How templates wrap pages and articles with preContent, postContent, menu, footer and colours.\nintents: [create template, edit template, shared layout, site chrome, menu, footer]\n---\n\n# Templates\n\nA **template** is a layout shell shared by many pages or articles. It carries:\n\n| Field | Type | Meaning |\n|---|---|---|\n| `preContent` | array of links | Components rendered before the entry's own content (sticky nav, hero, announcement bar). |\n| `postContent` | array of links | Components rendered after it (newsletter signup, closing CTA). |\n| `menu`, `footer` | single navigation link | Site chrome for this template. |\n| `backgroundColour`, `textColour` | project colour names | Default colours for the shell. |\n\n## Rules\n\n1. **Check the template before adding layout to an entry.** Peek the entry's `template` (pages) or its article type's `articleTemplate` (articles). If the template already supplies a hero or CTA, do not add another to the entry's `content`.\n2. **Edit shared shells deliberately.** A template change affects every entry that uses it. Say so in the plan and ask for a clear yes.\n3. **Reuse before creating.** `list --type template` first. Do not create a near-duplicate for one page.\n4. Set menu and footer with `set @ref menu <nav-entry-id> --link` (same for `footer`). Colours use the project's colour names, not hex.\n5. Name templates for what they are for (\"Campaign landing\", \"Article default\"), not for the first page that used them.\n\n## Workflow\n\n`create template --label \"<name>\"` → `open` it → `add` components to `preContent` / `postContent` → set `menu`, `footer`, colours → `diff` → `save`. Save writes drafts only. Publishing is a separate, explicit step.\n", "core/top-content-heroes.md": "---\nid: top-content-heroes\ntitle: Top content and heroes\nsummary: Where heroes live, the single-h1 rule, and how to avoid duplicate heroes from templates.\nintents: [add hero, change hero, top content, page header, h1, hero image]\n---\n\n# Top content and heroes\n\n## Where a hero goes\n\n- If the **template** already provides a hero in `preContent`, the entry gets none.\n- Otherwise the hero is the **first component in `topContent`** (pages) or the first body component (articles whose template has none).\n- Never put a hero in `content` just because `topContent` looked unfamiliar.\n\n## One `h1`\n\nExactly one component per rendered page owns the `h1`. Check the hero component's heading level fields (and `isHero` on HTML components). A second hero, or a hero plus a template header, produces two `h1`s. Fix by removing one, not by restyling.\n\n## Setting a hero\n\n1. Pick the hero type from the site's `components-index` playbook; do not invent a type.\n2. Set `heading`, then `showHeading` per the component's rules, then `cmsLabel` (name it for the page: \"Pricing hero\").\n3. Images: reuse an existing asset first (`index sync`, then `asset search`). Write real alt text from the picture. Wide heroes want landscape sources; the pipeline processes the file, do not hand-resize.\n4. Colours use project colour names. Check text contrast against the chosen background and image overlay.\n5. Check the result on the preview at 375, 1024, 1440 and 1920 px wide. A hero that works at 1440 can still break at 1920 or 375.\n\n## Do not\n\n- Do not use a hero to carry long copy; use a body block below it.\n- Do not change a shared template's hero to fix one page.\n" };
|
|
5
5
|
export const CMS_EDIT_WELL_KNOWN_SKILLS = [{ "id": "article-structure", "title": "Article structure", "summary": "Article fields, article types, tags, and how templates and body content split responsibilities.", "intents": ["create article", "blog post", "press release", "case study", "publication", "article tags"], "scope": "core", "path": "core/article-structure.md", "sha256": "3b09b08c029b2282885d552497cfe0b5d357902349ef91b6abcdf833f868d3ab", "bytes": 1495 }, { "id": "core-cms-rules", "title": "Core CMS editing rules", "summary": "Draft-only saves, publish gates, asset reuse, staged uploads, and what an agent must never do.", "intents": ["cms rules", "safety", "publish", "upload image", "edit content", "get started", "help"], "scope": "core", "path": "core/core-cms-rules.md", "sha256": "c1981f971f7460b83a13115b2fd25cd6de93d1171c42b560b23f98bff97cdbe5", "bytes": 2243 }, { "id": "page-structure", "title": "Page structure", "summary": "The three content slots of a page, required fields, and how to build a page tree safely.", "intents": ["create page", "create landing page", "new marketing page", "page layout", "clone page"], "scope": "core", "path": "core/page-structure.md", "sha256": "503efb77887702d6a834e73bdb37bfb5de1ffc3f0fe6d96aa45d1a9678a59de0", "bytes": 1977 }, { "id": "spacing-rules", "title": "Spacing rules", "summary": "Vertical rhythm between sections is set by the section component and tokens, never by empty components.", "intents": ["spacing", "gap", "padding", "margin", "empty section", "whitespace", "layout gap"], "scope": "core", "path": "core/spacing-rules.md", "sha256": "e496bcf444a52aaec62685cc1ed1d289b858389bd0518e882f987e8b6057a4cd", "bytes": 1359 }, { "id": "templates", "title": "Templates (layout shells)", "summary": "How templates wrap pages and articles with preContent, postContent, menu, footer and colours.", "intents": ["create template", "edit template", "shared layout", "site chrome", "menu", "footer"], "scope": "core", "path": "core/templates.md", "sha256": "ca5796c2f174b7a33c26b9a17ca3bac28073e7471f75261c7541d365be62325b", "bytes": 1762 }, { "id": "top-content-heroes", "title": "Top content and heroes", "summary": "Where heroes live, the single-h1 rule, and how to avoid duplicate heroes from templates.", "intents": ["add hero", "change hero", "top content", "page header", "h1", "hero image"], "scope": "core", "path": "core/top-content-heroes.md", "sha256": "420fd12b0f354290fda1ecd73edb1fae5ca9c433a525bad1345fb13c4de570bd", "bytes": 1647 }];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/core-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"description": "Shared React UI component library with Tailwind CSS v4 for SE Studio applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/route-handlers/index.d.ts",
|
|
25
25
|
"import": "./dist/route-handlers/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./proxy": {
|
|
28
|
+
"types": "./dist/proxy/index.d.ts",
|
|
29
|
+
"import": "./dist/proxy/index.js"
|
|
30
|
+
},
|
|
27
31
|
"./impossible-cms-slug": {
|
|
28
32
|
"types": "./dist/utils/impossibleCmsSlug.d.ts",
|
|
29
33
|
"import": "./dist/utils/impossibleCmsSlug.js"
|
|
@@ -85,8 +89,8 @@
|
|
|
85
89
|
"@contentful/rich-text-react-renderer": "^16.2.2",
|
|
86
90
|
"@contentful/rich-text-types": "^17.2.7",
|
|
87
91
|
"@radix-ui/react-slot": "1.3.3",
|
|
88
|
-
"@se-studio/contentful-rest-api": "2.9.
|
|
89
|
-
"@se-studio/core-data-types": "2.
|
|
92
|
+
"@se-studio/contentful-rest-api": "2.9.5",
|
|
93
|
+
"@se-studio/core-data-types": "2.3.0",
|
|
90
94
|
"@types/mustache": "4.2.6",
|
|
91
95
|
"@vimeo/player": "^2.30.4",
|
|
92
96
|
"clsx": "^2.1.1",
|