@vercel/next 4.1.6 → 4.2.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.
Files changed (2) hide show
  1. package/dist/index.js +34 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11307,7 +11307,8 @@ async function getMiddlewareBundle({
11307
11307
  framework: {
11308
11308
  slug: "nextjs",
11309
11309
  version: nextVersion
11310
- }
11310
+ },
11311
+ environment: edgeFunction.environments
11311
11312
  });
11312
11313
  })(),
11313
11314
  routeMatchers: getRouteMatchers(edgeFunction, routesManifest)
@@ -11408,14 +11409,21 @@ async function getMiddlewareManifest(entryPath, outputDirectory) {
11408
11409
  const manifest = await import_fs_extra3.default.readJSON(
11409
11410
  middlewareManifestPath
11410
11411
  );
11411
- return manifest.version === 1 ? upgradeMiddlewareManifest(manifest) : manifest;
11412
+ if (manifest.version === 1) {
11413
+ return upgradeMiddlewareManifestV1(manifest);
11414
+ }
11415
+ if (manifest.version === 2) {
11416
+ return upgradeMiddlewareManifestV2(manifest);
11417
+ }
11418
+ return manifest;
11412
11419
  }
11413
- function upgradeMiddlewareManifest(v1) {
11420
+ function upgradeMiddlewareManifestV1(v1) {
11414
11421
  function updateInfo(v1Info) {
11415
11422
  const { regexp, ...rest } = v1Info;
11416
11423
  return {
11417
11424
  ...rest,
11418
- matchers: [{ regexp }]
11425
+ matchers: [{ regexp }],
11426
+ environments: {}
11419
11427
  };
11420
11428
  }
11421
11429
  const middleware = Object.fromEntries(
@@ -11426,7 +11434,28 @@ function upgradeMiddlewareManifest(v1) {
11426
11434
  ) : void 0;
11427
11435
  return {
11428
11436
  ...v1,
11429
- version: 2,
11437
+ version: 3,
11438
+ middleware,
11439
+ functions
11440
+ };
11441
+ }
11442
+ function upgradeMiddlewareManifestV2(v2) {
11443
+ function updateInfo(v2Info) {
11444
+ const { ...rest } = v2Info;
11445
+ return {
11446
+ ...rest,
11447
+ environments: {}
11448
+ };
11449
+ }
11450
+ const middleware = Object.fromEntries(
11451
+ Object.entries(v2.middleware).map(([p, info]) => [p, updateInfo(info)])
11452
+ );
11453
+ const functions = v2.functions ? Object.fromEntries(
11454
+ Object.entries(v2.functions).map(([p, info]) => [p, updateInfo(info)])
11455
+ ) : void 0;
11456
+ return {
11457
+ ...v2,
11458
+ version: 3,
11430
11459
  middleware,
11431
11460
  functions
11432
11461
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.1.6",
3
+ "version": "4.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -30,7 +30,7 @@
30
30
  "@types/semver": "6.0.0",
31
31
  "@types/text-table": "0.2.1",
32
32
  "@types/webpack-sources": "3.2.0",
33
- "@vercel/build-utils": "7.9.1",
33
+ "@vercel/build-utils": "7.11.0",
34
34
  "@vercel/routing-utils": "3.1.0",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",