@decocms/nextjs 7.2.3 → 7.3.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/package.json +5 -4
- package/src/routeHandlers.ts +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/nextjs",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco framework binding for Next.js App Router",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "./src/index.ts",
|
|
12
12
|
"exports": {
|
|
13
|
-
".": "./src/index.ts"
|
|
13
|
+
".": "./src/index.ts",
|
|
14
|
+
"./routeHandlers": "./src/routeHandlers.ts"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc",
|
|
@@ -19,8 +20,8 @@
|
|
|
19
20
|
"lint:unused": "knip"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@decocms/blocks": "7.
|
|
23
|
-
"@decocms/blocks-admin": "7.
|
|
23
|
+
"@decocms/blocks": "7.3.1",
|
|
24
|
+
"@decocms/blocks-admin": "7.3.1"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"next": ">=15.0.0",
|
package/src/routeHandlers.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin Route Handlers for Next.js App Router.
|
|
3
|
+
*
|
|
4
|
+
* IMPORT THESE FROM `@decocms/nextjs/routeHandlers` IN ROUTE FILES — never
|
|
5
|
+
* from the `@decocms/nextjs` root barrel. Route handlers (app router
|
|
6
|
+
* route.ts files) evaluate their whole module graph against React's
|
|
7
|
+
* react-server build and IGNORE `"use client"` directives (there is no
|
|
8
|
+
* client graph to move a module into). The root barrel also exports the
|
|
9
|
+
* render components (SectionRenderer, DecoRootLayout, ...), whose graph
|
|
10
|
+
* reaches `@decocms/blocks/hooks` — files with module-scope client-React
|
|
11
|
+
* usage (e.g. `class ... extends Component`) that the react-server build
|
|
12
|
+
* does not export. Importing the root barrel from a route file therefore
|
|
13
|
+
* crashes at module evaluation ("...createContext is not a function" /
|
|
14
|
+
* "Class extends value undefined is not a constructor") before the handler
|
|
15
|
+
* ever runs. This subpath keeps the route-handler graph free of all
|
|
16
|
+
* component code.
|
|
17
|
+
*/
|
|
1
18
|
import {
|
|
2
19
|
handleDecofileRead,
|
|
3
20
|
handleDecofileReload,
|
|
@@ -6,7 +23,7 @@ import {
|
|
|
6
23
|
handleRender,
|
|
7
24
|
} from "@decocms/blocks-admin";
|
|
8
25
|
|
|
9
|
-
/** For app/live/_meta/route.ts: `export { metaGET as GET } from "@decocms/nextjs"` */
|
|
26
|
+
/** For app/live/_meta/route.ts: `export { metaGET as GET } from "@decocms/nextjs/routeHandlers"` */
|
|
10
27
|
export async function metaGET(request: Request): Promise<Response> {
|
|
11
28
|
return handleMeta(request);
|
|
12
29
|
}
|