@cmssy/next 19.0.0 → 19.1.1
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/server.cjs +39 -7
- package/dist/server.js +20 -8
- package/package.json +5 -5
package/dist/server.cjs
CHANGED
|
@@ -10,6 +10,27 @@ var internalServer = require('@cmssy/react/internal-server');
|
|
|
10
10
|
var internal = require('@cmssy/core/internal');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var cache = require('next/cache');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
13
34
|
|
|
14
35
|
// src/server.ts
|
|
15
36
|
|
|
@@ -25,10 +46,10 @@ var CMSSY_CONTENT_TAG = "cmssy-content";
|
|
|
25
46
|
function cmssyContentTags(tags = []) {
|
|
26
47
|
return [.../* @__PURE__ */ new Set([CMSSY_CONTENT_TAG, ...tags])];
|
|
27
48
|
}
|
|
28
|
-
function cmssyCachedFetch(
|
|
49
|
+
function cmssyCachedFetch(cache2) {
|
|
29
50
|
const next = {
|
|
30
|
-
revalidate:
|
|
31
|
-
tags: cmssyContentTags(
|
|
51
|
+
revalidate: cache2.revalidate,
|
|
52
|
+
tags: cmssyContentTags(cache2.tags)
|
|
32
53
|
};
|
|
33
54
|
return (url, init) => fetch(url, { ...init, next });
|
|
34
55
|
}
|
|
@@ -345,13 +366,24 @@ async function isCmssyEditMode() {
|
|
|
345
366
|
const h = await headers.headers();
|
|
346
367
|
return h.get(core.CMSSY_EDIT_HEADER) === "1";
|
|
347
368
|
}
|
|
369
|
+
function resolvePerRequest(cache2) {
|
|
370
|
+
if (typeof cache2 === "function") return cache2;
|
|
371
|
+
return (factory) => factory;
|
|
372
|
+
}
|
|
373
|
+
var perRequest = resolvePerRequest(
|
|
374
|
+
React__namespace.cache
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
// src/preset/resolve-cmssy-layout.ts
|
|
378
|
+
var requestLayoutStore = perRequest(internal.createCmssyLayoutStore);
|
|
348
379
|
function resolveCmssyLayout(config, options) {
|
|
349
|
-
const { cache, ...rest } = options;
|
|
380
|
+
const { cache: cache2, ...rest } = options;
|
|
350
381
|
const live = rest.editMode || rest.preview === true;
|
|
351
|
-
const fetchImpl = rest.fetch ?? (
|
|
382
|
+
const fetchImpl = rest.fetch ?? (cache2 && !live ? cmssyCachedFetch(cache2) : void 0);
|
|
352
383
|
return react.resolveCmssyLayout(config, {
|
|
353
384
|
...rest,
|
|
354
385
|
retry: rest.retry ?? nextRetryMode(),
|
|
386
|
+
layoutStore: rest.layoutStore ?? requestLayoutStore(),
|
|
355
387
|
...fetchImpl ? { fetch: fetchImpl } : {}
|
|
356
388
|
});
|
|
357
389
|
}
|
|
@@ -367,7 +399,7 @@ async function CmssyLayoutSlot({
|
|
|
367
399
|
editable,
|
|
368
400
|
appContext,
|
|
369
401
|
retry,
|
|
370
|
-
cache,
|
|
402
|
+
cache: cache2,
|
|
371
403
|
children
|
|
372
404
|
}) {
|
|
373
405
|
const layout = await resolveCmssyLayout(config, {
|
|
@@ -379,7 +411,7 @@ async function CmssyLayoutSlot({
|
|
|
379
411
|
...page !== void 0 ? { page } : {},
|
|
380
412
|
appContext,
|
|
381
413
|
retry,
|
|
382
|
-
cache,
|
|
414
|
+
cache: cache2,
|
|
383
415
|
...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
|
|
384
416
|
});
|
|
385
417
|
if (!children) return layout.element;
|
package/dist/server.js
CHANGED
|
@@ -5,9 +5,10 @@ import { createCmssyClient, CmssyServerPage, resolveCmssyLayout as resolveCmssyL
|
|
|
5
5
|
import { mintCmssyEditToken, CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin, verifyCmssyWebhook, CmssyWebhookError, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM } from '@cmssy/core';
|
|
6
6
|
import { CmssyLocaleProvider } from '@cmssy/react/internal';
|
|
7
7
|
import { blocksToSchemas, resolveEditorBlockData } from '@cmssy/react/internal-server';
|
|
8
|
-
import { isDevelopment, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, toCspOrigin, cmssySecretsMatch } from '@cmssy/core/internal';
|
|
8
|
+
import { createCmssyLayoutStore, isDevelopment, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, toCspOrigin, cmssySecretsMatch } from '@cmssy/core/internal';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { revalidateTag } from 'next/cache';
|
|
11
|
+
import * as React from 'react';
|
|
11
12
|
|
|
12
13
|
// src/server.ts
|
|
13
14
|
|
|
@@ -23,10 +24,10 @@ var CMSSY_CONTENT_TAG = "cmssy-content";
|
|
|
23
24
|
function cmssyContentTags(tags = []) {
|
|
24
25
|
return [.../* @__PURE__ */ new Set([CMSSY_CONTENT_TAG, ...tags])];
|
|
25
26
|
}
|
|
26
|
-
function cmssyCachedFetch(
|
|
27
|
+
function cmssyCachedFetch(cache2) {
|
|
27
28
|
const next = {
|
|
28
|
-
revalidate:
|
|
29
|
-
tags: cmssyContentTags(
|
|
29
|
+
revalidate: cache2.revalidate,
|
|
30
|
+
tags: cmssyContentTags(cache2.tags)
|
|
30
31
|
};
|
|
31
32
|
return (url, init) => fetch(url, { ...init, next });
|
|
32
33
|
}
|
|
@@ -343,13 +344,24 @@ async function isCmssyEditMode() {
|
|
|
343
344
|
const h = await headers();
|
|
344
345
|
return h.get(CMSSY_EDIT_HEADER) === "1";
|
|
345
346
|
}
|
|
347
|
+
function resolvePerRequest(cache2) {
|
|
348
|
+
if (typeof cache2 === "function") return cache2;
|
|
349
|
+
return (factory) => factory;
|
|
350
|
+
}
|
|
351
|
+
var perRequest = resolvePerRequest(
|
|
352
|
+
React.cache
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
// src/preset/resolve-cmssy-layout.ts
|
|
356
|
+
var requestLayoutStore = perRequest(createCmssyLayoutStore);
|
|
346
357
|
function resolveCmssyLayout(config, options) {
|
|
347
|
-
const { cache, ...rest } = options;
|
|
358
|
+
const { cache: cache2, ...rest } = options;
|
|
348
359
|
const live = rest.editMode || rest.preview === true;
|
|
349
|
-
const fetchImpl = rest.fetch ?? (
|
|
360
|
+
const fetchImpl = rest.fetch ?? (cache2 && !live ? cmssyCachedFetch(cache2) : void 0);
|
|
350
361
|
return resolveCmssyLayout$1(config, {
|
|
351
362
|
...rest,
|
|
352
363
|
retry: rest.retry ?? nextRetryMode(),
|
|
364
|
+
layoutStore: rest.layoutStore ?? requestLayoutStore(),
|
|
353
365
|
...fetchImpl ? { fetch: fetchImpl } : {}
|
|
354
366
|
});
|
|
355
367
|
}
|
|
@@ -365,7 +377,7 @@ async function CmssyLayoutSlot({
|
|
|
365
377
|
editable,
|
|
366
378
|
appContext,
|
|
367
379
|
retry,
|
|
368
|
-
cache,
|
|
380
|
+
cache: cache2,
|
|
369
381
|
children
|
|
370
382
|
}) {
|
|
371
383
|
const layout = await resolveCmssyLayout(config, {
|
|
@@ -377,7 +389,7 @@ async function CmssyLayoutSlot({
|
|
|
377
389
|
...page !== void 0 ? { page } : {},
|
|
378
390
|
appContext,
|
|
379
391
|
retry,
|
|
380
|
-
cache,
|
|
392
|
+
cache: cache2,
|
|
381
393
|
...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
|
|
382
394
|
});
|
|
383
395
|
if (!children) return layout.element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.1.1",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@cmssy/react": "^19.
|
|
74
|
+
"@cmssy/react": "^19.1.1",
|
|
75
75
|
"next": ">=15",
|
|
76
76
|
"react": "^18.2.0 || ^19.0.0",
|
|
77
77
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"tsup": "^8.3.0",
|
|
86
86
|
"typescript": "^5.6.0",
|
|
87
87
|
"vitest": "^2.1.0",
|
|
88
|
-
"@cmssy/react": "19.
|
|
88
|
+
"@cmssy/react": "19.1.1"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@cmssy/types": "0.
|
|
91
|
+
"@cmssy/types": "0.59.0",
|
|
92
92
|
"server-only": "^0.0.1",
|
|
93
|
-
"@cmssy/core": "19.
|
|
93
|
+
"@cmssy/core": "19.1.1"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsup",
|