@cmssy/next 4.7.0 → 4.7.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/preset.cjs +14 -8
- package/dist/preset.d.cts +18 -9
- package/dist/preset.d.ts +18 -9
- package/dist/preset.js +14 -8
- package/dist/testing.cjs +2 -6
- package/dist/testing.js +2 -6
- package/package.json +3 -3
package/dist/preset.cjs
CHANGED
|
@@ -202,14 +202,20 @@ async function CmssyChrome({
|
|
|
202
202
|
]);
|
|
203
203
|
if (editMode && editable) {
|
|
204
204
|
const origin = resolveEditorOrigin(config.editorOrigin);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
const Editable = editable;
|
|
206
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
207
|
+
Editable,
|
|
208
|
+
{
|
|
209
|
+
groups,
|
|
210
|
+
position,
|
|
211
|
+
locale,
|
|
212
|
+
defaultLocale: siteLocales.defaultLocale,
|
|
213
|
+
enabledLocales: siteLocales.locales,
|
|
214
|
+
edit: {
|
|
215
|
+
editorOrigin: (Array.isArray(origin) ? origin[0] : origin) ?? ""
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
);
|
|
213
219
|
}
|
|
214
220
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
215
221
|
react.CmssyServerLayout,
|
package/dist/preset.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { C as CmssyNextConfig } from './config-DNaPqq1f.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
4
|
+
import { ComponentType } from 'react';
|
|
5
5
|
import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
|
|
6
6
|
import '@cmssy/types';
|
|
7
7
|
|
|
@@ -29,8 +29,15 @@ interface CmssyProxyOptions {
|
|
|
29
29
|
* before this existed.
|
|
30
30
|
*/
|
|
31
31
|
declare function createCmssyProxy(config: CmssyNextConfig, options?: CmssyProxyOptions): (request: NextRequest) => Promise<NextResponse>;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
32
|
+
/**
|
|
33
|
+
* The matcher a cmssy app wants: everything except Next internals, API routes
|
|
34
|
+
* and files with an extension.
|
|
35
|
+
*
|
|
36
|
+
* Next parses `export const config` at COMPILE time, so it rejects an imported
|
|
37
|
+
* constant - copy this value into your proxy literally:
|
|
38
|
+
*
|
|
39
|
+
* export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };
|
|
40
|
+
*/
|
|
34
41
|
declare const cmssyProxyMatcher: string[];
|
|
35
42
|
|
|
36
43
|
interface CmssyChromeProps {
|
|
@@ -42,11 +49,13 @@ interface CmssyChromeProps {
|
|
|
42
49
|
*/
|
|
43
50
|
page?: string;
|
|
44
51
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* The client wrapper around CmssyLazyLayout, rendered in edit mode. Without it
|
|
53
|
+
* the header and the footer are markup the editor can select and cannot fill.
|
|
54
|
+
*
|
|
55
|
+
* A COMPONENT, not a function to call: it lives on the client, and the server
|
|
56
|
+
* can only render it.
|
|
48
57
|
*/
|
|
49
|
-
editable?:
|
|
58
|
+
editable?: ComponentType<{
|
|
50
59
|
groups: CmssyLayoutGroup[];
|
|
51
60
|
position: string;
|
|
52
61
|
locale: string;
|
|
@@ -55,7 +64,7 @@ interface CmssyChromeProps {
|
|
|
55
64
|
edit: {
|
|
56
65
|
editorOrigin: string;
|
|
57
66
|
};
|
|
58
|
-
}
|
|
67
|
+
}>;
|
|
59
68
|
}
|
|
60
69
|
/**
|
|
61
70
|
* The site chrome, rendered the way each mode needs it:
|
|
@@ -67,6 +76,6 @@ interface CmssyChromeProps {
|
|
|
67
76
|
* Getting this wrong is invisible - the site looks right and the editor shows a
|
|
68
77
|
* header it cannot edit, or the published version of one. Both shipped before.
|
|
69
78
|
*/
|
|
70
|
-
declare function CmssyChrome({ config, blocks, position, page, editable, }: CmssyChromeProps): Promise<
|
|
79
|
+
declare function CmssyChrome({ config, blocks, position, page, editable, }: CmssyChromeProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
71
80
|
|
|
72
81
|
export { CmssyChrome, type CmssyChromeProps, type CmssyProxyOptions, cmssyProxyMatcher, createCmssyProxy };
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { C as CmssyNextConfig } from './config-DNaPqq1f.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
4
|
+
import { ComponentType } from 'react';
|
|
5
5
|
import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
|
|
6
6
|
import '@cmssy/types';
|
|
7
7
|
|
|
@@ -29,8 +29,15 @@ interface CmssyProxyOptions {
|
|
|
29
29
|
* before this existed.
|
|
30
30
|
*/
|
|
31
31
|
declare function createCmssyProxy(config: CmssyNextConfig, options?: CmssyProxyOptions): (request: NextRequest) => Promise<NextResponse>;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
32
|
+
/**
|
|
33
|
+
* The matcher a cmssy app wants: everything except Next internals, API routes
|
|
34
|
+
* and files with an extension.
|
|
35
|
+
*
|
|
36
|
+
* Next parses `export const config` at COMPILE time, so it rejects an imported
|
|
37
|
+
* constant - copy this value into your proxy literally:
|
|
38
|
+
*
|
|
39
|
+
* export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };
|
|
40
|
+
*/
|
|
34
41
|
declare const cmssyProxyMatcher: string[];
|
|
35
42
|
|
|
36
43
|
interface CmssyChromeProps {
|
|
@@ -42,11 +49,13 @@ interface CmssyChromeProps {
|
|
|
42
49
|
*/
|
|
43
50
|
page?: string;
|
|
44
51
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* The client wrapper around CmssyLazyLayout, rendered in edit mode. Without it
|
|
53
|
+
* the header and the footer are markup the editor can select and cannot fill.
|
|
54
|
+
*
|
|
55
|
+
* A COMPONENT, not a function to call: it lives on the client, and the server
|
|
56
|
+
* can only render it.
|
|
48
57
|
*/
|
|
49
|
-
editable?:
|
|
58
|
+
editable?: ComponentType<{
|
|
50
59
|
groups: CmssyLayoutGroup[];
|
|
51
60
|
position: string;
|
|
52
61
|
locale: string;
|
|
@@ -55,7 +64,7 @@ interface CmssyChromeProps {
|
|
|
55
64
|
edit: {
|
|
56
65
|
editorOrigin: string;
|
|
57
66
|
};
|
|
58
|
-
}
|
|
67
|
+
}>;
|
|
59
68
|
}
|
|
60
69
|
/**
|
|
61
70
|
* The site chrome, rendered the way each mode needs it:
|
|
@@ -67,6 +76,6 @@ interface CmssyChromeProps {
|
|
|
67
76
|
* Getting this wrong is invisible - the site looks right and the editor shows a
|
|
68
77
|
* header it cannot edit, or the published version of one. Both shipped before.
|
|
69
78
|
*/
|
|
70
|
-
declare function CmssyChrome({ config, blocks, position, page, editable, }: CmssyChromeProps): Promise<
|
|
79
|
+
declare function CmssyChrome({ config, blocks, position, page, editable, }: CmssyChromeProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
71
80
|
|
|
72
81
|
export { CmssyChrome, type CmssyChromeProps, type CmssyProxyOptions, cmssyProxyMatcher, createCmssyProxy };
|
package/dist/preset.js
CHANGED
|
@@ -200,14 +200,20 @@ async function CmssyChrome({
|
|
|
200
200
|
]);
|
|
201
201
|
if (editMode && editable) {
|
|
202
202
|
const origin = resolveEditorOrigin(config.editorOrigin);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
const Editable = editable;
|
|
204
|
+
return /* @__PURE__ */ jsx(
|
|
205
|
+
Editable,
|
|
206
|
+
{
|
|
207
|
+
groups,
|
|
208
|
+
position,
|
|
209
|
+
locale,
|
|
210
|
+
defaultLocale: siteLocales.defaultLocale,
|
|
211
|
+
enabledLocales: siteLocales.locales,
|
|
212
|
+
edit: {
|
|
213
|
+
editorOrigin: (Array.isArray(origin) ? origin[0] : origin) ?? ""
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
);
|
|
211
217
|
}
|
|
212
218
|
return /* @__PURE__ */ jsx(
|
|
213
219
|
CmssyServerLayout,
|
package/dist/testing.cjs
CHANGED
|
@@ -18,11 +18,7 @@ async function checkCmssyEditMode(options) {
|
|
|
18
18
|
if (EDITOR_MARKER.test(publicPage.body)) {
|
|
19
19
|
failures.push(`public ${path}: the editor is mounted on a public page`);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
failures.push(
|
|
23
|
-
`public ${path}: no server-rendered chrome - the layout blocks are missing`
|
|
24
|
-
);
|
|
25
|
-
}
|
|
21
|
+
const hasServerChrome = SERVER_CHROME.test(publicPage.body);
|
|
26
22
|
const unverified = await html(url(`${path}?cmssyEdit=1`));
|
|
27
23
|
if (EDITOR_MARKER.test(unverified.body)) {
|
|
28
24
|
failures.push(
|
|
@@ -40,7 +36,7 @@ async function checkCmssyEditMode(options) {
|
|
|
40
36
|
`edit ${path}: no editor in the response - is the /cmssy-edit route mounted?`
|
|
41
37
|
);
|
|
42
38
|
}
|
|
43
|
-
if (SERVER_CHROME.test(verified.body)) {
|
|
39
|
+
if (hasServerChrome && SERVER_CHROME.test(verified.body)) {
|
|
44
40
|
failures.push(
|
|
45
41
|
`edit ${path}: the chrome is still server-rendered - the header and footer will be selectable but have no fields (is CMSSY_EDIT_HEADER set on the rewrite?)`
|
|
46
42
|
);
|
package/dist/testing.js
CHANGED
|
@@ -16,11 +16,7 @@ async function checkCmssyEditMode(options) {
|
|
|
16
16
|
if (EDITOR_MARKER.test(publicPage.body)) {
|
|
17
17
|
failures.push(`public ${path}: the editor is mounted on a public page`);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
failures.push(
|
|
21
|
-
`public ${path}: no server-rendered chrome - the layout blocks are missing`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
19
|
+
const hasServerChrome = SERVER_CHROME.test(publicPage.body);
|
|
24
20
|
const unverified = await html(url(`${path}?cmssyEdit=1`));
|
|
25
21
|
if (EDITOR_MARKER.test(unverified.body)) {
|
|
26
22
|
failures.push(
|
|
@@ -38,7 +34,7 @@ async function checkCmssyEditMode(options) {
|
|
|
38
34
|
`edit ${path}: no editor in the response - is the /cmssy-edit route mounted?`
|
|
39
35
|
);
|
|
40
36
|
}
|
|
41
|
-
if (SERVER_CHROME.test(verified.body)) {
|
|
37
|
+
if (hasServerChrome && SERVER_CHROME.test(verified.body)) {
|
|
42
38
|
failures.push(
|
|
43
39
|
`edit ${path}: the chrome is still server-rendered - the header and footer will be selectable but have no fields (is CMSSY_EDIT_HEADER set on the rewrite?)`
|
|
44
40
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dist"
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@cmssy/react": "^4.7.
|
|
54
|
+
"@cmssy/react": "^4.7.1",
|
|
55
55
|
"next": ">=15",
|
|
56
56
|
"react": "^18.2.0 || ^19.0.0",
|
|
57
57
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"tsup": "^8.3.0",
|
|
66
66
|
"typescript": "^5.6.0",
|
|
67
67
|
"vitest": "^2.1.0",
|
|
68
|
-
"@cmssy/react": "4.7.
|
|
68
|
+
"@cmssy/react": "4.7.1"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"jose": "^6.2.3",
|