@coherent.js/nextjs 1.0.0-beta.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/LICENSE +21 -0
- package/dist/index.cjs +3822 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +3781 -0
- package/dist/index.js.map +7 -0
- package/dist/nextjs/coherent-nextjs.d.ts +54 -0
- package/dist/nextjs/coherent-nextjs.d.ts.map +1 -0
- package/dist/nextjs/coherent-nextjs.js +223 -0
- package/dist/nextjs/coherent-nextjs.js.map +1 -0
- package/dist/nextjs/index.d.ts +2 -0
- package/dist/nextjs/index.d.ts.map +1 -0
- package/dist/nextjs/index.js +15 -0
- package/dist/nextjs/index.js.map +1 -0
- package/package.json +47 -0
- package/types/index.d.ts +329 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a Next.js API route handler for Coherent.js components
|
|
3
|
+
*
|
|
4
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
5
|
+
* @param {Object} options - Handler options
|
|
6
|
+
* @param {boolean} options.enablePerformanceMonitoring - Enable performance monitoring
|
|
7
|
+
* @param {string} options.template - HTML template with {{content}} placeholder
|
|
8
|
+
* @returns {Function} Next.js API route handler
|
|
9
|
+
*/
|
|
10
|
+
export function createCoherentNextHandler(componentFactory: Function, options?: {
|
|
11
|
+
enablePerformanceMonitoring: boolean;
|
|
12
|
+
template: string;
|
|
13
|
+
}): Function;
|
|
14
|
+
/**
|
|
15
|
+
* Create a Next.js App Router route handler for Coherent.js components
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
18
|
+
* @param {Object} options - Handler options
|
|
19
|
+
* @returns {Function} Next.js App Router route handler
|
|
20
|
+
*/
|
|
21
|
+
export function createCoherentAppRouterHandler(componentFactory: Function, options?: Object): Function;
|
|
22
|
+
/**
|
|
23
|
+
* Create a Next.js Server Component for Coherent.js
|
|
24
|
+
*
|
|
25
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
26
|
+
* @param {Object} options - Component options
|
|
27
|
+
* @returns {Function} Next.js Server Component
|
|
28
|
+
*/
|
|
29
|
+
export function createCoherentServerComponent(componentFactory: Function, options?: Object): Function;
|
|
30
|
+
/**
|
|
31
|
+
* Create a Next.js Client Component for Coherent.js with hydration support
|
|
32
|
+
*
|
|
33
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
34
|
+
* @param {Object} options - Component options
|
|
35
|
+
* @returns {Function} Next.js Client Component
|
|
36
|
+
*/
|
|
37
|
+
export function createCoherentClientComponent(componentFactory: Function, options?: Object): Function;
|
|
38
|
+
/**
|
|
39
|
+
* Create Next.js integration with dependency checking
|
|
40
|
+
* This function ensures Next.js and React are available before setting up the integration
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} options - Setup options
|
|
43
|
+
* @returns {Promise<Object>} - Object with Next.js integration utilities
|
|
44
|
+
*/
|
|
45
|
+
export function createNextIntegration(options?: Object): Promise<Object>;
|
|
46
|
+
declare namespace _default {
|
|
47
|
+
export { createCoherentNextHandler };
|
|
48
|
+
export { createCoherentAppRouterHandler };
|
|
49
|
+
export { createCoherentServerComponent };
|
|
50
|
+
export { createCoherentClientComponent };
|
|
51
|
+
export { createNextIntegration };
|
|
52
|
+
}
|
|
53
|
+
export default _default;
|
|
54
|
+
//# sourceMappingURL=coherent-nextjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coherent-nextjs.d.ts","sourceRoot":"","sources":["../../../../src/nextjs/coherent-nextjs.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,gFAJG;IAAyB,2BAA2B,EAA5C,OAAO;IACS,QAAQ,EAAxB,MAAM;CACd,YAyCF;AAED;;;;;;GAMG;AACH,qFAHW,MAAM,YAuDhB;AAED;;;;;;GAMG;AACH,oFAHW,MAAM,YAgDhB;AAED;;;;;;GAMG;AACH,oFAHW,MAAM,YA0DhB;AAED;;;;;;GAMG;AACH,gDAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAqB3B"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js integration for Coherent.js
|
|
3
|
+
* Provides utilities for using Coherent.js with Next.js
|
|
4
|
+
*/
|
|
5
|
+
import { renderToString } from '../rendering/html-renderer.js';
|
|
6
|
+
import { performanceMonitor } from '../performance/monitor.js';
|
|
7
|
+
import { importPeerDependency } from '../utils/dependency-utils.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create a Next.js API route handler for Coherent.js components
|
|
10
|
+
*
|
|
11
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
12
|
+
* @param {Object} options - Handler options
|
|
13
|
+
* @param {boolean} options.enablePerformanceMonitoring - Enable performance monitoring
|
|
14
|
+
* @param {string} options.template - HTML template with {{content}} placeholder
|
|
15
|
+
* @returns {Function} Next.js API route handler
|
|
16
|
+
*/
|
|
17
|
+
export function createCoherentNextHandler(componentFactory, options = {}) {
|
|
18
|
+
const { enablePerformanceMonitoring = false, template = '<!DOCTYPE html>\n{{content}}' } = options;
|
|
19
|
+
return async (req, res) => {
|
|
20
|
+
try {
|
|
21
|
+
// Create component with request data
|
|
22
|
+
const component = await Promise.resolve(componentFactory(req, res));
|
|
23
|
+
if (!component) {
|
|
24
|
+
res.status(500).json({ error: 'Component factory returned null/undefined' });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Render component
|
|
28
|
+
let html;
|
|
29
|
+
if (enablePerformanceMonitoring) {
|
|
30
|
+
const renderId = performanceMonitor.startRender();
|
|
31
|
+
html = renderToString(component);
|
|
32
|
+
performanceMonitor.endRender(renderId);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
html = renderToString(component);
|
|
36
|
+
}
|
|
37
|
+
// Apply template
|
|
38
|
+
const finalHtml = template.replace('{{content}}', html);
|
|
39
|
+
// Send HTML response
|
|
40
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
41
|
+
res.status(200).send(finalHtml);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Coherent.js Next.js handler error:', error);
|
|
45
|
+
res.status(500).json({ error: error.message });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a Next.js App Router route handler for Coherent.js components
|
|
51
|
+
*
|
|
52
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
53
|
+
* @param {Object} options - Handler options
|
|
54
|
+
* @returns {Function} Next.js App Router route handler
|
|
55
|
+
*/
|
|
56
|
+
export function createCoherentAppRouterHandler(componentFactory, options = {}) {
|
|
57
|
+
const { enablePerformanceMonitoring = false, template = '<!DOCTYPE html>\n{{content}}' } = options;
|
|
58
|
+
return async function handler(request) {
|
|
59
|
+
try {
|
|
60
|
+
// Create component with request data
|
|
61
|
+
const component = await Promise.resolve(componentFactory(request));
|
|
62
|
+
if (!component) {
|
|
63
|
+
return new Response(JSON.stringify({ error: 'Component factory returned null/undefined' }), {
|
|
64
|
+
status: 500,
|
|
65
|
+
headers: { 'Content-Type': 'application/json' }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Render component
|
|
69
|
+
let html;
|
|
70
|
+
if (enablePerformanceMonitoring) {
|
|
71
|
+
const renderId = performanceMonitor.startRender();
|
|
72
|
+
html = renderToString(component);
|
|
73
|
+
performanceMonitor.endRender(renderId);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
html = renderToString(component);
|
|
77
|
+
}
|
|
78
|
+
// Apply template
|
|
79
|
+
const finalHtml = template.replace('{{content}}', html);
|
|
80
|
+
// Send HTML response
|
|
81
|
+
return new Response(finalHtml, {
|
|
82
|
+
status: 200,
|
|
83
|
+
headers: { 'Content-Type': 'text/html; charset=utf-8' }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('Coherent.js Next.js App Router handler error:', error);
|
|
88
|
+
return new Response(JSON.stringify({ error: error.message }), {
|
|
89
|
+
status: 500,
|
|
90
|
+
headers: { 'Content-Type': 'application/json' }
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a Next.js Server Component for Coherent.js
|
|
97
|
+
*
|
|
98
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
99
|
+
* @param {Object} options - Component options
|
|
100
|
+
* @returns {Function} Next.js Server Component
|
|
101
|
+
*/
|
|
102
|
+
export async function createCoherentServerComponent(componentFactory, options = {}) {
|
|
103
|
+
const { enablePerformanceMonitoring = false } = options;
|
|
104
|
+
// Import React using dependency utilities
|
|
105
|
+
let React;
|
|
106
|
+
try {
|
|
107
|
+
React = await importPeerDependency('react', 'React');
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
throw new Error(`Next.js Server Component integration requires React. ${error.message}`);
|
|
111
|
+
}
|
|
112
|
+
return async function CoherentServerComponent(_props) {
|
|
113
|
+
try {
|
|
114
|
+
// Create component with props
|
|
115
|
+
const component = await Promise.resolve(componentFactory(_props));
|
|
116
|
+
if (!component) {
|
|
117
|
+
return React.default.createElement('div', null, 'Error: Component factory returned null/undefined');
|
|
118
|
+
}
|
|
119
|
+
// Render component
|
|
120
|
+
let html;
|
|
121
|
+
if (enablePerformanceMonitoring) {
|
|
122
|
+
const renderId = performanceMonitor.startRender();
|
|
123
|
+
html = renderToString(component);
|
|
124
|
+
performanceMonitor.endRender(renderId);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
html = renderToString(component);
|
|
128
|
+
}
|
|
129
|
+
// Return dangerouslySetInnerHTML to render HTML
|
|
130
|
+
return React.default.createElement('div', {
|
|
131
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error('Coherent.js Next.js Server Component error:', error);
|
|
136
|
+
return React.default.createElement('div', null, `Error: ${error.message}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create a Next.js Client Component for Coherent.js with hydration support
|
|
142
|
+
*
|
|
143
|
+
* @param {Function} componentFactory - Function that returns a Coherent.js component
|
|
144
|
+
* @param {Object} options - Component options
|
|
145
|
+
* @returns {Function} Next.js Client Component
|
|
146
|
+
*/
|
|
147
|
+
export async function createCoherentClientComponent(componentFactory, options = {}) {
|
|
148
|
+
const { enablePerformanceMonitoring = false } = options;
|
|
149
|
+
// Import React using dependency utilities
|
|
150
|
+
let React;
|
|
151
|
+
try {
|
|
152
|
+
React = await importPeerDependency('react', 'React');
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw new Error(`Next.js Client Component integration requires React. ${error.message}`);
|
|
156
|
+
}
|
|
157
|
+
return function CoherentClientComponent(_props) {
|
|
158
|
+
const [html, setHtml] = React.useState('');
|
|
159
|
+
React.useEffect(() => {
|
|
160
|
+
async function renderComponent() {
|
|
161
|
+
try {
|
|
162
|
+
// Create component with props
|
|
163
|
+
const component = await Promise.resolve(componentFactory(_props));
|
|
164
|
+
if (!component) {
|
|
165
|
+
setHtml('Error: Component factory returned null/undefined');
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// Render component
|
|
169
|
+
let renderedHtml;
|
|
170
|
+
if (enablePerformanceMonitoring) {
|
|
171
|
+
const renderId = performanceMonitor.startRender();
|
|
172
|
+
renderedHtml = renderToString(component);
|
|
173
|
+
performanceMonitor.endRender(renderId);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
renderedHtml = renderToString(component);
|
|
177
|
+
}
|
|
178
|
+
setHtml(renderedHtml);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.error('Coherent.js Next.js Client Component error:', error);
|
|
182
|
+
setHtml(`Error: ${error.message}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
renderComponent();
|
|
186
|
+
}, [props]);
|
|
187
|
+
return React.createElement('div', {
|
|
188
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create Next.js integration with dependency checking
|
|
194
|
+
* This function ensures Next.js and React are available before setting up the integration
|
|
195
|
+
*
|
|
196
|
+
* @param {Object} options - Setup options
|
|
197
|
+
* @returns {Promise<Object>} - Object with Next.js integration utilities
|
|
198
|
+
*/
|
|
199
|
+
export async function createNextIntegration(options = {}) {
|
|
200
|
+
try {
|
|
201
|
+
// Verify Next.js and React are available
|
|
202
|
+
await importPeerDependency('next', 'Next.js');
|
|
203
|
+
await importPeerDependency('react', 'React');
|
|
204
|
+
return {
|
|
205
|
+
createCoherentNextHandler: (componentFactory, handlerOptions = {}) => createCoherentNextHandler(componentFactory, { ...options, ...handlerOptions }),
|
|
206
|
+
createCoherentAppRouterHandler: (componentFactory, handlerOptions = {}) => createCoherentAppRouterHandler(componentFactory, { ...options, ...handlerOptions }),
|
|
207
|
+
createCoherentServerComponent: (componentFactory, componentOptions = {}) => createCoherentServerComponent(componentFactory, { ...options, ...componentOptions }),
|
|
208
|
+
createCoherentClientComponent: (componentFactory, componentOptions = {}) => createCoherentClientComponent(componentFactory, { ...options, ...componentOptions })
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Export all utilities
|
|
216
|
+
export default {
|
|
217
|
+
createCoherentNextHandler,
|
|
218
|
+
createCoherentAppRouterHandler,
|
|
219
|
+
createCoherentServerComponent,
|
|
220
|
+
createCoherentClientComponent,
|
|
221
|
+
createNextIntegration
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=coherent-nextjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAO,GAAG,EAAE;IACtD,IAAI,CAAC;QACH,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC9C,MAAM,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE7C,OAAO;YACL,yBAAyB,EAAE,CAAC,gBAAgB,EAAE,cAAc,GAAG,EAAE,EAAE,EAAE,CACnE,yBAAyB,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;YAChF,8BAA8B,EAAE,CAAC,gBAAgB,EAAE,cAAc,GAAG,EAAE,EAAE,EAAE,CACxE,8BAA8B,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;YACrF,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,EAAE,EAAE,EAAE,CACzE,6BAA6B,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;YACtF,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,EAAE,EAAE,EAAE,CACzE,6BAA6B,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;SACvF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,uBAAuB;AACvB,eAAe;IACb,yBAAyB;IACzB,8BAA8B;IAC9B,6BAA6B;IAC7B,6BAA6B;IAC7B,qBAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/nextjs/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js integration for Coherent.js
|
|
3
|
+
*
|
|
4
|
+
* This module provides Next.js integration for Coherent.js.
|
|
5
|
+
* Next.js and React must be installed as peer dependencies to use this integration.
|
|
6
|
+
*
|
|
7
|
+
* Installation:
|
|
8
|
+
* npm install next react
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* import { createNextIntegration } from '@coherent.js/core/nextjs';
|
|
12
|
+
*/
|
|
13
|
+
export { createCoherentNextHandler, createCoherentAppRouterHandler, createCoherentServerComponent, createCoherentClientComponent, createNextIntegration } from './coherent-nextjs.js';
|
|
14
|
+
export { default } from './coherent-nextjs.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nextjs/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coherent.js/nextjs",
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "Next.js integration for Coherent.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"types/",
|
|
17
|
+
"dist/",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20.0.0"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/Tomdrouv1/coherent.js.git"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"next": ">=13.0.0 < 16.0.0",
|
|
31
|
+
"react": ">=18.0.0 < 20.0.0",
|
|
32
|
+
"@coherent.js/core": "1.0.0-beta.2"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "node build.mjs",
|
|
39
|
+
"clean": "rm -rf dist/",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"test:coverage": "vitest run --coverage",
|
|
44
|
+
"test:vitest": "vitest run",
|
|
45
|
+
"test:node": "node --test test/*.test.js"
|
|
46
|
+
}
|
|
47
|
+
}
|