@nodehive/nextjs 0.1.0 → 0.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/README.md +30 -67
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
# @nodehive/nextjs
|
|
2
2
|
|
|
3
3
|
NodeHive integration for Next.js (App Router): auth, a Puck editing surface, a
|
|
4
|
-
Drupal visual editor overlay, and a floating smart-actions toolbar,
|
|
5
|
-
|
|
4
|
+
Drupal visual editor overlay, and a floating smart-actions toolbar, on top of
|
|
5
|
+
the framework-neutral [`nodehive-js`](https://www.npmjs.com/package/nodehive-js)
|
|
6
6
|
SDK.
|
|
7
7
|
|
|
8
|
-
ESM-only. Requires **React 19** and **Next 16** (App Router).
|
|
9
|
-
`dist/` is precompiled with the React Compiler, so consumers get memoized
|
|
10
|
-
components without configuring the compiler themselves.
|
|
8
|
+
ESM-only. Requires **React 19** and **Next 16** (App Router).
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @nodehive/nextjs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Required peers: `react` (^19), `next` (^16), `nodehive-js`. The editor peers
|
|
17
|
+
(`@puckeditor/core`, `@tiptap/core`, `@tiptap/pm`, `@tiptap/react`,
|
|
18
|
+
`@tanstack/react-query`, `motion`, `sonner`) are optional and only needed if you
|
|
19
|
+
use the puck-editor, visual-editor or smart-actions modules.
|
|
14
20
|
|
|
15
21
|
## Modules
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
Import only the documented subpaths below; anything else is internal and not
|
|
24
|
+
part of the public API.
|
|
19
25
|
|
|
20
26
|
| Module | Imports | Purpose |
|
|
21
27
|
| --- | --- | --- |
|
|
22
28
|
| auth | `@nodehive/nextjs/auth`, `/auth/server`, `/auth/react`, `/auth/routes`, `/auth/proxy` | OAuth login (authorization code + PKCE), session, client factories |
|
|
23
29
|
| puck-editor | `@nodehive/nextjs/puck-editor`, `/puck-editor/server`, `/puck-editor/fields`, `/puck-editor/render`, `/puck-editor/smart-actions`, `/puck-editor/puck-theme.css` | Puck editing surface |
|
|
24
30
|
| visual-editor | `@nodehive/nextjs/visual-editor`, `/visual-editor/server` | Drupal-iframe overlays + bridge |
|
|
25
|
-
| smart-actions | `@nodehive/nextjs/smart-actions/server` | Floating editor toolbar
|
|
31
|
+
| smart-actions | `@nodehive/nextjs/smart-actions/server` | Floating editor toolbar |
|
|
26
32
|
| theme | `@nodehive/nextjs/theme.css` | Shared `--nh-editor-*` theming contract |
|
|
27
33
|
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install @nodehive/nextjs
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Required peers: `react` (^19), `next` (^16), `nodehive-js`. The editor-heavy
|
|
35
|
-
peers (`@puckeditor/core`, `@tiptap/core`, `@tiptap/pm`, `@tiptap/react`,
|
|
36
|
-
`@tanstack/react-query`, `motion`, `sonner`) are optional and only needed if you
|
|
37
|
-
use the puck-editor, visual-editor or smart-actions modules.
|
|
38
|
-
|
|
39
34
|
## Styling
|
|
40
35
|
|
|
41
36
|
Import the compiled theme once (e.g. in your root layout):
|
|
@@ -45,58 +40,26 @@ import '@nodehive/nextjs/theme.css';
|
|
|
45
40
|
```
|
|
46
41
|
|
|
47
42
|
The Puck canvas additionally uses `@nodehive/nextjs/puck-editor/puck-theme.css`.
|
|
48
|
-
Both are precompiled (Tailwind
|
|
49
|
-
the `--nh-editor-*` contract works without a Tailwind setup on the consumer side.
|
|
43
|
+
Both are precompiled (no Tailwind setup needed on your side, no CSS reset).
|
|
50
44
|
|
|
51
45
|
## Environment
|
|
52
46
|
|
|
53
|
-
The `auth` module reads all secrets from the runtime environment
|
|
54
|
-
baked into the build.
|
|
47
|
+
The `auth` module reads all secrets from the runtime environment.
|
|
55
48
|
|
|
56
|
-
| Variable |
|
|
57
|
-
| --- | --- |
|
|
58
|
-
| `NEXT_PUBLIC_DRUPAL_BASE_URL` |
|
|
59
|
-
| `NEXT_PUBLIC_DRUPAL_REST_BASE_URL` |
|
|
60
|
-
| `NEXT_PUBLIC_NODEHIVE_SPACE_NAME` |
|
|
61
|
-
| `NODEHIVE_OAUTH_USER_CLIENT_ID` |
|
|
62
|
-
| `NODEHIVE_OAUTH_USER_CLIENT_SECRET` |
|
|
63
|
-
| `NODEHIVE_OAUTH_ANON_CLIENT_ID` |
|
|
64
|
-
| `NODEHIVE_OAUTH_ANON_CLIENT_SECRET` |
|
|
65
|
-
| `NODEHIVE_HANDOFF_SECRET` | for the CHIPS editor handoff
|
|
66
|
-
| `NODEHIVE_DEBUG` | no | Verbose client logging |
|
|
49
|
+
| Variable | Purpose |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `NEXT_PUBLIC_DRUPAL_BASE_URL` | Drupal/NodeHive OAuth issuer base URL |
|
|
52
|
+
| `NEXT_PUBLIC_DRUPAL_REST_BASE_URL` | JSON:API / REST base URL |
|
|
53
|
+
| `NEXT_PUBLIC_NODEHIVE_SPACE_NAME` | NodeHive space identifier |
|
|
54
|
+
| `NODEHIVE_OAUTH_USER_CLIENT_ID` | OAuth client id (authorization code + PKCE) |
|
|
55
|
+
| `NODEHIVE_OAUTH_USER_CLIENT_SECRET` | OAuth client secret |
|
|
56
|
+
| `NODEHIVE_OAUTH_ANON_CLIENT_ID` | Client credentials id (for anonymous fetches) |
|
|
57
|
+
| `NODEHIVE_OAUTH_ANON_CLIENT_SECRET` | Client credentials secret |
|
|
58
|
+
| `NODEHIVE_HANDOFF_SECRET` | AES-256-GCM key seed for the CHIPS editor handoff, e.g. `openssl rand -base64 32` |
|
|
67
59
|
|
|
68
60
|
Keep every secret server-side. `NEXT_PUBLIC_*` values are exposed to the browser
|
|
69
61
|
by Next; the non-prefixed ones must never be.
|
|
70
62
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
- Website code imports the exported entries only. `internal/` and `shared/` are
|
|
74
|
-
not exported, so deep imports fail type resolution.
|
|
75
|
-
- Modules are layered: every module may import `shared/` (non-exported helpers)
|
|
76
|
-
and the public `auth` entries (the base layer, which imports no other module).
|
|
77
|
-
Module-to-module imports and imports into a sibling's `internal/` are
|
|
78
|
-
forbidden; independent modules are wired together by the consuming app (the
|
|
79
|
-
app passes puck-editor's smart actions into smart-actions).
|
|
80
|
-
- A module depends on `auth` where auth is part of its contract (visual-editor
|
|
81
|
-
gates overlays behind `SignedIn`, puck-editor protects its API routes) and
|
|
82
|
-
stays auth-agnostic where it is not (rendering).
|
|
83
|
-
- Editor-heavy dependencies are optional peers (via `peerDependenciesMeta`) so
|
|
84
|
-
auth-only consumers stay lean.
|
|
85
|
-
|
|
86
|
-
## Build (contributors)
|
|
87
|
-
|
|
88
|
-
`npm run build` produces `dist/`:
|
|
89
|
-
|
|
90
|
-
- **JS**: `tsc --emitDeclarationOnly` for `.d.ts`, then Babel for the JS emit.
|
|
91
|
-
Babel runs `babel-plugin-react-compiler` on `'use client'` modules (so the
|
|
92
|
-
shipped client components are memoized) and rewrites `.ts`/`.tsx` import
|
|
93
|
-
specifiers to `.js`. Server components are deliberately not compiled. The
|
|
94
|
-
compiled output imports `react/compiler-runtime`, which is built into React 19.
|
|
95
|
-
- **CSS**: Tailwind precompiles `css/theme.css` to `dist/theme.css`;
|
|
96
|
-
`src/puck-editor/puck-theme.css` is copied to `dist/puck-editor/`.
|
|
97
|
-
|
|
98
|
-
`dist/` is gitignored and rebuilt by the workspace on demand.
|
|
99
|
-
|
|
100
|
-
## Changelog
|
|
63
|
+
## License
|
|
101
64
|
|
|
102
|
-
|
|
65
|
+
MIT © NETNODE AG
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodehive/nextjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "NodeHive Next.js infrastructure modules: auth, puck-editor, visual-editor, smart-actions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "NETNODE AG <info@netnode.ch>",
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"build:js": "tsc -p tsconfig.build.json --emitDeclarationOnly && babel src --out-dir dist --extensions .ts,.tsx --source-maps true --ignore \"src/**/*.test.ts,src/**/*.test.tsx\"",
|
|
32
32
|
"build:css": "tailwindcss -i css/theme.css -o dist/theme.css --minify && mkdir -p dist/puck-editor && cp src/puck-editor/puck-theme.css dist/puck-editor/puck-theme.css",
|
|
33
33
|
"dev": "npm run build:css && (tsc -p tsconfig.build.json --watch --preserveWatchOutput & tailwindcss -i css/theme.css -o dist/theme.css --watch)",
|
|
34
|
+
"lint": "eslint",
|
|
35
|
+
"test:unit": "node --import ./test-hooks.ts --experimental-test-module-mocks --test 'src/**/*.test.ts'",
|
|
34
36
|
"prepublishOnly": "npm run build"
|
|
35
37
|
},
|
|
36
38
|
"exports": {
|
|
@@ -148,6 +150,12 @@
|
|
|
148
150
|
"@types/react": "^19.2.8",
|
|
149
151
|
"babel-plugin-react-compiler": "1.0.0",
|
|
150
152
|
"babel-plugin-replace-import-extension": "^1.1.5",
|
|
153
|
+
"eslint": "^9.39.4",
|
|
154
|
+
"eslint-config-next": "^16.2.10",
|
|
155
|
+
"eslint-config-prettier": "^10.1.8",
|
|
156
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
157
|
+
"eslint-plugin-check-file": "^3.3.1",
|
|
158
|
+
"eslint-plugin-react-no-manual-memo": "^1.0.4",
|
|
151
159
|
"tailwindcss": "^4.1.18",
|
|
152
160
|
"typescript": "^6.0.3"
|
|
153
161
|
}
|