@uniformdev/canvas-next-rsc 20.50.2-alpha.109 → 20.50.2-alpha.146

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/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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "20.50.2-alpha.109+846837c66a",
3
+ "version": "20.50.2-alpha.146+88f341e03e",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -60,15 +60,15 @@
60
60
  "react-dom": "19.2.1"
61
61
  },
62
62
  "dependencies": {
63
- "@uniformdev/canvas": "20.50.2-alpha.109+846837c66a",
64
- "@uniformdev/canvas-next-rsc-client": "^20.50.2-alpha.109+846837c66a",
65
- "@uniformdev/canvas-next-rsc-shared": "^20.50.2-alpha.109+846837c66a",
66
- "@uniformdev/canvas-react": "20.50.2-alpha.109+846837c66a",
67
- "@uniformdev/context": "20.50.2-alpha.109+846837c66a",
68
- "@uniformdev/project-map": "20.50.2-alpha.109+846837c66a",
69
- "@uniformdev/redirect": "20.50.2-alpha.109+846837c66a",
70
- "@uniformdev/richtext": "20.50.2-alpha.109+846837c66a",
71
- "@uniformdev/webhooks": "20.50.2-alpha.109+846837c66a",
63
+ "@uniformdev/canvas": "20.50.2-alpha.146+88f341e03e",
64
+ "@uniformdev/canvas-next-rsc-client": "^20.50.2-alpha.146+88f341e03e",
65
+ "@uniformdev/canvas-next-rsc-shared": "^20.50.2-alpha.146+88f341e03e",
66
+ "@uniformdev/canvas-react": "20.50.2-alpha.146+88f341e03e",
67
+ "@uniformdev/context": "20.50.2-alpha.146+88f341e03e",
68
+ "@uniformdev/project-map": "20.50.2-alpha.146+88f341e03e",
69
+ "@uniformdev/redirect": "20.50.2-alpha.146+88f341e03e",
70
+ "@uniformdev/richtext": "20.50.2-alpha.146+88f341e03e",
71
+ "@uniformdev/webhooks": "20.50.2-alpha.146+88f341e03e",
72
72
  "@vercel/edge-config": "^0.4.0",
73
73
  "encoding": "^0.1.13",
74
74
  "server-only": "^0.0.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "846837c66ad0f518683c100615b59b27f91498ba"
88
+ "gitHead": "88f341e03ec871c6af2cd47b9ce257ff4a394816"
89
89
  }