@enonic/nextjs-adapter 3.1.0-B5 → 3.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 +25 -40
- package/guillotine/fetchContent.js +2 -3
- package/guillotine/fetchContent.js.map +1 -1
- package/package.json +14 -14
- package/src/guillotine/fetchContent.ts +0 -2
package/README.md
CHANGED
|
@@ -49,17 +49,23 @@ They are available at `@enonic/nextjs-adapter/server`
|
|
|
49
49
|
Fetches the content/component by path with component queries optimization, page structure as well as runtime info calculation. This is the
|
|
50
50
|
main method for querying content.
|
|
51
51
|
|
|
52
|
-
| Argument
|
|
53
|
-
|
|
54
|
-
| `path` | Path to content |
|
|
52
|
+
| Argument | Description |
|
|
53
|
+
|----------|-------------------|
|
|
55
54
|
| `context` | Execution context |
|
|
56
55
|
|
|
57
56
|
Usage:
|
|
58
57
|
|
|
59
58
|
```tsx
|
|
60
59
|
import {fetchContent} from '@enonic/nextjs-adapter/server';
|
|
60
|
+
import {headers} from 'next/headers';
|
|
61
61
|
|
|
62
|
-
const
|
|
62
|
+
const context = {
|
|
63
|
+
contentPath: '/current/content/path',
|
|
64
|
+
locale: 'en',
|
|
65
|
+
headers: headers(),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const response = fetchContent(context);
|
|
63
69
|
```
|
|
64
70
|
|
|
65
71
|
Response type:
|
|
@@ -193,7 +199,7 @@ Loads all content paths for all locales. Generally used for static site generati
|
|
|
193
199
|
|
|
194
200
|
| Argument | Description |
|
|
195
201
|
|----------|---------------------------------------------------|
|
|
196
|
-
| `
|
|
202
|
+
| `path` | Root content path |
|
|
197
203
|
| `query` | Request and Next.js config options _(Optional)_ * |
|
|
198
204
|
| `count` | Max result count _(Optional, defaults to 999)_ |
|
|
199
205
|
|
|
@@ -212,7 +218,7 @@ Usage:
|
|
|
212
218
|
```tsx
|
|
213
219
|
import {fetchContentPathsForAllLocales} from '@enonic/nextjs-adapter/server';
|
|
214
220
|
|
|
215
|
-
const contentPaths = fetchContentPathsForLocale('/', 'custom graphql query', 1001);
|
|
221
|
+
const contentPaths = fetchContentPathsForLocale('/site-name', 'custom graphql query', 1001);
|
|
216
222
|
```
|
|
217
223
|
|
|
218
224
|
<br/>
|
|
@@ -224,7 +230,7 @@ Used by [fetchContentPathsForAllLocales()](#fetch-paths-for-all-locales)
|
|
|
224
230
|
|
|
225
231
|
| Argument | Description |
|
|
226
232
|
|-----------|-----------------------------------------------------------------------------------------------------|
|
|
227
|
-
| `
|
|
233
|
+
| `path` | Root content path |
|
|
228
234
|
| `mapping` | [Mapping](#locale-mapping-type) locale to project |
|
|
229
235
|
| `query` | Request and Next.js config options _(Optional, [default value here](#fetch-paths-for-all-locales))_ |
|
|
230
236
|
| `count` | Max result count _(Optional, defaults to 999)_ |
|
|
@@ -290,8 +296,14 @@ Usage:
|
|
|
290
296
|
import {useLocaleContext} from '@enonic/nextjs-adapter/client';
|
|
291
297
|
|
|
292
298
|
export default function ClientSideComponent() {
|
|
293
|
-
const {locale, localize} = useLocaleContext();
|
|
299
|
+
const {locale, localize, setLocale} = useLocaleContext();
|
|
300
|
+
console.log(`Current locale: ${locale}`);
|
|
301
|
+
|
|
294
302
|
const localizedText = localize('text.key');
|
|
303
|
+
|
|
304
|
+
setLocale('en').then((dict) => {
|
|
305
|
+
console.log(`New locale: ${locale}`);
|
|
306
|
+
});
|
|
295
307
|
// ...
|
|
296
308
|
}
|
|
297
309
|
```
|
|
@@ -329,8 +341,7 @@ const urlRelativeToViewer = getUrl('/some/content/url', meta);
|
|
|
329
341
|
|
|
330
342
|
#### <a id="get-asset"></a>`getAsset(url: string, meta: MetaData) => string`
|
|
331
343
|
|
|
332
|
-
Converts a local asset URL to relative one for current viewer (Next.js/Enonic XP). It doesn't append locales unlike [getUrl()]
|
|
333
|
-
(#get-url).
|
|
344
|
+
Converts a local asset URL to relative one for current viewer (Next.js/Enonic XP). It doesn't append locales unlike the [getUrl()](#get-url).
|
|
334
345
|
|
|
335
346
|
> **INFO:** For your URLs to work both in Enonic XP and Next.js you need to:
|
|
336
347
|
> 1. Use relative URL to local asset
|
|
@@ -380,7 +391,7 @@ const query = `query($path:ID!){
|
|
|
380
391
|
|
|
381
392
|
#### `validateData(props: FetchContentResult) => void`
|
|
382
393
|
|
|
383
|
-
|
|
394
|
+
Utility method to validate data returned by [fetchContent()](#fetch-content) method. Throws an error or notFound() if data is invalid. Also prevents shortcut content types from being rendered in preview/edit modes.
|
|
384
395
|
|
|
385
396
|
| Argument | Description |
|
|
386
397
|
|----------|-----------------------------|
|
|
@@ -638,10 +649,9 @@ const url = UrlProcessor.processSrcSet('<srcset value>', meta);
|
|
|
638
649
|
|
|
639
650
|
#### `static setSiteKey(key: string): void`
|
|
640
651
|
|
|
641
|
-
|
|
642
|
-
have to do it.
|
|
652
|
+
> **DEPRECATED:** It is automatically done by `nextjs-adapter` now and have no effect.
|
|
643
653
|
|
|
644
|
-
|
|
654
|
+
Sets the site key value that is needed for correct absolute URL processing.
|
|
645
655
|
|
|
646
656
|
| Argument | Description |
|
|
647
657
|
|----------|-------------|
|
|
@@ -944,9 +954,6 @@ enum XP_COMPONENT_TYPE { // Enum for XP component types
|
|
|
944
954
|
// Sanitizes text according to graphql naming spec http://spec.graphql.org/October2021/#sec-Names
|
|
945
955
|
const sanitizeGraphqlName = (text: string) => string;
|
|
946
956
|
|
|
947
|
-
// Returns common part of 2 strings
|
|
948
|
-
const commonChars = (s1?: string, s2?: string) => string;
|
|
949
|
-
|
|
950
957
|
// Returns full content api URL with current project and branch appended
|
|
951
958
|
const getContentApiUrl = (context: Context) => string;
|
|
952
959
|
```
|
|
@@ -959,8 +966,7 @@ They are located in `@enonic/nextjs-adapter/views` folder. Each view is a defaul
|
|
|
959
966
|
|
|
960
967
|
#### `<MainView common="common" data="data" page="page" meta="meta">`
|
|
961
968
|
|
|
962
|
-
The main view of the application. It accepts the result of [fetchContent](#fetch-content) method.
|
|
963
|
-
Should be default export from your [next.js route](https://nextjs.org/docs/routing/introduction)
|
|
969
|
+
The main view of the application. It accepts the result of [fetchContent](#fetch-content) method and is intended to be used as a view for your [next.js route](https://nextjs.org/docs/routing/introduction)
|
|
964
970
|
|
|
965
971
|
| Argument | Type | Description |
|
|
966
972
|
|----------|-----------------------------------|-----------------------------|
|
|
@@ -1051,24 +1057,3 @@ import StaticContent from '@enonic/nextjs-adapter/views/StaticContent';
|
|
|
1051
1057
|
|
|
1052
1058
|
<StaticContent condition={true} tag="div"> ...child elements... </StaticContent>
|
|
1053
1059
|
```
|
|
1054
|
-
|
|
1055
|
-
## Known problems
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
In some cases, when using in NextJS application, a build errors related to the JSX may appear, that state the following:
|
|
1059
|
-
|
|
1060
|
-
```
|
|
1061
|
-
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
|
1062
|
-
```
|
|
1063
|
-
|
|
1064
|
-
To prevent these errors, it is necessary to transpile the library using something
|
|
1065
|
-
like [`next-transpile-modules`](https://www.npmjs.com/package/next-transpile-modules).
|
|
1066
|
-
Install it as dev dependency and call it explicitly from you NextJS config:
|
|
1067
|
-
|
|
1068
|
-
`next.config.js`
|
|
1069
|
-
|
|
1070
|
-
```js
|
|
1071
|
-
const withTM = require('next-transpile-modules')(['@enonic/nextjs-adapter']);
|
|
1072
|
-
|
|
1073
|
-
module.exports = withTM({});
|
|
1074
|
-
```
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { draftMode, headers } from 'next/headers';
|
|
11
11
|
import { ComponentRegistry } from '../common/ComponentRegistry';
|
|
12
|
-
import {
|
|
12
|
+
import { PAGE_TEMPLATE_CONTENTTYPE_NAME, PAGE_TEMPLATE_FOLDER, RENDER_MODE, XP_COMPONENT_TYPE, XP_REQUEST_TYPE, } from '../common/constants';
|
|
13
13
|
import { APP_NAME, APP_NAME_DASHED, IS_DEV_MODE } from '../common/env';
|
|
14
14
|
import { getContentApiUrl } from '../utils/getContentApiUrl';
|
|
15
15
|
import { getLocaleMapping } from '../utils/getLocaleMapping';
|
|
@@ -87,8 +87,7 @@ export function fetchContent(context) {
|
|
|
87
87
|
}
|
|
88
88
|
else if (renderMode === RENDER_MODE.NEXT
|
|
89
89
|
&& !IS_DEV_MODE
|
|
90
|
-
&& (type ===
|
|
91
|
-
type === PAGE_TEMPLATE_CONTENTTYPE_NAME ||
|
|
90
|
+
&& (type === PAGE_TEMPLATE_CONTENTTYPE_NAME ||
|
|
92
91
|
type === PAGE_TEMPLATE_FOLDER)) {
|
|
93
92
|
return errorResponse('404', `Content type [${type}] is not accessible in ${renderMode} mode`);
|
|
94
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchContent.js","sourceRoot":"","sources":["../src/guillotine/fetchContent.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"fetchContent.js","sourceRoot":"","sources":["../src/guillotine/fetchContent.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACH,8BAA8B,EAC9B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAA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C,WAAW,EAAE,IAAI;gBACjB,SAAS,EAAE,GAAG;gBACd,aAAa;gBACb,MAAM;gBACN,OAAO,EAAE,IAAI;gBACb,UAAU;gBACV,sBAAsB,EAAE,aAAa;gBACrC,WAAW;aACd,CAAC,CAAC;YAEH,OAAO;gBACH,IAAI,EAAE,WAAW;gBACjB,MAAM;gBACN,IAAI;gBACJ,IAAI;aACP,CAAC;QACN,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAEjB,IAAI,KAAK,CAAC;YACV,IAAI,CAAC;gBACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;YAAC,OAAO,EAAE,EAAE,CAAC;gBACV,KAAK,GAAG;oBACJ,IAAI,EAAE,OAAO;oBACb,OAAO,EAAE,CAAC,CAAC,OAAO;iBACrB,CAAC;YACN,CAAC;YACD,MAAM,aAAa,GAAG,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;YACvI,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/nextjs-adapter",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Pavel Milkevich <pmi@enonic.com>",
|
|
@@ -50,43 +50,43 @@
|
|
|
50
50
|
"test": "jest --no-cache --coverage"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@enonic/react-components": "^5.0.0
|
|
54
|
-
"@formatjs/intl-localematcher": "^0.5.
|
|
53
|
+
"@enonic/react-components": "^5.0.0",
|
|
54
|
+
"@formatjs/intl-localematcher": "^0.5.6",
|
|
55
55
|
"gqlmin": "^0.2.2",
|
|
56
56
|
"html-react-parser": "^5.1.18",
|
|
57
|
-
"negotiator": "^0.
|
|
58
|
-
"next": "^14.2.
|
|
57
|
+
"negotiator": "^1.0.0",
|
|
58
|
+
"next": "^14.2.15",
|
|
59
59
|
"react": "18.3.1",
|
|
60
60
|
"react-dom": "18.3.1",
|
|
61
61
|
"unescape": "^1.0.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.
|
|
65
|
-
"@babel/preset-env": "^7.
|
|
64
|
+
"@babel/core": "^7.26.0",
|
|
65
|
+
"@babel/preset-env": "^7.26.0",
|
|
66
66
|
"@edge-runtime/jest-environment": "^3.0.3",
|
|
67
67
|
"@enonic-types/core": "^7.14.4",
|
|
68
68
|
"@enonic/eslint-config": "^1.2.1",
|
|
69
|
-
"@testing-library/jest-dom": "^6.
|
|
69
|
+
"@testing-library/jest-dom": "^6.6.2",
|
|
70
70
|
"@testing-library/react": "^16.0.1",
|
|
71
71
|
"@types/negotiator": "^0.6.3",
|
|
72
|
-
"@types/node": "^22.
|
|
73
|
-
"@types/react": "^18.3.
|
|
74
|
-
"@types/react-dom": "^18.3.
|
|
72
|
+
"@types/node": "^22.8.1",
|
|
73
|
+
"@types/react": "^18.3.12",
|
|
74
|
+
"@types/react-dom": "^18.3.1",
|
|
75
75
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
76
76
|
"@typescript-eslint/parser": "^7.18.0",
|
|
77
77
|
"babel-jest": "^29.7.0",
|
|
78
78
|
"concurrently": "^9.0.1",
|
|
79
79
|
"cpy-cli": "^5.0.0",
|
|
80
|
-
"del-cli": "^
|
|
80
|
+
"del-cli": "^6.0.0",
|
|
81
81
|
"eslint": "^8.57.1",
|
|
82
|
-
"eslint-plugin-react": "^7.37.
|
|
82
|
+
"eslint-plugin-react": "^7.37.2",
|
|
83
83
|
"jest": "^29.7.0",
|
|
84
84
|
"jest-environment-jsdom": "^29.7.0",
|
|
85
85
|
"madge": "^8.0.0",
|
|
86
86
|
"mkdirp": "^3.0.1",
|
|
87
87
|
"ts-jest": "^29.2.5",
|
|
88
88
|
"ts-node": "^10.9.2",
|
|
89
|
-
"typescript": "^5.6.
|
|
89
|
+
"typescript": "^5.6.3"
|
|
90
90
|
},
|
|
91
91
|
"types": "index.d.ts"
|
|
92
92
|
}
|
|
@@ -3,7 +3,6 @@ import type {ComponentDescriptor, Context, FetchContentResult} from '../types';
|
|
|
3
3
|
import {draftMode, headers} from 'next/headers';
|
|
4
4
|
import {ComponentRegistry} from '../common/ComponentRegistry';
|
|
5
5
|
import {
|
|
6
|
-
FRAGMENT_CONTENTTYPE_NAME,
|
|
7
6
|
PAGE_TEMPLATE_CONTENTTYPE_NAME,
|
|
8
7
|
PAGE_TEMPLATE_FOLDER,
|
|
9
8
|
RENDER_MODE,
|
|
@@ -98,7 +97,6 @@ export async function fetchContent(context: Context): Promise<FetchContentResult
|
|
|
98
97
|
renderMode === RENDER_MODE.NEXT
|
|
99
98
|
&& !IS_DEV_MODE
|
|
100
99
|
&& (
|
|
101
|
-
type === FRAGMENT_CONTENTTYPE_NAME ||
|
|
102
100
|
type === PAGE_TEMPLATE_CONTENTTYPE_NAME ||
|
|
103
101
|
type === PAGE_TEMPLATE_FOLDER
|
|
104
102
|
)) {
|