@cmssy/next 16.2.1 → 16.4.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/dist/server.cjs +36 -0
- package/dist/server.js +37 -1
- package/package.json +5 -5
package/dist/server.cjs
CHANGED
|
@@ -100,6 +100,9 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
|
|
|
100
100
|
...requestOptions
|
|
101
101
|
});
|
|
102
102
|
if (!page) {
|
|
103
|
+
if (internal.isDevelopment() && !editMode) {
|
|
104
|
+
return renderNothingPublishedPage(config, pagePath);
|
|
105
|
+
}
|
|
103
106
|
navigation.notFound();
|
|
104
107
|
}
|
|
105
108
|
if (editorActive && !Editor) {
|
|
@@ -195,6 +198,39 @@ async function renderEditDiagnosticsPage(config, query) {
|
|
|
195
198
|
}
|
|
196
199
|
);
|
|
197
200
|
}
|
|
201
|
+
async function renderNothingPublishedPage(config, path) {
|
|
202
|
+
const { buildEditorUrl } = await import('@cmssy/core/preflight');
|
|
203
|
+
const editorUrl = buildEditorUrl(config);
|
|
204
|
+
const shown = `/${(path ?? []).join("/")}`;
|
|
205
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
206
|
+
"main",
|
|
207
|
+
{
|
|
208
|
+
style: {
|
|
209
|
+
fontFamily: "system-ui, sans-serif",
|
|
210
|
+
maxWidth: "40rem",
|
|
211
|
+
margin: "4rem auto",
|
|
212
|
+
padding: "0 1.5rem",
|
|
213
|
+
lineHeight: 1.5
|
|
214
|
+
},
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h1", { style: { fontSize: "1.5rem", margin: "0 0 0.5rem" }, children: [
|
|
217
|
+
"Nothing published yet at ",
|
|
218
|
+
shown
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: "0 0 1rem" }, children: [
|
|
221
|
+
"Your app is wired to workspace ",
|
|
222
|
+
/* @__PURE__ */ jsxRuntime.jsxs("code", { children: [
|
|
223
|
+
config.org,
|
|
224
|
+
"/",
|
|
225
|
+
config.workspaceSlug
|
|
226
|
+
] }),
|
|
227
|
+
", but no published page answers this path. Build one in the editor and publish it - this screen only shows in development; production returns a 404."
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: editorUrl, children: "Open the cmssy editor" }) })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}
|
|
198
234
|
async function resolveDevOrigin() {
|
|
199
235
|
try {
|
|
200
236
|
const requestHeaders = await headers.headers();
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,7 @@ import { CmssyLocaleProvider } from '@cmssy/react/internal';
|
|
|
6
6
|
import { blocksToSchemas, resolveEditorBlockData } from '@cmssy/react/internal-server';
|
|
7
7
|
import { isDevelopment, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, toCspOrigin, cmssySecretsMatch } from '@cmssy/core/internal';
|
|
8
8
|
import { CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin, verifyCmssyWebhook, CmssyWebhookError, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM } from '@cmssy/core';
|
|
9
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { revalidateTag } from 'next/cache';
|
|
11
11
|
|
|
12
12
|
// src/server.ts
|
|
@@ -98,6 +98,9 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
|
|
|
98
98
|
...requestOptions
|
|
99
99
|
});
|
|
100
100
|
if (!page) {
|
|
101
|
+
if (isDevelopment() && !editMode) {
|
|
102
|
+
return renderNothingPublishedPage(config, pagePath);
|
|
103
|
+
}
|
|
101
104
|
notFound();
|
|
102
105
|
}
|
|
103
106
|
if (editorActive && !Editor) {
|
|
@@ -193,6 +196,39 @@ async function renderEditDiagnosticsPage(config, query) {
|
|
|
193
196
|
}
|
|
194
197
|
);
|
|
195
198
|
}
|
|
199
|
+
async function renderNothingPublishedPage(config, path) {
|
|
200
|
+
const { buildEditorUrl } = await import('@cmssy/core/preflight');
|
|
201
|
+
const editorUrl = buildEditorUrl(config);
|
|
202
|
+
const shown = `/${(path ?? []).join("/")}`;
|
|
203
|
+
return /* @__PURE__ */ jsxs(
|
|
204
|
+
"main",
|
|
205
|
+
{
|
|
206
|
+
style: {
|
|
207
|
+
fontFamily: "system-ui, sans-serif",
|
|
208
|
+
maxWidth: "40rem",
|
|
209
|
+
margin: "4rem auto",
|
|
210
|
+
padding: "0 1.5rem",
|
|
211
|
+
lineHeight: 1.5
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsxs("h1", { style: { fontSize: "1.5rem", margin: "0 0 0.5rem" }, children: [
|
|
215
|
+
"Nothing published yet at ",
|
|
216
|
+
shown
|
|
217
|
+
] }),
|
|
218
|
+
/* @__PURE__ */ jsxs("p", { style: { margin: "0 0 1rem" }, children: [
|
|
219
|
+
"Your app is wired to workspace ",
|
|
220
|
+
/* @__PURE__ */ jsxs("code", { children: [
|
|
221
|
+
config.org,
|
|
222
|
+
"/",
|
|
223
|
+
config.workspaceSlug
|
|
224
|
+
] }),
|
|
225
|
+
", but no published page answers this path. Build one in the editor and publish it - this screen only shows in development; production returns a 404."
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ jsx("p", { style: { margin: 0 }, children: /* @__PURE__ */ jsx("a", { href: editorUrl, children: "Open the cmssy editor" }) })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
196
232
|
async function resolveDevOrigin() {
|
|
197
233
|
try {
|
|
198
234
|
const requestHeaders = await headers();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.0",
|
|
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": "^16.
|
|
74
|
+
"@cmssy/react": "^16.4.0",
|
|
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": "16.
|
|
88
|
+
"@cmssy/react": "16.4.0"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@cmssy/types": "0.
|
|
91
|
+
"@cmssy/types": "0.49.0",
|
|
92
92
|
"server-only": "^0.0.1",
|
|
93
|
-
"@cmssy/core": "16.
|
|
93
|
+
"@cmssy/core": "16.4.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsup",
|