@elytracms/next 0.0.65 → 0.0.66
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/dist/index.d.ts +5 -23
- package/dist/index.js +3 -30
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ComponentImplementations, ResolveBinding, RelationTarget } from '@elytr
|
|
|
5
5
|
export { ComponentImplementations, RenderAsset } from '@elytracms/core/runtime-renderer';
|
|
6
6
|
import { ResolvePageResult, ResolvedAsset, Perspective, ContentClient, CacheTags, ContentDocumentSource, ResolvedDocument } from '@elytracms/core/content';
|
|
7
7
|
export { Perspective } from '@elytracms/core/content';
|
|
8
|
-
import { LocaleConfig, Locale, RouteRecord, RedirectRecord, CollectionDef
|
|
9
|
-
export { CmsDocument, CollectionDef, FieldDef, Locale, LocaleConfig, RedirectRecord, RouteRecord, documentSchema, localeConfigSchema, redirectRecordSchema, routeRecordSchema } from '@elytracms/core/cms-core';
|
|
8
|
+
import { LocaleConfig, Locale, RouteRecord, RedirectRecord, CollectionDef } from '@elytracms/core/cms-core';
|
|
9
|
+
export { CmsDocument, CollectionDef, FieldDef, Locale, LocaleConfig, RedirectRecord, RouteRecord, documentSchema, fallbackHomeRoutes, localeConfigSchema, mergeRouteRecords, redirectRecordSchema, routeRecordSchema } from '@elytracms/core/cms-core';
|
|
10
10
|
import { ComponentNode } from '@elytracms/core/project-graph';
|
|
11
11
|
export { ComponentNode } from '@elytracms/core/project-graph';
|
|
12
12
|
import { AssetRecord, PersistenceAdapter } from '@elytracms/core/persistence';
|
|
@@ -359,18 +359,7 @@ interface StaticContentData {
|
|
|
359
359
|
*/
|
|
360
360
|
sources?: readonly CanvasDataSource[];
|
|
361
361
|
}
|
|
362
|
-
|
|
363
|
-
* Merge stored route records with derived fallback routes (EC-177 gap 2):
|
|
364
|
-
* stored records win per pattern+locale; fallback routes only fill patterns
|
|
365
|
-
* the stored set does not cover. Never XOR — the first stored route must not
|
|
366
|
-
* drop the implicit per-locale home-page fallback (or vice versa).
|
|
367
|
-
*
|
|
368
|
-
* Coverage rules mirror the router's locale matching (EC-018/019): a stored
|
|
369
|
-
* locale-agnostic route (no `locale`) covers its pattern for every locale; a
|
|
370
|
-
* locale-specific stored route covers only that locale, so fallbacks for the
|
|
371
|
-
* other locales still apply.
|
|
372
|
-
*/
|
|
373
|
-
declare function mergeRouteRecords(stored: readonly RouteRecord[], fallback: readonly RouteRecord[]): RouteRecord[];
|
|
362
|
+
|
|
374
363
|
/**
|
|
375
364
|
* Assemble a `ContentSource` from plain prefetched data — the pure half of
|
|
376
365
|
* {@link createContentSnapshot}, shared with hosts that fetched the data
|
|
@@ -1461,14 +1450,7 @@ interface DeliverySnapshotPayload {
|
|
|
1461
1450
|
documents: unknown[];
|
|
1462
1451
|
assets: unknown[];
|
|
1463
1452
|
}
|
|
1464
|
-
|
|
1465
|
-
* Implicit fallback route table (EC-187): `/` → the first `page`-collection
|
|
1466
|
-
* document (lowest id), once per configured locale. Merged UNDER the stored
|
|
1467
|
-
* records. The delivery snapshot is already perspective-filtered server-side,
|
|
1468
|
-
* so in draft mode this correctly previews the draft home even when
|
|
1469
|
-
* unpublished.
|
|
1470
|
-
*/
|
|
1471
|
-
declare function fallbackHomeRoutes(documents: readonly CmsDocument[], locales: LocaleConfig): RouteRecord[];
|
|
1453
|
+
|
|
1472
1454
|
/**
|
|
1473
1455
|
* Assemble a fetched delivery-snapshot payload into a `ContentSource` — the
|
|
1474
1456
|
* pure half of {@link loadLiveContent}, exported so the parsing/assembly rules
|
|
@@ -1547,4 +1529,4 @@ declare function evaluatePreviewRequest(requestUrl: string | URL, expectedToken:
|
|
|
1547
1529
|
*/
|
|
1548
1530
|
declare const PACKAGE = "@elytracms/next";
|
|
1549
1531
|
|
|
1550
|
-
export { type AssetImageLoaderOptions, type BindingPayloads, type CacheWrapper, type CacheWrapperOptions, type CachedEntry, type CanvasCacheOptions, type CanvasContentRequest, type CanvasDataSource, type CanvasPageOutcome, type CanvasPayloadContext, type CanvasPayloadsFactory, CanvasRenderer, type CanvasRendererProps, type CanvasRequestInfo, type CanvasRoute, type CanvasRouteOptions, type CanvasRouteProps, type CanvasSitemapOptions, type CanvasSitemapResult, type ContentSnapshot, type ContentSnapshotOptions, type ContentSource, type CreateCanvasSitemapOptions, type DefineHostComponentsOptions, ELYTRA_HOST_ENV_KEYS, type ElytraHost, type ElytraHostEnv, type ElytraHostImageOptions, type ElytraHostOptions, ElytraImage, type ElytraImageAsset, type ElytraImageProps, type GlobalsConventions, type HostCanvasRouteOptions, type HostComponent, type HostComponents, type LiveContentOptions, type LoadGlobalsOptions, type MaterializeSourcePayloadsInput, type MaterializedSourcePayloads, type NextImagePrimitiveOptions, PACKAGE, type PreviewEvaluation, type PreviewRouteHandlers, type PreviewRouteOptions, REVALIDATE_SIGNATURE_HEADER, type ResolveCanvasPageOptions, type ResolveGlobalsOptions, type ResolvedLink, type ResolvedNavEntry, type ResolvedNavLink, type RevalidateEvaluation, type RevalidatePayload, type RevalidateRouteHandlers, type RevalidateRouteOptions, type SiteGlobals, type SitemapParamsProvider, type SitemapRouteContext, type SitemapSkippedRoute, type SourcePayloadError, type StaticContentData, assembleLiveSource, canvasPageMetadata, canvasSitemapEntries, collectBindingSourceIds, collectionCacheTag, createAssetImageLoader, createBindingResolver, createCanvasRoute, createCanvasSitemap, createContentSnapshot, createElytraHost, createPreviewDisableRoute, createPreviewRoute, createRevalidateRoute, createStaticContentSource, defaultBindingPayloads, defineHostComponents, docCacheTag, elytraHostImage, evaluatePreviewRequest, evaluateRevalidateRequest,
|
|
1532
|
+
export { type AssetImageLoaderOptions, type BindingPayloads, type CacheWrapper, type CacheWrapperOptions, type CachedEntry, type CanvasCacheOptions, type CanvasContentRequest, type CanvasDataSource, type CanvasPageOutcome, type CanvasPayloadContext, type CanvasPayloadsFactory, CanvasRenderer, type CanvasRendererProps, type CanvasRequestInfo, type CanvasRoute, type CanvasRouteOptions, type CanvasRouteProps, type CanvasSitemapOptions, type CanvasSitemapResult, type ContentSnapshot, type ContentSnapshotOptions, type ContentSource, type CreateCanvasSitemapOptions, type DefineHostComponentsOptions, ELYTRA_HOST_ENV_KEYS, type ElytraHost, type ElytraHostEnv, type ElytraHostImageOptions, type ElytraHostOptions, ElytraImage, type ElytraImageAsset, type ElytraImageProps, type GlobalsConventions, type HostCanvasRouteOptions, type HostComponent, type HostComponents, type LiveContentOptions, type LoadGlobalsOptions, type MaterializeSourcePayloadsInput, type MaterializedSourcePayloads, type NextImagePrimitiveOptions, PACKAGE, type PreviewEvaluation, type PreviewRouteHandlers, type PreviewRouteOptions, REVALIDATE_SIGNATURE_HEADER, type ResolveCanvasPageOptions, type ResolveGlobalsOptions, type ResolvedLink, type ResolvedNavEntry, type ResolvedNavLink, type RevalidateEvaluation, type RevalidatePayload, type RevalidateRouteHandlers, type RevalidateRouteOptions, type SiteGlobals, type SitemapParamsProvider, type SitemapRouteContext, type SitemapSkippedRoute, type SourcePayloadError, type StaticContentData, assembleLiveSource, canvasPageMetadata, canvasSitemapEntries, collectBindingSourceIds, collectionCacheTag, createAssetImageLoader, createBindingResolver, createCanvasRoute, createCanvasSitemap, createContentSnapshot, createElytraHost, createPreviewDisableRoute, createPreviewRoute, createRevalidateRoute, createStaticContentSource, defaultBindingPayloads, defineHostComponents, docCacheTag, elytraHostImage, evaluatePreviewRequest, evaluateRevalidateRequest, firstBlockFullBleed, isSourcePayloadError, loadCachedEntry, loadLiveContent, materializeSourcePayloads, mergeCacheTags, nextCacheTags, nextImagePrimitive, pathFromSlug, projectSweepTag, resolveCanvasPage, resolveGlobals, resolveHostEnv, resolvePayloadToken, revalidatePayloadSchema, routeCacheTag, safeRedirectTarget, scopeCacheTag, signRevalidateBody, sourcePayloadError, splitLocalePath };
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { basePrimitives, getImplementation, renderComposition, ImageManifest, se
|
|
|
4
4
|
import { isValidElement } from 'react';
|
|
5
5
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { cacheTags, isSectionSourceId, parseCmsSourceQueryConfig, listQueryOfCmsConfig, isDocumentHistory, resolvedAsset, createContentClient, createContentContext } from '@elytracms/core/content';
|
|
7
|
-
import { documentKey, splitPath, hierarchyMount, composePath, documentSchema, redirectRecordSchema } from '@elytracms/core/cms-core';
|
|
8
|
-
export { documentSchema, localeConfigSchema, redirectRecordSchema, routeRecordSchema } from '@elytracms/core/cms-core';
|
|
7
|
+
import { documentKey, splitPath, hierarchyMount, composePath, mergeRouteRecords, fallbackHomeRoutes, documentSchema, redirectRecordSchema } from '@elytracms/core/cms-core';
|
|
8
|
+
export { documentSchema, fallbackHomeRoutes, localeConfigSchema, mergeRouteRecords, redirectRecordSchema, routeRecordSchema } from '@elytracms/core/cms-core';
|
|
9
9
|
import { revalidateTag, unstable_cache } from 'next/cache';
|
|
10
10
|
import { draftMode } from 'next/headers';
|
|
11
11
|
import { redirect, notFound, permanentRedirect } from 'next/navigation';
|
|
@@ -220,23 +220,6 @@ function materializeSourcePayloads(input) {
|
|
|
220
220
|
return { payloads, tags };
|
|
221
221
|
}
|
|
222
222
|
var DEFAULT_LOCALES = { default: "en", locales: ["en"] };
|
|
223
|
-
function patternKey(pattern) {
|
|
224
|
-
return "/" + splitPath(pattern).join("/");
|
|
225
|
-
}
|
|
226
|
-
function mergeRouteRecords(stored, fallback) {
|
|
227
|
-
const agnostic = /* @__PURE__ */ new Set();
|
|
228
|
-
const localized = /* @__PURE__ */ new Set();
|
|
229
|
-
for (const route of stored) {
|
|
230
|
-
if (route.locale === void 0) agnostic.add(patternKey(route.pattern));
|
|
231
|
-
else localized.add(`${route.locale}|${patternKey(route.pattern)}`);
|
|
232
|
-
}
|
|
233
|
-
const covered = (route) => {
|
|
234
|
-
const key = patternKey(route.pattern);
|
|
235
|
-
if (agnostic.has(key)) return true;
|
|
236
|
-
return route.locale !== void 0 && localized.has(`${route.locale}|${key}`);
|
|
237
|
-
};
|
|
238
|
-
return [...stored, ...fallback.filter((route) => !covered(route))];
|
|
239
|
-
}
|
|
240
223
|
function createStaticContentSource(data) {
|
|
241
224
|
const locales = data.locales ?? DEFAULT_LOCALES;
|
|
242
225
|
const routes = data.routes ?? [];
|
|
@@ -989,16 +972,6 @@ function parseSources(rows) {
|
|
|
989
972
|
}
|
|
990
973
|
return sources;
|
|
991
974
|
}
|
|
992
|
-
function fallbackHomeRoutes(documents, locales) {
|
|
993
|
-
const homePage = [...documents].filter((doc) => doc.collection === "page").sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0)[0];
|
|
994
|
-
if (!homePage) return [];
|
|
995
|
-
return locales.locales.map((locale) => ({
|
|
996
|
-
id: `r-live-home-${locale}`,
|
|
997
|
-
pattern: "/",
|
|
998
|
-
locale,
|
|
999
|
-
document: { collection: "page", id: homePage.id }
|
|
1000
|
-
}));
|
|
1001
|
-
}
|
|
1002
975
|
function assembleLiveSource(payload, options, perspective) {
|
|
1003
976
|
const locales = options.locales;
|
|
1004
977
|
const documents = parseDocuments(payload.documents);
|
|
@@ -1310,6 +1283,6 @@ function createElytraHost(options) {
|
|
|
1310
1283
|
}
|
|
1311
1284
|
var PACKAGE = "@elytracms/next";
|
|
1312
1285
|
|
|
1313
|
-
export { CanvasRenderer, ELYTRA_HOST_ENV_KEYS, ElytraImage, PACKAGE, REVALIDATE_SIGNATURE_HEADER, assembleLiveSource, canvasPageMetadata, canvasSitemapEntries, collectBindingSourceIds, collectionCacheTag, createAssetImageLoader, createBindingResolver, createCanvasRoute, createCanvasSitemap, createContentSnapshot, createElytraHost, createPreviewDisableRoute, createPreviewRoute, createRevalidateRoute, createStaticContentSource, defaultBindingPayloads, defineHostComponents, docCacheTag, elytraHostImage, evaluatePreviewRequest, evaluateRevalidateRequest,
|
|
1286
|
+
export { CanvasRenderer, ELYTRA_HOST_ENV_KEYS, ElytraImage, PACKAGE, REVALIDATE_SIGNATURE_HEADER, assembleLiveSource, canvasPageMetadata, canvasSitemapEntries, collectBindingSourceIds, collectionCacheTag, createAssetImageLoader, createBindingResolver, createCanvasRoute, createCanvasSitemap, createContentSnapshot, createElytraHost, createPreviewDisableRoute, createPreviewRoute, createRevalidateRoute, createStaticContentSource, defaultBindingPayloads, defineHostComponents, docCacheTag, elytraHostImage, evaluatePreviewRequest, evaluateRevalidateRequest, firstBlockFullBleed, isSourcePayloadError, loadCachedEntry, loadLiveContent, materializeSourcePayloads, mergeCacheTags, nextCacheTags, nextImagePrimitive, pathFromSlug, projectSweepTag, resolveCanvasPage, resolveGlobals, resolveHostEnv, resolvePayloadToken, revalidatePayloadSchema, routeCacheTag, safeRedirectTarget, scopeCacheTag, signRevalidateBody, sourcePayloadError, splitLocalePath };
|
|
1314
1287
|
//# sourceMappingURL=index.js.map
|
|
1315
1288
|
//# sourceMappingURL=index.js.map
|