@uniformdev/canvas-next-rsc 19.53.1-alpha.41 → 19.54.2-alpha.3
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/dist/components/evaluateComposition.js +2 -2
- package/dist/components/getUniformContext.js +3 -2
- package/dist/components/retrieveRoute.js +2 -2
- package/dist/config/helpers.d.ts +2 -0
- package/dist/config/helpers.js +15 -1
- package/dist/config.js +14 -25
- package/dist/handler/helpers.js +2 -1
- package/dist/handler/messages/handleProjectMapNodeDelete.js +2 -1
- package/dist/handler/messages/handleProjectMapNodeInsert.js +2 -1
- package/dist/handler/messages/handleProjectMapNodeUpdate.js +2 -1
- package/dist/handler/messages/handleRedirectDelete.js +2 -1
- package/dist/handler/messages/handleRedirectInsert.js +2 -1
- package/dist/handler/messages/handleRedirectUpdate.js +2 -1
- package/package.json +9 -9
- package/dist/config/uniform.server.config.d.ts +0 -3
- package/dist/config/uniform.server.config.js +0 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_TYPE, CANVAS_TEST_TYPE, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, walkComponentTree, } from '@uniformdev/canvas';
|
|
2
2
|
import { UNIFORM_DEFAULT_COOKIE_NAME } from '@uniformdev/context';
|
|
3
|
-
import
|
|
3
|
+
import { getServerConfig } from '../config/helpers';
|
|
4
4
|
import { serializeCookie } from '../score';
|
|
5
5
|
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
6
6
|
import { getBaseUrl } from '../utils/url';
|
|
7
7
|
import { getEnrichmentTags } from './getEnrichmentTags';
|
|
8
8
|
import { getUniformContext } from './getUniformContext';
|
|
9
9
|
import { resolvePath } from './resolvePath';
|
|
10
|
-
export const evaluateComposition = async ({ root, params, searchParams, dynamicInputs, headers, cookies, update, config =
|
|
10
|
+
export const evaluateComposition = async ({ root, params, searchParams, dynamicInputs, headers, cookies, update, config = getServerConfig(), }) => {
|
|
11
11
|
// resolve the path from route params
|
|
12
12
|
const path = resolvePath({
|
|
13
13
|
params,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Context, CookieTransitionDataStore } from '@uniformdev/context';
|
|
2
2
|
import { getManifestFromApi } from '../client/manifestClient';
|
|
3
|
-
import
|
|
3
|
+
import { getServerConfig } from '../config/helpers';
|
|
4
4
|
export const getUniformContext = async ({ searchParams, cookieValue, }) => {
|
|
5
5
|
const manifest = await getManifestFromApi({
|
|
6
6
|
searchParams,
|
|
7
7
|
});
|
|
8
|
+
const config = getServerConfig();
|
|
8
9
|
const context = new Context({
|
|
9
10
|
manifest,
|
|
10
|
-
defaultConsent:
|
|
11
|
+
defaultConsent: config.defaultConsent,
|
|
11
12
|
transitionStore: new CookieTransitionDataStore({
|
|
12
13
|
serverCookieValue: cookieValue,
|
|
13
14
|
}),
|
|
@@ -5,8 +5,7 @@ import { cookies, headers } from 'next/headers';
|
|
|
5
5
|
import { notFound, redirect } from 'next/navigation';
|
|
6
6
|
import { getManifestFromApi } from '../client/manifestClient';
|
|
7
7
|
import { getRouteClient } from '../client/routeClient';
|
|
8
|
-
import { getRouteRevalidateInterval } from '../config/helpers';
|
|
9
|
-
import config from '../config/uniform.server.config';
|
|
8
|
+
import { getRouteRevalidateInterval, getServerConfig } from '../config/helpers';
|
|
10
9
|
import { isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, } from '../utils/draft';
|
|
11
10
|
import { buildPathTag } from '../utils/tag';
|
|
12
11
|
import { getBaseUrl } from '../utils/url';
|
|
@@ -111,6 +110,7 @@ export const resolveRedirectHref = (resolveResult, path) => {
|
|
|
111
110
|
};
|
|
112
111
|
const resolveRouteByEdgeConfig = async (data) => {
|
|
113
112
|
var _a;
|
|
113
|
+
const config = getServerConfig();
|
|
114
114
|
if (!((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeRedirects) || !process.env.EDGE_CONFIG) {
|
|
115
115
|
return undefined;
|
|
116
116
|
}
|
package/dist/config/helpers.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UniformServerConfig } from './models';
|
|
1
2
|
export declare const getCanvasRevalidateInterval: (options: {
|
|
2
3
|
searchParams: {
|
|
3
4
|
[key: string]: string | undefined;
|
|
@@ -13,3 +14,4 @@ export declare const getRouteRevalidateInterval: (options: {
|
|
|
13
14
|
[key: string]: string | undefined;
|
|
14
15
|
} | undefined;
|
|
15
16
|
}) => number | undefined;
|
|
17
|
+
export declare const getServerConfig: () => UniformServerConfig;
|
package/dist/config/helpers.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import { isDraftModeEnabled, isOnVercelPreviewEnvironment } from '../utils/draft';
|
|
2
|
-
import config from './uniform.server.config';
|
|
3
2
|
export const getCanvasRevalidateInterval = (options) => {
|
|
4
3
|
if (isDraftModeEnabled({ searchParams: options.searchParams }) || isOnVercelPreviewEnvironment()) {
|
|
5
4
|
return -1;
|
|
6
5
|
}
|
|
6
|
+
const config = getServerConfig();
|
|
7
7
|
return 'canvasRevalidateInterval' in config ? config.canvasRevalidateInterval : undefined;
|
|
8
8
|
};
|
|
9
9
|
export const getManifestRevalidateInterval = (options) => {
|
|
10
10
|
if (isDraftModeEnabled({ searchParams: options.searchParams }) || isOnVercelPreviewEnvironment()) {
|
|
11
11
|
return -1;
|
|
12
12
|
}
|
|
13
|
+
const config = getServerConfig();
|
|
13
14
|
return 'manifestRevalidateInterval' in config ? config.manifestRevalidateInterval : undefined;
|
|
14
15
|
};
|
|
15
16
|
export const getRouteRevalidateInterval = (options) => {
|
|
16
17
|
if (isDraftModeEnabled({ searchParams: options.searchParams }) || isOnVercelPreviewEnvironment()) {
|
|
17
18
|
return -1;
|
|
18
19
|
}
|
|
20
|
+
const config = getServerConfig();
|
|
19
21
|
return 'routeRevalidateInterval' in config ? config.routeRevalidateInterval : undefined;
|
|
20
22
|
};
|
|
23
|
+
export const getServerConfig = () => {
|
|
24
|
+
let serverConfig;
|
|
25
|
+
try {
|
|
26
|
+
serverConfig = require('uniform.server.config.js');
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
serverConfig = {
|
|
30
|
+
defaultConsent: false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return serverConfig;
|
|
34
|
+
};
|
package/dist/config.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
const { existsSync
|
|
2
|
-
const { join
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const getConfigPath = (type) => {
|
|
6
|
-
const configFilePath = join(process.cwd(), `uniform.${type}.config.js`);
|
|
1
|
+
const { existsSync } = require('fs');
|
|
2
|
+
const { join } = require('path');
|
|
3
|
+
const getConfigPath = () => {
|
|
4
|
+
const configFilePath = join(process.cwd(), `uniform.server.config.js`);
|
|
7
5
|
if (!existsSync(configFilePath)) {
|
|
8
6
|
return undefined;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
return content;
|
|
8
|
+
return configFilePath;
|
|
12
9
|
};
|
|
13
10
|
module.exports.withUniformConfig = (nextConfig) => ({
|
|
14
11
|
...nextConfig,
|
|
@@ -17,23 +14,15 @@ module.exports.withUniformConfig = (nextConfig) => ({
|
|
|
17
14
|
nextConfig.webpack(config, context);
|
|
18
15
|
}
|
|
19
16
|
if (context.isServer) {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.log(`Writing Uniform config to ${absolute}`);
|
|
31
|
-
writeFileSync(absolute, uniformConfig, 'utf8');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
writeFileSync(join(packagePath, jsFilePath), uniformConfig, 'utf8');
|
|
36
|
-
}
|
|
17
|
+
const uniformConfigPath = getConfigPath();
|
|
18
|
+
if (uniformConfigPath) {
|
|
19
|
+
/* eslint-disable-next-line no-console */
|
|
20
|
+
console.log('Using Uniform config from', uniformConfigPath);
|
|
21
|
+
config.module.rules.push({
|
|
22
|
+
test: /uniform\.server\.config\.js$/,
|
|
23
|
+
include: uniformConfigPath,
|
|
24
|
+
use: context.defaultLoaders.babel, // Use ts-loader for TypeScript files, or babel-loader for JavaScript files
|
|
25
|
+
});
|
|
37
26
|
}
|
|
38
27
|
}
|
|
39
28
|
return config;
|
package/dist/handler/helpers.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parseConnectionString } from '@vercel/edge-config';
|
|
|
2
2
|
import { Webhook } from 'svix';
|
|
3
3
|
import { getProjectMapClient } from '../client/projectMapClient';
|
|
4
4
|
import { getRouteClient } from '../client/routeClient';
|
|
5
|
-
import
|
|
5
|
+
import { getServerConfig } from '../config/helpers';
|
|
6
6
|
import { buildCompositionTag, buildPathTag } from '../utils/tag';
|
|
7
7
|
export const isSvixMessage = async (request) => {
|
|
8
8
|
const requiredHeaders = ['svix-id', 'svix-timestamp', 'svix-signature'];
|
|
@@ -100,6 +100,7 @@ export const processEdgeConfigChange = async ({ source_url }) => {
|
|
|
100
100
|
console.warn('UNIFORM_VERCEL_EDGE_CONFIG_TOKEN is not set, skipping edge redirect upsert');
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
+
const config = getServerConfig();
|
|
103
104
|
const routeClient = getRouteClient({
|
|
104
105
|
revalidate: -1,
|
|
105
106
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectMapNodeDeleteDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { buildProjectMapNodePaths, processEdgeConfigChange } from '../helpers';
|
|
4
4
|
export const handleProjectMapNodeDelete = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -9,6 +9,7 @@ export const handleProjectMapNodeDelete = async (body) => {
|
|
|
9
9
|
}
|
|
10
10
|
const tags = [];
|
|
11
11
|
tags.push(...buildProjectMapNodePaths(parsed.data.path));
|
|
12
|
+
const config = getServerConfig();
|
|
12
13
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeCompositions) {
|
|
13
14
|
await processEdgeConfigChange({
|
|
14
15
|
source_url: parsed.data.path,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectMapNodeInsertDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { buildProjectMapNodePaths, processEdgeConfigChange } from '../helpers';
|
|
4
4
|
export const handleProjectMapNodeInsert = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -9,6 +9,7 @@ export const handleProjectMapNodeInsert = async (body) => {
|
|
|
9
9
|
}
|
|
10
10
|
const tags = [];
|
|
11
11
|
tags.push(...buildProjectMapNodePaths(parsed.data.path));
|
|
12
|
+
const config = getServerConfig();
|
|
12
13
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeCompositions) {
|
|
13
14
|
await processEdgeConfigChange({
|
|
14
15
|
source_url: parsed.data.path,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectMapNodeUpdateDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { buildProjectMapNodePaths, processEdgeConfigChange } from '../helpers';
|
|
4
4
|
export const handleProjectMapNodeUpdate = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -10,6 +10,7 @@ export const handleProjectMapNodeUpdate = async (body) => {
|
|
|
10
10
|
const tags = [];
|
|
11
11
|
tags.push(...buildProjectMapNodePaths(parsed.data.path));
|
|
12
12
|
tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
|
|
13
|
+
const config = getServerConfig();
|
|
13
14
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeCompositions) {
|
|
14
15
|
await processEdgeConfigChange({
|
|
15
16
|
source_url: parsed.data.path,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RedirectDeleteDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { processEdgeConfigChange, processRedirectChange } from '../helpers';
|
|
4
4
|
export const handleRedirectDelete = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -7,6 +7,7 @@ export const handleRedirectDelete = async (body) => {
|
|
|
7
7
|
if (!parsed.success) {
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
|
10
|
+
const config = getServerConfig();
|
|
10
11
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeRedirects) {
|
|
11
12
|
await processEdgeConfigChange(parsed.data);
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RedirectInsertDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { processEdgeConfigChange, processRedirectChange } from '../helpers';
|
|
4
4
|
export const handleRedirectInsert = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -7,6 +7,7 @@ export const handleRedirectInsert = async (body) => {
|
|
|
7
7
|
if (!parsed.success) {
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
|
10
|
+
const config = getServerConfig();
|
|
10
11
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeRedirects) {
|
|
11
12
|
await processEdgeConfigChange(parsed.data);
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RedirectUpdateDefinition } from '@uniformdev/webhooks';
|
|
2
|
-
import
|
|
2
|
+
import { getServerConfig } from '../../config/helpers';
|
|
3
3
|
import { processEdgeConfigChange, processRedirectChange } from '../helpers';
|
|
4
4
|
export const handleRedirectUpdate = async (body) => {
|
|
5
5
|
var _a;
|
|
@@ -7,6 +7,7 @@ export const handleRedirectUpdate = async (body) => {
|
|
|
7
7
|
if (!parsed.success) {
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
|
10
|
+
const config = getServerConfig();
|
|
10
11
|
if ((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.edgeRedirects) {
|
|
11
12
|
await processEdgeConfigChange(parsed.data);
|
|
12
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.54.2-alpha.3+f67adafcc",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"react-dom": "18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@uniformdev/canvas": "19.
|
|
59
|
-
"@uniformdev/canvas-react": "19.
|
|
60
|
-
"@uniformdev/context": "19.
|
|
61
|
-
"@uniformdev/project-map": "19.
|
|
62
|
-
"@uniformdev/redirect": "19.
|
|
63
|
-
"@uniformdev/richtext": "19.
|
|
64
|
-
"@uniformdev/webhooks": "19.
|
|
58
|
+
"@uniformdev/canvas": "19.54.2-alpha.3+f67adafcc",
|
|
59
|
+
"@uniformdev/canvas-react": "19.54.2-alpha.3+f67adafcc",
|
|
60
|
+
"@uniformdev/context": "19.54.2-alpha.3+f67adafcc",
|
|
61
|
+
"@uniformdev/project-map": "19.54.2-alpha.3+f67adafcc",
|
|
62
|
+
"@uniformdev/redirect": "19.54.2-alpha.3+f67adafcc",
|
|
63
|
+
"@uniformdev/richtext": "19.54.2-alpha.3+f67adafcc",
|
|
64
|
+
"@uniformdev/webhooks": "19.54.2-alpha.3+f67adafcc",
|
|
65
65
|
"@vercel/edge-config": "^0.2.0",
|
|
66
66
|
"dequal": "^2.0.3",
|
|
67
67
|
"js-cookie": "^3.0.5",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "f67adafccc67437fbeb610b57f759ca45bd6140c"
|
|
82
82
|
}
|