@cmssy/next 4.6.0 → 4.6.2

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.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('server-only');
4
3
  var headers = require('next/headers');
5
4
  var navigation = require('next/navigation');
6
5
  var react = require('@cmssy/react');
@@ -10,7 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
10
9
  var server = require('next/server');
11
10
  var crypto$1 = require('crypto');
12
11
 
13
- // src/index.ts
12
+ // src/create-cmssy-page.tsx
14
13
  var CMSSY_SESSION_COOKIE = "cmssy_session";
15
14
  var SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
16
15
  var MIN_SESSION_SECRET_LENGTH = 32;
@@ -114,6 +113,15 @@ function defineCmssyConfig(config) {
114
113
  }
115
114
  }
116
115
  if (missing.length > 0) {
116
+ if (typeof window !== "undefined") {
117
+ throw new Error(
118
+ `cmssy: the config was evaluated in the browser, so it cannot see the server's environment variables.
119
+
120
+ This is an import problem, not a config problem: a client component ("use client") imported a VALUE from a module that reads the cmssy config - directly, or through a helper next to one.
121
+
122
+ Fix it by importing types only (they are erased at build time), or by moving the value into a module that does not touch the config.`
123
+ );
124
+ }
117
125
  throw new Error(
118
126
  `cmssy: missing required configuration:
119
127
  - ${missing.join(
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import { headers, draftMode, cookies } from 'next/headers';
3
2
  import { notFound, redirect } from 'next/navigation';
4
3
  import { createCmssyClient, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, CmssyServerPage, fetchSiteConfig, fetchPageById, fetchPages, normalizeSlug as normalizeSlug$1, fetchPageMeta, resolveWorkspaceId, graphqlRequest, resolveApiUrl } from '@cmssy/react';
@@ -9,7 +8,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
9
8
  import { NextResponse } from 'next/server';
10
9
  import { createHmac, timingSafeEqual } from 'crypto';
11
10
 
12
- // src/index.ts
11
+ // src/create-cmssy-page.tsx
13
12
  var CMSSY_SESSION_COOKIE = "cmssy_session";
14
13
  var SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
15
14
  var MIN_SESSION_SECRET_LENGTH = 32;
@@ -113,6 +112,15 @@ function defineCmssyConfig(config) {
113
112
  }
114
113
  }
115
114
  if (missing.length > 0) {
115
+ if (typeof window !== "undefined") {
116
+ throw new Error(
117
+ `cmssy: the config was evaluated in the browser, so it cannot see the server's environment variables.
118
+
119
+ This is an import problem, not a config problem: a client component ("use client") imported a VALUE from a module that reads the cmssy config - directly, or through a helper next to one.
120
+
121
+ Fix it by importing types only (they are erased at build time), or by moving the value into a module that does not touch the config.`
122
+ );
123
+ }
116
124
  throw new Error(
117
125
  `cmssy: missing required configuration:
118
126
  - ${missing.join(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -46,7 +46,7 @@
46
46
  "dist"
47
47
  ],
48
48
  "peerDependencies": {
49
- "@cmssy/react": "^4.6.0",
49
+ "@cmssy/react": "^4.6.2",
50
50
  "next": ">=15",
51
51
  "react": "^18.2.0 || ^19.0.0",
52
52
  "react-dom": "^18.2.0 || ^19.0.0"
@@ -60,12 +60,11 @@
60
60
  "tsup": "^8.3.0",
61
61
  "typescript": "^5.6.0",
62
62
  "vitest": "^2.1.0",
63
- "@cmssy/react": "4.6.0"
63
+ "@cmssy/react": "4.6.2"
64
64
  },
65
65
  "dependencies": {
66
66
  "jose": "^6.2.3",
67
- "@cmssy/types": "0.27.0",
68
- "server-only": "^0.0.1"
67
+ "@cmssy/types": "0.27.0"
69
68
  },
70
69
  "scripts": {
71
70
  "build": "tsup",