@enonic/nextjs-adapter 1.0.0-RC1 → 1.0.0
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/ComponentRegistry.js +2 -1
- package/UrlProcessor.js +2 -1
- package/package.json +10 -10
- package/server/ClearableFileCache.d.ts +26 -0
- package/server/cache.d.ts +2 -0
- package/server/index.d.ts +5 -0
package/ComponentRegistry.js
CHANGED
|
@@ -10,7 +10,7 @@ function toSelectorName(type) {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export const CATCH_ALL = '*';
|
|
13
|
-
|
|
13
|
+
class ComponentRegistry {
|
|
14
14
|
static getSelector(name) {
|
|
15
15
|
switch (name) {
|
|
16
16
|
case 'contentType':
|
|
@@ -119,3 +119,4 @@ ComponentRegistry.components = {};
|
|
|
119
119
|
ComponentRegistry.parts = {};
|
|
120
120
|
ComponentRegistry.layouts = {};
|
|
121
121
|
ComponentRegistry.macros = {};
|
|
122
|
+
export { ComponentRegistry };
|
package/UrlProcessor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { commonChars, RENDER_MODE, SITE_KEY } from './utils';
|
|
2
2
|
import { useRouter } from 'next/router';
|
|
3
|
-
|
|
3
|
+
class UrlProcessor {
|
|
4
4
|
static process(url, meta) {
|
|
5
5
|
let result;
|
|
6
6
|
if (!meta || !this.isPageUrl(url) && meta.renderMode === RENDER_MODE.NEXT) {
|
|
@@ -79,5 +79,6 @@ UrlProcessor.IMG_ATMT_REGEXP = /_\/image\/|_\/attachment\//;
|
|
|
79
79
|
UrlProcessor.endSlashPattern = /\/+$/;
|
|
80
80
|
UrlProcessor.startSlashPattern = /^\/+/;
|
|
81
81
|
UrlProcessor.localhostPattern = /localhost/;
|
|
82
|
+
export { UrlProcessor };
|
|
82
83
|
UrlProcessor.setSiteKey(SITE_KEY);
|
|
83
84
|
export const getUrl = UrlProcessor.process.bind(UrlProcessor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/nextjs-adapter",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"lint:fix": "eslint --fix server && eslint --fix src"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"html-react-parser": "^3.0.
|
|
17
|
-
"lru-cache": "^
|
|
18
|
-
"next": "^13.2.
|
|
16
|
+
"html-react-parser": "^3.0.15",
|
|
17
|
+
"lru-cache": "^8.0.4",
|
|
18
|
+
"next": "^13.2.4",
|
|
19
19
|
"react": "^18.2.0",
|
|
20
20
|
"react-dom": "^18.2.0",
|
|
21
21
|
"unescape": "^1.0.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@enonic/eslint-config": "^1.1.0",
|
|
25
|
-
"@types/node": "^18.
|
|
26
|
-
"@types/react": "^18.0.
|
|
25
|
+
"@types/node": "^18.15.10",
|
|
26
|
+
"@types/react": "^18.0.29",
|
|
27
27
|
"@types/react-dom": "^18.0.11",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
29
|
-
"@typescript-eslint/parser": "^5.
|
|
30
|
-
"eslint": "^8.
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
29
|
+
"@typescript-eslint/parser": "^5.56.0",
|
|
30
|
+
"eslint": "^8.36.0",
|
|
31
31
|
"eslint-plugin-react": "^7.32.2",
|
|
32
|
-
"typescript": "^
|
|
32
|
+
"typescript": "^5.0.2"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CacheHandler, CacheHandlerContext, CacheHandlerValue } from 'next/dist/server/lib/incremental-cache';
|
|
2
|
+
import { CacheFs } from 'next/dist/shared/lib/utils';
|
|
3
|
+
type FileSystemCacheContext = Omit<CacheHandlerContext, 'fs' | 'serverDistDir'> & {
|
|
4
|
+
fs: CacheFs;
|
|
5
|
+
serverDistDir: string;
|
|
6
|
+
};
|
|
7
|
+
export default class ClearableFileCache implements CacheHandler {
|
|
8
|
+
private fs;
|
|
9
|
+
private flushToDisk?;
|
|
10
|
+
private serverDistDir;
|
|
11
|
+
private appDir;
|
|
12
|
+
constructor(ctx: FileSystemCacheContext);
|
|
13
|
+
clear(): void;
|
|
14
|
+
delete(path: string): boolean | undefined;
|
|
15
|
+
get(key: string, fetchCache?: boolean): Promise<CacheHandlerValue | null>;
|
|
16
|
+
set(key: string, data: CacheHandlerValue['value']): Promise<void>;
|
|
17
|
+
getFsPath({ pathname, appDir, fetchCache, }: {
|
|
18
|
+
pathname: string;
|
|
19
|
+
appDir?: boolean;
|
|
20
|
+
fetchCache?: boolean;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
filePath: string;
|
|
23
|
+
isAppPath: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NextServer } from 'next/dist/server/next';
|
|
2
|
+
export declare const PURGE_CACHE_URL = "/_/enonic/cache/purge";
|
|
3
|
+
export declare const withEnonicCache: (config: any) => any;
|
|
4
|
+
declare const _default: (next: (options: any) => any) => Promise<NextServer>;
|
|
5
|
+
export default _default;
|