vite-plugin-vercel 3.0.2 → 4.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/dist/index.cjs CHANGED
@@ -458,6 +458,10 @@ function getSourceAndDestination(destination) {
458
458
  }
459
459
  return import_path3.default.posix.resolve("/", destination, ":match*");
460
460
  }
461
+ var RE_BRACKETS = /^\[([^/]+)\]$/gm;
462
+ function replaceBrackets(source) {
463
+ return source.split("/").map((segment) => segment.replace(RE_BRACKETS, ":$1")).join("/");
464
+ }
461
465
  async function removeDefaultExport(filepath) {
462
466
  const mod = await (0, import_magicast.loadFile)(filepath);
463
467
  try {
@@ -529,7 +533,7 @@ async function buildEndpoints(resolvedConfig) {
529
533
  );
530
534
  return {
531
535
  rewrites: entries.filter((e) => e.addRoute !== false).map((e) => e.destination.replace(/\.func$/, "")).map((destination) => ({
532
- source: getSourceAndDestination(destination),
536
+ source: replaceBrackets(getSourceAndDestination(destination)),
533
537
  destination: getSourceAndDestination(destination)
534
538
  })),
535
539
  isr: Object.fromEntries(isrEntries),
package/dist/index.js CHANGED
@@ -428,6 +428,10 @@ function getSourceAndDestination(destination) {
428
428
  }
429
429
  return path3.posix.resolve("/", destination, ":match*");
430
430
  }
431
+ var RE_BRACKETS = /^\[([^/]+)\]$/gm;
432
+ function replaceBrackets(source) {
433
+ return source.split("/").map((segment) => segment.replace(RE_BRACKETS, ":$1")).join("/");
434
+ }
431
435
  async function removeDefaultExport(filepath) {
432
436
  const mod = await loadFile(filepath);
433
437
  try {
@@ -499,7 +503,7 @@ async function buildEndpoints(resolvedConfig) {
499
503
  );
500
504
  return {
501
505
  rewrites: entries.filter((e) => e.addRoute !== false).map((e) => e.destination.replace(/\.func$/, "")).map((destination) => ({
502
- source: getSourceAndDestination(destination),
506
+ source: replaceBrackets(getSourceAndDestination(destination)),
503
507
  destination: getSourceAndDestination(destination)
504
508
  })),
505
509
  isr: Object.fromEntries(isrEntries),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vercel",
3
- "version": "3.0.2",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -22,7 +22,7 @@
22
22
  "peerDependencies": {
23
23
  "vike": "*",
24
24
  "vite": "^4.4 || ^5.0.2",
25
- "@vite-plugin-vercel/vike": "3.0.1"
25
+ "@vite-plugin-vercel/vike": "4.0.0"
26
26
  },
27
27
  "peerDependenciesMeta": {
28
28
  "@vite-plugin-vercel/vike": {
@@ -41,7 +41,7 @@
41
41
  "typescript": "^5.3.3",
42
42
  "vike": "^0.4.160",
43
43
  "vite": "^5.0.12",
44
- "@vite-plugin-vercel/vike": "3.0.1"
44
+ "@vite-plugin-vercel/vike": "4.0.0"
45
45
  },
46
46
  "dependencies": {
47
47
  "@brillout/libassert": "^0.5.8",