@uniformdev/canvas-next-rsc 19.131.1-alpha.2 → 19.131.1-alpha.8

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/config.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/config.ts
@@ -33,7 +23,6 @@ __export(config_exports, {
33
23
  withUniformConfig: () => withUniformConfig
34
24
  });
35
25
  module.exports = __toCommonJS(config_exports);
36
- var import_path = __toESM(require("path"));
37
26
  var { existsSync } = require("fs");
38
27
  var { join } = require("path");
39
28
  var getConfigPath = () => {
@@ -53,7 +42,11 @@ var withUniformConfig = (nextConfig) => ({
53
42
  const uniformConfigPath = getConfigPath();
54
43
  if (uniformConfigPath) {
55
44
  console.log("Using Uniform config from", uniformConfigPath);
56
- config.resolve.alias["uniform.server.config.js"] = import_path.default.resolve(config.context, uniformConfigPath);
45
+ config.module.rules.push({
46
+ test: /uniform\.server\.config\.js$/,
47
+ include: uniformConfigPath,
48
+ use: context.defaultLoaders.babel
49
+ });
57
50
  }
58
51
  }
59
52
  return config;
package/dist/config.mjs CHANGED
@@ -7,7 +7,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // src/config.ts
10
- import path from "path";
11
10
  var { existsSync } = __require("fs");
12
11
  var { join } = __require("path");
13
12
  var getConfigPath = () => {
@@ -27,7 +26,11 @@ var withUniformConfig = (nextConfig) => ({
27
26
  const uniformConfigPath = getConfigPath();
28
27
  if (uniformConfigPath) {
29
28
  console.log("Using Uniform config from", uniformConfigPath);
30
- config.resolve.alias["uniform.server.config.js"] = path.resolve(config.context, uniformConfigPath);
29
+ config.module.rules.push({
30
+ test: /uniform\.server\.config\.js$/,
31
+ include: uniformConfigPath,
32
+ use: context.defaultLoaders.babel
33
+ });
31
34
  }
32
35
  }
33
36
  return config;
package/dist/handler.js CHANGED
@@ -161,25 +161,13 @@ var import_cache = require("next/cache");
161
161
 
162
162
  // src/handler/helpers.ts
163
163
  var import_canvas4 = require("@uniformdev/canvas");
164
+ var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
164
165
  var import_edge_config = require("@vercel/edge-config");
165
166
  var import_svix = require("svix");
166
167
 
167
168
  // src/clients/canvasClient.ts
168
169
  var import_canvas2 = require("@uniformdev/canvas");
169
170
 
170
- // src/config/helpers.ts
171
- var getServerConfig = () => {
172
- let serverConfig;
173
- try {
174
- serverConfig = require("uniform.server.config.js");
175
- } catch (e) {
176
- serverConfig = {
177
- defaultConsent: false
178
- };
179
- }
180
- return serverConfig;
181
- };
182
-
183
171
  // src/env/index.ts
184
172
  var env = {
185
173
  getProjectId: () => {
@@ -459,7 +447,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
459
447
  console.warn("UNIFORM_VERCEL_EDGE_CONFIG_TOKEN is not set, skipping edge redirect upsert");
460
448
  return;
461
449
  }
462
- const config = getServerConfig();
450
+ const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
463
451
  const routeClient = getRouteClient({
464
452
  cache: {
465
453
  type: "no-cache"
@@ -549,6 +537,7 @@ var handleManifestPublished = async (body) => {
549
537
  };
550
538
 
551
539
  // src/handler/messages/handleProjectMapNodeDelete.ts
540
+ var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
552
541
  var import_webhooks5 = require("@uniformdev/webhooks");
553
542
  var handleProjectMapNodeDelete = async (body) => {
554
543
  var _a;
@@ -558,7 +547,7 @@ var handleProjectMapNodeDelete = async (body) => {
558
547
  }
559
548
  const tags = [];
560
549
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
561
- const config = getServerConfig();
550
+ const config = (0, import_canvas_next_rsc_shared2.getServerConfig)();
562
551
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
563
552
  await processEdgeConfigChange({
564
553
  source_url: parsed.data.path
@@ -570,6 +559,7 @@ var handleProjectMapNodeDelete = async (body) => {
570
559
  };
571
560
 
572
561
  // src/handler/messages/handleProjectMapNodeInsert.ts
562
+ var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
573
563
  var import_webhooks6 = require("@uniformdev/webhooks");
574
564
  var handleProjectMapNodeInsert = async (body) => {
575
565
  var _a;
@@ -579,7 +569,7 @@ var handleProjectMapNodeInsert = async (body) => {
579
569
  }
580
570
  const tags = [];
581
571
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
582
- const config = getServerConfig();
572
+ const config = (0, import_canvas_next_rsc_shared3.getServerConfig)();
583
573
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
584
574
  await processEdgeConfigChange({
585
575
  source_url: parsed.data.path
@@ -591,6 +581,7 @@ var handleProjectMapNodeInsert = async (body) => {
591
581
  };
592
582
 
593
583
  // src/handler/messages/handleProjectMapNodeUpdate.ts
584
+ var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
594
585
  var import_webhooks7 = require("@uniformdev/webhooks");
595
586
  var handleProjectMapNodeUpdate = async (body) => {
596
587
  var _a;
@@ -601,7 +592,7 @@ var handleProjectMapNodeUpdate = async (body) => {
601
592
  const tags = [];
602
593
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
603
594
  tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
604
- const config = getServerConfig();
595
+ const config = (0, import_canvas_next_rsc_shared4.getServerConfig)();
605
596
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
606
597
  await processEdgeConfigChange({
607
598
  source_url: parsed.data.path
@@ -613,6 +604,7 @@ var handleProjectMapNodeUpdate = async (body) => {
613
604
  };
614
605
 
615
606
  // src/handler/messages/handleRedirectDelete.ts
607
+ var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
616
608
  var import_webhooks8 = require("@uniformdev/webhooks");
617
609
  var handleRedirectDelete = async (body) => {
618
610
  var _a;
@@ -620,7 +612,7 @@ var handleRedirectDelete = async (body) => {
620
612
  if (!parsed.success) {
621
613
  return void 0;
622
614
  }
623
- const config = getServerConfig();
615
+ const config = (0, import_canvas_next_rsc_shared5.getServerConfig)();
624
616
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
625
617
  await processEdgeConfigChange(parsed.data);
626
618
  }
@@ -628,6 +620,7 @@ var handleRedirectDelete = async (body) => {
628
620
  };
629
621
 
630
622
  // src/handler/messages/handleRedirectInsert.ts
623
+ var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
631
624
  var import_webhooks9 = require("@uniformdev/webhooks");
632
625
  var handleRedirectInsert = async (body) => {
633
626
  var _a;
@@ -635,7 +628,7 @@ var handleRedirectInsert = async (body) => {
635
628
  if (!parsed.success) {
636
629
  return void 0;
637
630
  }
638
- const config = getServerConfig();
631
+ const config = (0, import_canvas_next_rsc_shared6.getServerConfig)();
639
632
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
640
633
  await processEdgeConfigChange(parsed.data);
641
634
  }
@@ -643,6 +636,7 @@ var handleRedirectInsert = async (body) => {
643
636
  };
644
637
 
645
638
  // src/handler/messages/handleRedirectUpdate.ts
639
+ var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
646
640
  var import_webhooks10 = require("@uniformdev/webhooks");
647
641
  var handleRedirectUpdate = async (body) => {
648
642
  var _a;
@@ -650,7 +644,7 @@ var handleRedirectUpdate = async (body) => {
650
644
  if (!parsed.success) {
651
645
  return void 0;
652
646
  }
653
- const config = getServerConfig();
647
+ const config = (0, import_canvas_next_rsc_shared7.getServerConfig)();
654
648
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
655
649
  await processEdgeConfigChange(parsed.data);
656
650
  }
package/dist/handler.mjs CHANGED
@@ -1,11 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
1
  // src/handler/createPreviewGETRouteHandler.ts
10
2
  import {
11
3
  IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
@@ -146,25 +138,13 @@ import { revalidateTag } from "next/cache";
146
138
 
147
139
  // src/handler/helpers.ts
148
140
  import { ApiClientError } from "@uniformdev/canvas";
141
+ import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
149
142
  import { parseConnectionString } from "@vercel/edge-config";
150
143
  import { Webhook } from "svix";
151
144
 
152
145
  // src/clients/canvasClient.ts
153
146
  import { CanvasClient } from "@uniformdev/canvas";
154
147
 
155
- // src/config/helpers.ts
156
- var getServerConfig = () => {
157
- let serverConfig;
158
- try {
159
- serverConfig = __require("uniform.server.config.js");
160
- } catch (e) {
161
- serverConfig = {
162
- defaultConsent: false
163
- };
164
- }
165
- return serverConfig;
166
- };
167
-
168
148
  // src/env/index.ts
169
149
  var env = {
170
150
  getProjectId: () => {
@@ -534,6 +514,7 @@ var handleManifestPublished = async (body) => {
534
514
  };
535
515
 
536
516
  // src/handler/messages/handleProjectMapNodeDelete.ts
517
+ import { getServerConfig as getServerConfig2 } from "@uniformdev/canvas-next-rsc-shared";
537
518
  import { ProjectMapNodeDeleteDefinition } from "@uniformdev/webhooks";
538
519
  var handleProjectMapNodeDelete = async (body) => {
539
520
  var _a;
@@ -543,7 +524,7 @@ var handleProjectMapNodeDelete = async (body) => {
543
524
  }
544
525
  const tags = [];
545
526
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
546
- const config = getServerConfig();
527
+ const config = getServerConfig2();
547
528
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
548
529
  await processEdgeConfigChange({
549
530
  source_url: parsed.data.path
@@ -555,6 +536,7 @@ var handleProjectMapNodeDelete = async (body) => {
555
536
  };
556
537
 
557
538
  // src/handler/messages/handleProjectMapNodeInsert.ts
539
+ import { getServerConfig as getServerConfig3 } from "@uniformdev/canvas-next-rsc-shared";
558
540
  import { ProjectMapNodeInsertDefinition } from "@uniformdev/webhooks";
559
541
  var handleProjectMapNodeInsert = async (body) => {
560
542
  var _a;
@@ -564,7 +546,7 @@ var handleProjectMapNodeInsert = async (body) => {
564
546
  }
565
547
  const tags = [];
566
548
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
567
- const config = getServerConfig();
549
+ const config = getServerConfig3();
568
550
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
569
551
  await processEdgeConfigChange({
570
552
  source_url: parsed.data.path
@@ -576,6 +558,7 @@ var handleProjectMapNodeInsert = async (body) => {
576
558
  };
577
559
 
578
560
  // src/handler/messages/handleProjectMapNodeUpdate.ts
561
+ import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
579
562
  import { ProjectMapNodeUpdateDefinition } from "@uniformdev/webhooks";
580
563
  var handleProjectMapNodeUpdate = async (body) => {
581
564
  var _a;
@@ -586,7 +569,7 @@ var handleProjectMapNodeUpdate = async (body) => {
586
569
  const tags = [];
587
570
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
588
571
  tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
589
- const config = getServerConfig();
572
+ const config = getServerConfig4();
590
573
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
591
574
  await processEdgeConfigChange({
592
575
  source_url: parsed.data.path
@@ -598,6 +581,7 @@ var handleProjectMapNodeUpdate = async (body) => {
598
581
  };
599
582
 
600
583
  // src/handler/messages/handleRedirectDelete.ts
584
+ import { getServerConfig as getServerConfig5 } from "@uniformdev/canvas-next-rsc-shared";
601
585
  import { RedirectDeleteDefinition } from "@uniformdev/webhooks";
602
586
  var handleRedirectDelete = async (body) => {
603
587
  var _a;
@@ -605,7 +589,7 @@ var handleRedirectDelete = async (body) => {
605
589
  if (!parsed.success) {
606
590
  return void 0;
607
591
  }
608
- const config = getServerConfig();
592
+ const config = getServerConfig5();
609
593
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
610
594
  await processEdgeConfigChange(parsed.data);
611
595
  }
@@ -613,6 +597,7 @@ var handleRedirectDelete = async (body) => {
613
597
  };
614
598
 
615
599
  // src/handler/messages/handleRedirectInsert.ts
600
+ import { getServerConfig as getServerConfig6 } from "@uniformdev/canvas-next-rsc-shared";
616
601
  import { RedirectInsertDefinition } from "@uniformdev/webhooks";
617
602
  var handleRedirectInsert = async (body) => {
618
603
  var _a;
@@ -620,7 +605,7 @@ var handleRedirectInsert = async (body) => {
620
605
  if (!parsed.success) {
621
606
  return void 0;
622
607
  }
623
- const config = getServerConfig();
608
+ const config = getServerConfig6();
624
609
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
625
610
  await processEdgeConfigChange(parsed.data);
626
611
  }
@@ -628,6 +613,7 @@ var handleRedirectInsert = async (body) => {
628
613
  };
629
614
 
630
615
  // src/handler/messages/handleRedirectUpdate.ts
616
+ import { getServerConfig as getServerConfig7 } from "@uniformdev/canvas-next-rsc-shared";
631
617
  import { RedirectUpdateDefinition } from "@uniformdev/webhooks";
632
618
  var handleRedirectUpdate = async (body) => {
633
619
  var _a;
@@ -635,7 +621,7 @@ var handleRedirectUpdate = async (body) => {
635
621
  if (!parsed.success) {
636
622
  return void 0;
637
623
  }
638
- const config = getServerConfig();
624
+ const config = getServerConfig7();
639
625
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
640
626
  await processEdgeConfigChange(parsed.data);
641
627
  }
package/dist/index.esm.js CHANGED
@@ -1,17 +1,12 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
1
  // src/index.ts
10
2
  import "server-only";
11
3
 
12
4
  // src/clients/canvasClient.ts
13
5
  import { CanvasClient } from "@uniformdev/canvas";
14
6
 
7
+ // src/config/helpers.ts
8
+ import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
9
+
15
10
  // src/utils/draft.ts
16
11
  import { IN_CONTEXT_EDITOR_QUERY_STRING_PARAM } from "@uniformdev/canvas";
17
12
  import { draftMode } from "next/headers";
@@ -42,17 +37,6 @@ var isDevelopmentEnvironment = () => {
42
37
  };
43
38
 
44
39
  // src/config/helpers.ts
45
- var getServerConfig = () => {
46
- let serverConfig;
47
- try {
48
- serverConfig = __require("uniform.server.config.js");
49
- } catch (e) {
50
- serverConfig = {
51
- defaultConsent: false
52
- };
53
- }
54
- return serverConfig;
55
- };
56
40
  var shouldCacheBeDisabled = (options) => {
57
41
  if (isDraftModeEnabled(options)) {
58
42
  return { disabled: true, reason: "DRAFT" };
@@ -415,6 +399,7 @@ import {
415
399
  } from "@uniformdev/canvas";
416
400
  import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
417
401
  import {
402
+ getServerConfig as getServerConfig3,
418
403
  resolvePath as resolvePath2
419
404
  } from "@uniformdev/canvas-next-rsc-shared";
420
405
  import { PureContextualEditingComponentWrapper } from "@uniformdev/canvas-react/core";
@@ -456,7 +441,7 @@ import {
456
441
  CANVAS_EDITOR_STATE,
457
442
  CANVAS_PUBLISHED_STATE
458
443
  } from "@uniformdev/canvas";
459
- import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
444
+ import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
460
445
  import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
461
446
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
462
447
  if (!skipPrefetch) {
@@ -538,7 +523,7 @@ var retrieveRouteByPath = async ({
538
523
  path: queryPath,
539
524
  state,
540
525
  withComponentIDs: true,
541
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
526
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
542
527
  });
543
528
  };
544
529
  var resolveRedirectHref = (resolveResult, path) => {
@@ -730,10 +715,10 @@ var isServerComponent = ({
730
715
  }) => {
731
716
  var _a, _b;
732
717
  if (component.type === CANVAS_PERSONALIZE_TYPE) {
733
- return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
718
+ return serverContext && ((_a = getServerConfig3().evaluation) == null ? void 0 : _a.personalization) !== "client";
734
719
  }
735
720
  if (component.type === CANVAS_TEST_TYPE) {
736
- return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
721
+ return serverContext && ((_b = getServerConfig3().evaluation) == null ? void 0 : _b.testing) !== "client";
737
722
  }
738
723
  };
739
724
  var resolveSystemComponent = ({
@@ -935,6 +920,7 @@ import {
935
920
  DefaultUniformClientContext,
936
921
  UniformScript
937
922
  } from "@uniformdev/canvas-next-rsc-client";
923
+ import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
938
924
  import { Suspense } from "react";
939
925
  import React6 from "react";
940
926
  var UniformContext = async ({
@@ -946,17 +932,8 @@ var UniformContext = async ({
946
932
  searchParams: {}
947
933
  });
948
934
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
949
- const serverConfig = getServerConfig();
950
- const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
951
- const defaultConsent = serverConfig.defaultConsent || false;
952
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(
953
- ContextComponent,
954
- {
955
- manifest,
956
- disableDevTools,
957
- defaultConsent
958
- }
959
- ), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
935
+ const disableDevTools = ((_a = getServerConfig4().context) == null ? void 0 : _a.disableDevTools) || false;
936
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(ContextComponent, { manifest, disableDevTools }), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
960
937
  };
961
938
 
962
939
  // src/components/UniformPlayground.tsx
package/dist/index.js CHANGED
@@ -59,6 +59,9 @@ var import_server_only = require("server-only");
59
59
  // src/clients/canvasClient.ts
60
60
  var import_canvas2 = require("@uniformdev/canvas");
61
61
 
62
+ // src/config/helpers.ts
63
+ var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
64
+
62
65
  // src/utils/draft.ts
63
66
  var import_canvas = require("@uniformdev/canvas");
64
67
  var import_headers = require("next/headers");
@@ -89,17 +92,6 @@ var isDevelopmentEnvironment = () => {
89
92
  };
90
93
 
91
94
  // src/config/helpers.ts
92
- var getServerConfig = () => {
93
- let serverConfig;
94
- try {
95
- serverConfig = require("uniform.server.config.js");
96
- } catch (e) {
97
- serverConfig = {
98
- defaultConsent: false
99
- };
100
- }
101
- return serverConfig;
102
- };
103
95
  var shouldCacheBeDisabled = (options) => {
104
96
  if (isDraftModeEnabled(options)) {
105
97
  return { disabled: true, reason: "DRAFT" };
@@ -117,7 +109,7 @@ var shouldCacheBeDisabled = (options) => {
117
109
  };
118
110
  var getCanvasCacheStrategy = (options) => {
119
111
  const { disabled, reason } = shouldCacheBeDisabled(options);
120
- const config = getServerConfig();
112
+ const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
121
113
  if (disabled) {
122
114
  if (reason === "DEV" && config.canvasCache) {
123
115
  console.warn("Canvas cache (disabled) has been overridden by canvasCache config.");
@@ -136,7 +128,7 @@ var getCanvasCacheStrategy = (options) => {
136
128
  };
137
129
  var getManifestCacheStrategy = (options) => {
138
130
  const { disabled, reason } = shouldCacheBeDisabled(options);
139
- const config = getServerConfig();
131
+ const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
140
132
  if (disabled) {
141
133
  if (reason === "DEV" && config.manifestCache) {
142
134
  console.warn("Manifest cache (disabled) has been overridden by manifestCache config.");
@@ -155,7 +147,7 @@ var getManifestCacheStrategy = (options) => {
155
147
  };
156
148
  var getProjectMapCacheStrategy = (options) => {
157
149
  const { disabled, reason } = shouldCacheBeDisabled(options);
158
- const config = getServerConfig();
150
+ const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
159
151
  if (disabled) {
160
152
  if (reason === "DEV" && config.projectMapCache) {
161
153
  console.warn("Project map cache (disabled) has been overridden by projectMapCache config.");
@@ -453,14 +445,14 @@ async function generateStaticParams() {
453
445
  // src/components/UniformComposition.ts
454
446
  var import_canvas7 = require("@uniformdev/canvas");
455
447
  var import_canvas_next_rsc_client6 = require("@uniformdev/canvas-next-rsc-client");
456
- var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
448
+ var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
457
449
  var import_core = require("@uniformdev/canvas-react/core");
458
450
  var import_headers3 = require("next/headers");
459
451
  var import_navigation = require("next/navigation");
460
452
  var import_react8 = require("react");
461
453
 
462
454
  // src/context/createServerUniformContext.ts
463
- var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
455
+ var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
464
456
  var import_context = require("@uniformdev/context");
465
457
  var import_headers2 = require("next/headers");
466
458
  var createServerUniformContext = async (options) => {
@@ -473,7 +465,7 @@ var createServerUniformContext = async (options) => {
473
465
  };
474
466
  var createServerUniformContextFromManifest = async (options) => {
475
467
  var _a;
476
- const context = (0, import_canvas_next_rsc_shared.createUniformContext)({
468
+ const context = (0, import_canvas_next_rsc_shared2.createUniformContext)({
477
469
  ...options || {},
478
470
  serverCookieValue: (_a = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
479
471
  });
@@ -487,7 +479,7 @@ var createServerUniformContextFromManifest = async (options) => {
487
479
 
488
480
  // src/utils/route.ts
489
481
  var import_canvas4 = require("@uniformdev/canvas");
490
- var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
482
+ var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
491
483
  var import_redirect = require("@uniformdev/redirect");
492
484
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
493
485
  if (!skipPrefetch) {
@@ -495,7 +487,7 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
495
487
  searchParams
496
488
  });
497
489
  }
498
- const { type, value } = (0, import_canvas_next_rsc_shared2.resolvePath)({
490
+ const { type, value } = (0, import_canvas_next_rsc_shared3.resolvePath)({
499
491
  params
500
492
  });
501
493
  const states = determineState({
@@ -553,7 +545,7 @@ var retrieveRouteByPath = async ({
553
545
  });
554
546
  let queryPath = path;
555
547
  if (searchParams && Object.keys(searchParams).length > 0) {
556
- const helper = new URL((0, import_canvas_next_rsc_shared2.getBaseUrl)());
548
+ const helper = new URL((0, import_canvas_next_rsc_shared3.getBaseUrl)());
557
549
  helper.pathname = path;
558
550
  Object.entries(searchParams).forEach(([key, value]) => {
559
551
  if (typeof value === "string") {
@@ -569,11 +561,11 @@ var retrieveRouteByPath = async ({
569
561
  path: queryPath,
570
562
  state,
571
563
  withComponentIDs: true,
572
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
564
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = (0, import_canvas_next_rsc_shared3.getServerConfig)().experimental) == null ? void 0 : _a.vercelVisualEditing)
573
565
  });
574
566
  };
575
567
  var resolveRedirectHref = (resolveResult, path) => {
576
- const requestUrl = `${(0, import_canvas_next_rsc_shared2.getBaseUrl)()}${path}`;
568
+ const requestUrl = `${(0, import_canvas_next_rsc_shared3.getBaseUrl)()}${path}`;
577
569
  const expandedUrl = (0, import_redirect.getTargetVariableExpandedUrl)(requestUrl, resolveResult.redirect);
578
570
  const url = new URL(expandedUrl);
579
571
  return url.pathname;
@@ -603,10 +595,10 @@ var ContextUpdateTrigger = ({ path }) => {
603
595
 
604
596
  // src/components/PersonalizeClientWrapper.tsx
605
597
  var import_canvas_next_rsc_client3 = require("@uniformdev/canvas-next-rsc-client");
606
- var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
598
+ var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
607
599
  var import_react3 = __toESM(require("react"));
608
600
  var PersonalizeClientWrapper = (props) => {
609
- const { indexes } = (0, import_canvas_next_rsc_shared3.runPersonalization)({
601
+ const { indexes } = (0, import_canvas_next_rsc_shared4.runPersonalization)({
610
602
  ...props,
611
603
  contextInstance: void 0
612
604
  });
@@ -615,7 +607,7 @@ var PersonalizeClientWrapper = (props) => {
615
607
 
616
608
  // src/components/PersonalizeServer.ts
617
609
  var import_canvas5 = require("@uniformdev/canvas");
618
- var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
610
+ var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
619
611
  var import_react5 = require("react");
620
612
 
621
613
  // src/components/ContextPersonalizationTransfer.tsx
@@ -628,7 +620,7 @@ var ContextPersonalizationTransfer = ({ event }) => {
628
620
  // src/components/PersonalizeServer.ts
629
621
  var PersonalizeServer = (props) => {
630
622
  var _a;
631
- const { indexes, event } = (0, import_canvas_next_rsc_shared4.runPersonalization)(props);
623
+ const { indexes, event } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
632
624
  const slot = (_a = props.slots) == null ? void 0 : _a[import_canvas5.CANVAS_PERSONALIZE_SLOT];
633
625
  const components = indexes.map((index) => {
634
626
  const component = slot.items[index];
@@ -642,7 +634,7 @@ var PersonalizeServer = (props) => {
642
634
 
643
635
  // src/components/TestServer.ts
644
636
  var import_canvas6 = require("@uniformdev/canvas");
645
- var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
637
+ var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
646
638
  var import_react7 = require("react");
647
639
 
648
640
  // src/components/ContextTestTransfer.tsx
@@ -660,7 +652,7 @@ var TestServer = (props) => {
660
652
  if (!isTestDefined && process.env.NODE_ENV !== "production") {
661
653
  console.warn(`Test "${test}" is not defined in Uniform manifest.`);
662
654
  }
663
- const { index, event } = (0, import_canvas_next_rsc_shared5.runTest)(props);
655
+ const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
664
656
  const component = typeof index === "number" ? (_d = (_c = (_b = props.slots) == null ? void 0 : _b[import_canvas6.CANVAS_TEST_SLOT]) == null ? void 0 : _c.items[index]) != null ? _d : null : null;
665
657
  const eventElement = (0, import_react7.createElement)(ContextTestTransfer, {
666
658
  event
@@ -684,7 +676,7 @@ var UniformComposition = async ({
684
676
  });
685
677
  searchParams = props.searchParams;
686
678
  }
687
- const { value: path } = (0, import_canvas_next_rsc_shared6.resolvePath)(props);
679
+ const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
688
680
  if (!route || route.type === "notFound") {
689
681
  (0, import_navigation.notFound)();
690
682
  }
@@ -759,10 +751,10 @@ var isServerComponent = ({
759
751
  }) => {
760
752
  var _a, _b;
761
753
  if (component.type === import_canvas7.CANVAS_PERSONALIZE_TYPE) {
762
- return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
754
+ return serverContext && ((_a = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _a.personalization) !== "client";
763
755
  }
764
756
  if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
765
- return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
757
+ return serverContext && ((_b = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _b.testing) !== "client";
766
758
  }
767
759
  };
768
760
  var resolveSystemComponent = ({
@@ -961,6 +953,7 @@ var resolveComponents = ({
961
953
 
962
954
  // src/components/UniformContext.tsx
963
955
  var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
956
+ var import_canvas_next_rsc_shared8 = require("@uniformdev/canvas-next-rsc-shared");
964
957
  var import_react9 = require("react");
965
958
  var import_react10 = __toESM(require("react"));
966
959
  var UniformContext = async ({
@@ -972,17 +965,8 @@ var UniformContext = async ({
972
965
  searchParams: {}
973
966
  });
974
967
  const ContextComponent = clientContextComponent || import_canvas_next_rsc_client7.DefaultUniformClientContext;
975
- const serverConfig = getServerConfig();
976
- const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
977
- const defaultConsent = serverConfig.defaultConsent || false;
978
- return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, children, /* @__PURE__ */ import_react10.default.createElement(
979
- ContextComponent,
980
- {
981
- manifest,
982
- disableDevTools,
983
- defaultConsent
984
- }
985
- ), /* @__PURE__ */ import_react10.default.createElement(import_react9.Suspense, { fallback: /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null) }, /* @__PURE__ */ import_react10.default.createElement(import_canvas_next_rsc_client7.UniformScript, null)));
968
+ const disableDevTools = ((_a = (0, import_canvas_next_rsc_shared8.getServerConfig)().context) == null ? void 0 : _a.disableDevTools) || false;
969
+ return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, children, /* @__PURE__ */ import_react10.default.createElement(ContextComponent, { manifest, disableDevTools }), /* @__PURE__ */ import_react10.default.createElement(import_react9.Suspense, { fallback: /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null) }, /* @__PURE__ */ import_react10.default.createElement(import_canvas_next_rsc_client7.UniformScript, null)));
986
970
  };
987
971
 
988
972
  // src/components/UniformPlayground.tsx
package/dist/index.mjs CHANGED
@@ -1,17 +1,12 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
1
  // src/index.ts
10
2
  import "server-only";
11
3
 
12
4
  // src/clients/canvasClient.ts
13
5
  import { CanvasClient } from "@uniformdev/canvas";
14
6
 
7
+ // src/config/helpers.ts
8
+ import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
9
+
15
10
  // src/utils/draft.ts
16
11
  import { IN_CONTEXT_EDITOR_QUERY_STRING_PARAM } from "@uniformdev/canvas";
17
12
  import { draftMode } from "next/headers";
@@ -42,17 +37,6 @@ var isDevelopmentEnvironment = () => {
42
37
  };
43
38
 
44
39
  // src/config/helpers.ts
45
- var getServerConfig = () => {
46
- let serverConfig;
47
- try {
48
- serverConfig = __require("uniform.server.config.js");
49
- } catch (e) {
50
- serverConfig = {
51
- defaultConsent: false
52
- };
53
- }
54
- return serverConfig;
55
- };
56
40
  var shouldCacheBeDisabled = (options) => {
57
41
  if (isDraftModeEnabled(options)) {
58
42
  return { disabled: true, reason: "DRAFT" };
@@ -415,6 +399,7 @@ import {
415
399
  } from "@uniformdev/canvas";
416
400
  import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
417
401
  import {
402
+ getServerConfig as getServerConfig3,
418
403
  resolvePath as resolvePath2
419
404
  } from "@uniformdev/canvas-next-rsc-shared";
420
405
  import { PureContextualEditingComponentWrapper } from "@uniformdev/canvas-react/core";
@@ -456,7 +441,7 @@ import {
456
441
  CANVAS_EDITOR_STATE,
457
442
  CANVAS_PUBLISHED_STATE
458
443
  } from "@uniformdev/canvas";
459
- import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
444
+ import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
460
445
  import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
461
446
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
462
447
  if (!skipPrefetch) {
@@ -538,7 +523,7 @@ var retrieveRouteByPath = async ({
538
523
  path: queryPath,
539
524
  state,
540
525
  withComponentIDs: true,
541
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
526
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
542
527
  });
543
528
  };
544
529
  var resolveRedirectHref = (resolveResult, path) => {
@@ -730,10 +715,10 @@ var isServerComponent = ({
730
715
  }) => {
731
716
  var _a, _b;
732
717
  if (component.type === CANVAS_PERSONALIZE_TYPE) {
733
- return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
718
+ return serverContext && ((_a = getServerConfig3().evaluation) == null ? void 0 : _a.personalization) !== "client";
734
719
  }
735
720
  if (component.type === CANVAS_TEST_TYPE) {
736
- return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
721
+ return serverContext && ((_b = getServerConfig3().evaluation) == null ? void 0 : _b.testing) !== "client";
737
722
  }
738
723
  };
739
724
  var resolveSystemComponent = ({
@@ -935,6 +920,7 @@ import {
935
920
  DefaultUniformClientContext,
936
921
  UniformScript
937
922
  } from "@uniformdev/canvas-next-rsc-client";
923
+ import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
938
924
  import { Suspense } from "react";
939
925
  import React6 from "react";
940
926
  var UniformContext = async ({
@@ -946,17 +932,8 @@ var UniformContext = async ({
946
932
  searchParams: {}
947
933
  });
948
934
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
949
- const serverConfig = getServerConfig();
950
- const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
951
- const defaultConsent = serverConfig.defaultConsent || false;
952
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(
953
- ContextComponent,
954
- {
955
- manifest,
956
- disableDevTools,
957
- defaultConsent
958
- }
959
- ), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
935
+ const disableDevTools = ((_a = getServerConfig4().context) == null ? void 0 : _a.disableDevTools) || false;
936
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(ContextComponent, { manifest, disableDevTools }), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
960
937
  };
961
938
 
962
939
  // src/components/UniformPlayground.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "19.131.1-alpha.2+6efeeccb8b",
3
+ "version": "19.131.1-alpha.8+d326c2787d",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -61,15 +61,15 @@
61
61
  "react-dom": "18.2.0"
62
62
  },
63
63
  "dependencies": {
64
- "@uniformdev/canvas": "19.131.1-alpha.2+6efeeccb8b",
65
- "@uniformdev/canvas-next-rsc-client": "^19.131.1-alpha.2+6efeeccb8b",
66
- "@uniformdev/canvas-next-rsc-shared": "^19.131.1-alpha.2+6efeeccb8b",
67
- "@uniformdev/canvas-react": "19.131.1-alpha.2+6efeeccb8b",
68
- "@uniformdev/context": "19.131.1-alpha.2+6efeeccb8b",
69
- "@uniformdev/project-map": "19.131.1-alpha.2+6efeeccb8b",
70
- "@uniformdev/redirect": "19.131.1-alpha.2+6efeeccb8b",
71
- "@uniformdev/richtext": "19.131.1-alpha.2+6efeeccb8b",
72
- "@uniformdev/webhooks": "19.131.1-alpha.2+6efeeccb8b",
64
+ "@uniformdev/canvas": "19.131.1-alpha.8+d326c2787d",
65
+ "@uniformdev/canvas-next-rsc-client": "^19.131.1-alpha.8+d326c2787d",
66
+ "@uniformdev/canvas-next-rsc-shared": "^19.131.1-alpha.8+d326c2787d",
67
+ "@uniformdev/canvas-react": "19.131.1-alpha.8+d326c2787d",
68
+ "@uniformdev/context": "19.131.1-alpha.8+d326c2787d",
69
+ "@uniformdev/project-map": "19.131.1-alpha.8+d326c2787d",
70
+ "@uniformdev/redirect": "19.131.1-alpha.8+d326c2787d",
71
+ "@uniformdev/richtext": "19.131.1-alpha.8+d326c2787d",
72
+ "@uniformdev/webhooks": "19.131.1-alpha.8+d326c2787d",
73
73
  "@vercel/edge-config": "^0.4.0",
74
74
  "encoding": "^0.1.13",
75
75
  "server-only": "^0.0.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "6efeeccb8b52f103e52aface1e43b3fec577869e"
89
+ "gitHead": "d326c2787d0b159fcd7edb45b165a8eae54862e6"
90
90
  }