@vercel/next 4.8.0 → 4.9.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 +48 -42
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1049,14 +1049,26 @@ var require_superstatic = __commonJS({
1049
1049
  }
1050
1050
  return hasItems;
1051
1051
  };
1052
+ function getStringValueForRegex(value) {
1053
+ if (typeof value === "string") {
1054
+ return value;
1055
+ }
1056
+ if (value && typeof value === "object" && value !== null) {
1057
+ if ("re" in value && typeof value.re === "string") {
1058
+ return value.re;
1059
+ }
1060
+ }
1061
+ return null;
1062
+ }
1052
1063
  function collectHasSegments(has) {
1053
1064
  const hasSegments = /* @__PURE__ */ new Set();
1054
1065
  for (const hasItem of has || []) {
1055
1066
  if (!hasItem.value && "key" in hasItem) {
1056
1067
  hasSegments.add(hasItem.key);
1057
1068
  }
1058
- if (hasItem.value) {
1059
- for (const match of hasItem.value.matchAll(namedGroupsRegex)) {
1069
+ const stringValue = getStringValueForRegex(hasItem.value);
1070
+ if (stringValue) {
1071
+ for (const match of stringValue.matchAll(namedGroupsRegex)) {
1060
1072
  if (match[1]) {
1061
1073
  hasSegments.add(match[1]);
1062
1074
  }
@@ -11440,7 +11452,7 @@ function getFilesMapFromReasons(fileList, reasons, ignoreFn) {
11440
11452
  }
11441
11453
  return parentFilesMap;
11442
11454
  }
11443
- var collectTracedFiles = (baseDir, lstatResults, lstatSema, reasons, files) => async (file) => {
11455
+ var collectTracedFiles = (baseDir, lstatResults, lstatSema, reasons) => async (file) => {
11444
11456
  const reason = reasons.get(file);
11445
11457
  if (reason && reason.type.includes("initial")) {
11446
11458
  return;
@@ -11450,10 +11462,13 @@ var collectTracedFiles = (baseDir, lstatResults, lstatSema, reasons, files) => a
11450
11462
  lstatResults[filePath] = lstatSema.acquire().then(() => (0, import_fs_extra3.lstat)(filePath)).finally(() => lstatSema.release());
11451
11463
  }
11452
11464
  const { mode } = await lstatResults[filePath];
11453
- files[file] = new import_build_utils.FileFsRef({
11454
- fsPath: import_path2.default.join(baseDir, file),
11455
- mode
11456
- });
11465
+ return [
11466
+ file,
11467
+ new import_build_utils.FileFsRef({
11468
+ fsPath: import_path2.default.join(baseDir, file),
11469
+ mode
11470
+ })
11471
+ ];
11457
11472
  };
11458
11473
  var ExperimentalTraceVersion = `9.0.4-canary.1`;
11459
11474
  async function createPseudoLayer(files) {
@@ -12948,11 +12963,12 @@ async function getNodeMiddleware({
12948
12963
  }
12949
12964
  });
12950
12965
  const reasons = /* @__PURE__ */ new Map();
12951
- const tracedFiles = {};
12952
- await Promise.all(
12953
- fileList.map(
12954
- collectTracedFiles(baseDir, lstatResults, lstatSema, reasons, tracedFiles)
12955
- )
12966
+ const tracedFiles = Object.fromEntries(
12967
+ (await Promise.all(
12968
+ fileList.map(
12969
+ collectTracedFiles(baseDir, lstatResults, lstatSema, reasons)
12970
+ )
12971
+ )).filter((entry) => !!entry)
12956
12972
  );
12957
12973
  const launcherData = (await import_fs_extra3.default.readFile(import_path2.default.join(__dirname, "middleware-launcher.js"), "utf8")).replace(
12958
12974
  /(?:var|const) conf = __NEXT_CONFIG__/,
@@ -14126,7 +14142,6 @@ async function serverBuild({
14126
14142
  if (hasLambdas) {
14127
14143
  const initialTracingLabel = "Traced Next.js server files in";
14128
14144
  console.time(initialTracingLabel);
14129
- const initialTracedFiles = {};
14130
14145
  let initialFileList;
14131
14146
  let initialFileReasons;
14132
14147
  let nextServerBuildTrace;
@@ -14213,16 +14228,17 @@ async function serverBuild({
14213
14228
  (0, import_build_utils2.debug)("Using instrumentation.js.nft.json trace from build");
14214
14229
  }
14215
14230
  (0, import_build_utils2.debug)("collecting initial Next.js server files");
14216
- await Promise.all(
14217
- initialFileList.map(
14218
- collectTracedFiles(
14219
- baseDir,
14220
- lstatResults,
14221
- lstatSema,
14222
- initialFileReasons,
14223
- initialTracedFiles
14231
+ const initialTracedFiles = Object.fromEntries(
14232
+ (await Promise.all(
14233
+ initialFileList.map(
14234
+ collectTracedFiles(
14235
+ baseDir,
14236
+ lstatResults,
14237
+ lstatSema,
14238
+ initialFileReasons
14239
+ )
14224
14240
  )
14225
- )
14241
+ )).filter((entry) => !!entry)
14226
14242
  );
14227
14243
  (0, import_build_utils2.debug)("creating initial pseudo layer");
14228
14244
  const initialPseudoLayer = await createPseudoLayer(initialTracedFiles);
@@ -14442,7 +14458,6 @@ ${JSON.stringify(
14442
14458
  console.timeEnd(traceLabel);
14443
14459
  }
14444
14460
  for (const page of mergedPageKeys) {
14445
- const tracedFiles = {};
14446
14461
  const originalPagePath = getOriginalPagePath(page);
14447
14462
  const pageBuildTrace = getBuildTraceFile(originalPagePath);
14448
14463
  let fileList;
@@ -14495,16 +14510,12 @@ ${JSON.stringify(
14495
14510
  }
14496
14511
  reasons = traceResult?.reasons || /* @__PURE__ */ new Map();
14497
14512
  }
14498
- await Promise.all(
14499
- fileList.map(
14500
- collectTracedFiles(
14501
- baseDir,
14502
- lstatResults,
14503
- lstatSema,
14504
- reasons,
14505
- tracedFiles
14513
+ const tracedFiles = Object.fromEntries(
14514
+ (await Promise.all(
14515
+ fileList.map(
14516
+ collectTracedFiles(baseDir, lstatResults, lstatSema, reasons)
14506
14517
  )
14507
- )
14518
+ )).filter((entry) => !!entry)
14508
14519
  );
14509
14520
  pageTraces[page] = tracedFiles;
14510
14521
  compressedPages[page] = (await createPseudoLayer({
@@ -17000,7 +17011,6 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17000
17011
  result.reasons
17001
17012
  );
17002
17013
  for (const page of mergedPageKeys) {
17003
- const tracedFiles = {};
17004
17014
  const fileList = parentFilesMap.get(
17005
17015
  import_path5.default.relative(baseDir, pages[page].fsPath)
17006
17016
  );
@@ -17010,16 +17020,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17010
17020
  );
17011
17021
  }
17012
17022
  const reasons = result.reasons;
17013
- await Promise.all(
17014
- Array.from(fileList).map(
17015
- collectTracedFiles(
17016
- baseDir,
17017
- lstatResults,
17018
- lstatSema,
17019
- reasons,
17020
- tracedFiles
17023
+ const tracedFiles = Object.fromEntries(
17024
+ (await Promise.all(
17025
+ Array.from(fileList).map(
17026
+ collectTracedFiles(baseDir, lstatResults, lstatSema, reasons)
17021
17027
  )
17022
- )
17028
+ )).filter((entry) => !!entry)
17023
17029
  );
17024
17030
  pageTraces[page] = tracedFiles;
17025
17031
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.8.0",
3
+ "version": "4.9.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,8 +30,8 @@
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": "10.6.0",
34
- "@vercel/routing-utils": "5.0.4",
33
+ "@vercel/build-utils": "10.6.1",
34
+ "@vercel/routing-utils": "5.0.6",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",
37
37
  "bytes": "3.1.2",