@uniformdev/canvas-next-rsc 20.49.2 → 20.49.3-alpha.47

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.
@@ -1,5 +1,5 @@
1
- import { ResolvedRouteGetResponse, ComponentInstance } from '@uniformdev/canvas';
2
- import { PageParameters, ComponentProps, CompositionContext, AppDirectoryServerContext } from '@uniformdev/canvas-next-rsc-shared';
1
+ import { ComponentInstance, ResolvedRouteGetResponse } from '@uniformdev/canvas';
2
+ import { ComponentProps, PageParameters, AppDirectoryServerContext, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React, { ComponentType } from 'react';
4
4
 
5
5
  type UniformStaticCompositionProps = {
@@ -1,5 +1,5 @@
1
- import { ResolvedRouteGetResponse, ComponentInstance } from '@uniformdev/canvas';
2
- import { PageParameters, ComponentProps, CompositionContext, AppDirectoryServerContext } from '@uniformdev/canvas-next-rsc-shared';
1
+ import { ComponentInstance, ResolvedRouteGetResponse } from '@uniformdev/canvas';
2
+ import { ComponentProps, PageParameters, AppDirectoryServerContext, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React, { ComponentType } from 'react';
4
4
 
5
5
  type UniformStaticCompositionProps = {
@@ -1,7 +1,7 @@
1
1
  import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
2
2
  export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React, { PropsWithChildren, ReactNode, Key } from 'react';
4
- export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-CfpHU4f0.mjs';
4
+ export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-6i7qTLo3.mjs';
5
5
  import { ComponentInstance } from '@uniformdev/canvas';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
@@ -1,7 +1,7 @@
1
1
  import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
2
2
  export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React, { PropsWithChildren, ReactNode, Key } from 'react';
4
- export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-CfpHU4f0.js';
4
+ export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-6i7qTLo3.js';
5
5
  import { ComponentInstance } from '@uniformdev/canvas';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
package/dist/component.js CHANGED
@@ -165,7 +165,7 @@ var import_richtext = require("@uniformdev/richtext");
165
165
  var import_react5 = __toESM(require("react"));
166
166
  var LinkRichTextNode = ({ children, node }) => {
167
167
  const { link } = node;
168
- return /* @__PURE__ */ import_react5.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
168
+ return /* @__PURE__ */ import_react5.default.createElement("a", { ...(0, import_richtext.linkParamValueToAnchorProps)(link) }, children);
169
169
  };
170
170
 
171
171
  // src/components/nodes/ListItemRichTextNode.tsx
@@ -122,11 +122,11 @@ var LinebreakRichTextNode = () => {
122
122
  };
123
123
 
124
124
  // src/components/nodes/LinkRichTextNode.tsx
125
- import { linkParamValueToHref } from "@uniformdev/richtext";
125
+ import { linkParamValueToAnchorProps } from "@uniformdev/richtext";
126
126
  import React5 from "react";
127
127
  var LinkRichTextNode = ({ children, node }) => {
128
128
  const { link } = node;
129
- return /* @__PURE__ */ React5.createElement("a", { href: linkParamValueToHref(link) }, children);
129
+ return /* @__PURE__ */ React5.createElement("a", { ...linkParamValueToAnchorProps(link) }, children);
130
130
  };
131
131
 
132
132
  // src/components/nodes/ListItemRichTextNode.tsx
package/dist/handler.js CHANGED
@@ -127,8 +127,17 @@ var createPreviewGETRouteHandler = (options) => {
127
127
  };
128
128
  };
129
129
  function validateLocalRedirectUrl(pathToRedirectTo) {
130
- if (pathToRedirectTo == null ? void 0 : pathToRedirectTo.match(/^[a-z]+:\/\//g)) {
131
- throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
130
+ if (!pathToRedirectTo) {
131
+ return;
132
+ }
133
+ let resolved;
134
+ try {
135
+ resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
136
+ } catch (e) {
137
+ throw new Error("Invalid redirect path. Disallowing open redirect.");
138
+ }
139
+ if (resolved.origin !== BASE_URL_EXAMPLE) {
140
+ throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
132
141
  }
133
142
  }
134
143
  var resolveFullPathDefault = ({ slug, path }) => {
@@ -389,6 +398,7 @@ var isSvixMessage = async (request) => {
389
398
  };
390
399
  };
391
400
  var processCompositionChange = async (compositionId) => {
401
+ var _a;
392
402
  const projectMapClient = getProjectMapClient({
393
403
  cache: {
394
404
  type: "no-cache"
@@ -405,12 +415,15 @@ var processCompositionChange = async (compositionId) => {
405
415
  if (composition == null ? void 0 : composition.pattern) {
406
416
  tags.push("route");
407
417
  }
418
+ const config = getServerConfig();
408
419
  if (nodes) {
409
420
  for (let i = 0; i < nodes.length; i++) {
410
421
  const node = nodes[i];
411
- await processEdgeConfigChange({
412
- source_url: node.path
413
- });
422
+ if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
423
+ await processEdgeConfigChange({
424
+ source_url: node.path
425
+ });
426
+ }
414
427
  const result = buildProjectMapNodePaths(node.path);
415
428
  tags.push(...result.tags);
416
429
  if (result.paths) {
package/dist/handler.mjs CHANGED
@@ -94,8 +94,17 @@ var createPreviewGETRouteHandler = (options) => {
94
94
  };
95
95
  };
96
96
  function validateLocalRedirectUrl(pathToRedirectTo) {
97
- if (pathToRedirectTo == null ? void 0 : pathToRedirectTo.match(/^[a-z]+:\/\//g)) {
98
- throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
97
+ if (!pathToRedirectTo) {
98
+ return;
99
+ }
100
+ let resolved;
101
+ try {
102
+ resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
103
+ } catch (e) {
104
+ throw new Error("Invalid redirect path. Disallowing open redirect.");
105
+ }
106
+ if (resolved.origin !== BASE_URL_EXAMPLE) {
107
+ throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
99
108
  }
100
109
  }
101
110
  var resolveFullPathDefault = ({ slug, path }) => {
@@ -356,6 +365,7 @@ var isSvixMessage = async (request) => {
356
365
  };
357
366
  };
358
367
  var processCompositionChange = async (compositionId) => {
368
+ var _a;
359
369
  const projectMapClient = getProjectMapClient({
360
370
  cache: {
361
371
  type: "no-cache"
@@ -372,12 +382,15 @@ var processCompositionChange = async (compositionId) => {
372
382
  if (composition == null ? void 0 : composition.pattern) {
373
383
  tags.push("route");
374
384
  }
385
+ const config = getServerConfig();
375
386
  if (nodes) {
376
387
  for (let i = 0; i < nodes.length; i++) {
377
388
  const node = nodes[i];
378
- await processEdgeConfigChange({
379
- source_url: node.path
380
- });
389
+ if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
390
+ await processEdgeConfigChange({
391
+ source_url: node.path
392
+ });
393
+ }
381
394
  const result = buildProjectMapNodePaths(node.path);
382
395
  tags.push(...result.tags);
383
396
  if (result.paths) {
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
- import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
1
+ import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
2
2
  import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
3
3
  export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
4
4
  import { ManifestClient } from '@uniformdev/context/api';
5
5
  import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
6
6
  import { ContextState, ContextOptions } from '@uniformdev/context';
7
7
  import React, { PropsWithChildren } from 'react';
8
- import { U as UniformCompositionProps } from './UniformComposition-CfpHU4f0.mjs';
9
- export { b as UniformComposition, r as resolveComposition } from './UniformComposition-CfpHU4f0.mjs';
8
+ import { U as UniformCompositionProps } from './UniformComposition-6i7qTLo3.mjs';
9
+ export { b as UniformComposition, r as resolveComposition } from './UniformComposition-6i7qTLo3.mjs';
10
10
  import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
11
11
 
12
12
  type GetCanvasClientOptions = {
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
1
+ import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
2
2
  import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
3
3
  export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
4
4
  import { ManifestClient } from '@uniformdev/context/api';
5
5
  import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
6
6
  import { ContextState, ContextOptions } from '@uniformdev/context';
7
7
  import React, { PropsWithChildren } from 'react';
8
- import { U as UniformCompositionProps } from './UniformComposition-CfpHU4f0.js';
9
- export { b as UniformComposition, r as resolveComposition } from './UniformComposition-CfpHU4f0.js';
8
+ import { U as UniformCompositionProps } from './UniformComposition-6i7qTLo3.js';
9
+ export { b as UniformComposition, r as resolveComposition } from './UniformComposition-6i7qTLo3.js';
10
10
  import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
11
11
 
12
12
  type GetCanvasClientOptions = {
package/dist/index.js CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  ContextUpdateTransfer: () => ContextUpdateTransfer,
34
34
  UniformComposition: () => UniformComposition,
35
35
  UniformContext: () => UniformContext,
@@ -54,7 +54,7 @@ __export(src_exports, {
54
54
  retrieveCompositionBySlug: () => retrieveCompositionBySlug,
55
55
  retrieveRoute: () => retrieveRoute
56
56
  });
57
- module.exports = __toCommonJS(src_exports);
57
+ module.exports = __toCommonJS(index_exports);
58
58
  var import_server_only = require("server-only");
59
59
 
60
60
  // src/clients/canvasClient.ts
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "20.49.2",
3
+ "version": "20.49.3-alpha.47+9aed70a64d",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
7
7
  "dev": "tsup --watch",
8
- "lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
9
- "test": "jest --maxWorkers=1 --passWithNoTests",
10
- "document": "api-extractor run --local"
8
+ "clean": "rimraf dist",
9
+ "test": "vitest run",
10
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
11
+ "apidocs-extract": "api-extractor run --local"
11
12
  },
12
13
  "sideEffects": false,
13
14
  "main": "dist/index.js",
@@ -54,37 +55,37 @@
54
55
  "/dist"
55
56
  ],
56
57
  "devDependencies": {
57
- "@types/node": "24.3.1",
58
- "@types/react": "19.2.2",
59
- "next": "15.2.5",
58
+ "@types/node": "26.0.0",
59
+ "@types/react": "19.2.17",
60
+ "next": "15.5.19",
60
61
  "react": "19.2.1",
61
62
  "react-dom": "19.2.1"
62
63
  },
63
64
  "dependencies": {
64
- "@uniformdev/canvas": "20.49.2",
65
- "@uniformdev/canvas-next-rsc-client": "^20.49.2",
66
- "@uniformdev/canvas-next-rsc-shared": "^20.49.2",
67
- "@uniformdev/canvas-react": "20.49.2",
68
- "@uniformdev/context": "20.49.2",
69
- "@uniformdev/project-map": "20.49.2",
70
- "@uniformdev/redirect": "20.49.2",
71
- "@uniformdev/richtext": "20.49.2",
72
- "@uniformdev/webhooks": "20.49.2",
73
- "@vercel/edge-config": "^0.4.0",
65
+ "@uniformdev/canvas": "20.49.3-alpha.47+9aed70a64d",
66
+ "@uniformdev/canvas-next-rsc-client": "^20.49.3-alpha.47+9aed70a64d",
67
+ "@uniformdev/canvas-next-rsc-shared": "^20.49.3-alpha.47+9aed70a64d",
68
+ "@uniformdev/canvas-react": "20.49.3-alpha.47+9aed70a64d",
69
+ "@uniformdev/context": "20.49.3-alpha.47+9aed70a64d",
70
+ "@uniformdev/project-map": "20.49.3-alpha.47+9aed70a64d",
71
+ "@uniformdev/redirect": "20.49.3-alpha.47+9aed70a64d",
72
+ "@uniformdev/richtext": "20.49.3-alpha.47+9aed70a64d",
73
+ "@uniformdev/webhooks": "20.49.3-alpha.47+9aed70a64d",
74
+ "@vercel/edge-config": "^1.4.3",
74
75
  "encoding": "^0.1.13",
75
76
  "server-only": "^0.0.1",
76
- "svix": "^1.5.0"
77
+ "svix": "^1.96.0"
77
78
  },
78
79
  "engines": {
79
80
  "node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
80
81
  },
81
82
  "peerDependencies": {
82
- "next": ">=15.2.3",
83
+ "next": ">=15.5.15",
83
84
  "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
84
85
  "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0"
85
86
  },
86
87
  "publishConfig": {
87
88
  "access": "public"
88
89
  },
89
- "gitHead": "6236dd13bff34cc8ec526d2e93e344428c1c9541"
90
+ "gitHead": "9aed70a64de0ca177d27ea99dc25f1ad053f87ad"
90
91
  }