@vercel/next 4.0.10 → 4.0.12

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 +62 -42
  2. package/package.json +6 -4
package/dist/index.js CHANGED
@@ -514,6 +514,9 @@ var require_superstatic = __commonJS({
514
514
  if (r.missing) {
515
515
  route.missing = r.missing;
516
516
  }
517
+ if (r.statusCode) {
518
+ route.status = r.statusCode;
519
+ }
517
520
  return route;
518
521
  } catch (e) {
519
522
  throw new Error(`Failed to parse rewrite: ${JSON.stringify(r)}`);
@@ -11332,6 +11335,58 @@ async function getVariantsManifest(entryPath, outputDirectory) {
11332
11335
  );
11333
11336
  return variantsManifest;
11334
11337
  }
11338
+ async function getServerlessPages(params) {
11339
+ const appDir = import_path2.default.join(params.pagesDir, "../app");
11340
+ const [pages, appPaths, middlewareManifest] = await Promise.all([
11341
+ (0, import_build_utils.glob)("**/!(_middleware).js", params.pagesDir),
11342
+ params.appPathRoutesManifest ? Promise.all([
11343
+ (0, import_build_utils.glob)("**/page.js", appDir),
11344
+ (0, import_build_utils.glob)("**/route.js", appDir),
11345
+ (0, import_build_utils.glob)("**/_not-found.js", appDir)
11346
+ ]).then((items) => Object.assign(...items)) : Promise.resolve({}),
11347
+ getMiddlewareManifest(params.entryPath, params.outputDirectory)
11348
+ ]);
11349
+ const normalizedAppPaths = {};
11350
+ if (params.appPathRoutesManifest) {
11351
+ for (const [entry, normalizedEntry] of Object.entries(
11352
+ params.appPathRoutesManifest
11353
+ )) {
11354
+ const normalizedPath = `${import_path2.default.join(
11355
+ ".",
11356
+ normalizedEntry === "/" ? "/index" : normalizedEntry
11357
+ )}.js`;
11358
+ const globPath = `${import_path2.default.posix.join(".", entry)}.js`;
11359
+ if (appPaths[globPath]) {
11360
+ normalizedAppPaths[normalizedPath] = appPaths[globPath];
11361
+ }
11362
+ }
11363
+ }
11364
+ for (const edgeFunctionFile of Object.keys(
11365
+ middlewareManifest?.functions ?? {}
11366
+ )) {
11367
+ let edgePath = middlewareManifest?.functions?.[edgeFunctionFile].name || edgeFunctionFile;
11368
+ edgePath = normalizeEdgeFunctionPath(
11369
+ edgePath,
11370
+ params.appPathRoutesManifest || {}
11371
+ );
11372
+ edgePath = (edgePath || "index") + ".js";
11373
+ delete normalizedAppPaths[edgePath];
11374
+ delete pages[edgePath];
11375
+ }
11376
+ return { pages, appPaths: normalizedAppPaths };
11377
+ }
11378
+ function normalizePrefetches(prefetches) {
11379
+ const updatedPrefetches = {};
11380
+ for (const key in prefetches) {
11381
+ if (key === "index.prefetch.rsc") {
11382
+ const newKey = key.replace(/([^/]+\.prefetch\.rsc)$/, "__$1");
11383
+ updatedPrefetches[newKey] = prefetches[key];
11384
+ } else {
11385
+ updatedPrefetches[key] = prefetches[key];
11386
+ }
11387
+ }
11388
+ return updatedPrefetches;
11389
+ }
11335
11390
 
11336
11391
  // src/create-serverless-config.ts
11337
11392
  function getCustomData(importName, target) {
@@ -11830,6 +11885,7 @@ async function serverBuild({
11830
11885
  appBuildTraces = await (0, import_build_utils2.glob)("**/*.js.nft.json", appDir);
11831
11886
  appRscPrefetches = await (0, import_build_utils2.glob)(`**/*${RSC_PREFETCH_SUFFIX}`, appDir);
11832
11887
  const rscContentTypeHeader = routesManifest?.rsc?.contentTypeHeader || RSC_CONTENT_TYPE;
11888
+ appRscPrefetches = normalizePrefetches(appRscPrefetches);
11833
11889
  for (const value of Object.values(appRscPrefetches)) {
11834
11890
  if (!value.contentType) {
11835
11891
  value.contentType = rscContentTypeHeader;
@@ -12561,7 +12617,10 @@ async function serverBuild({
12561
12617
  if (routesManifest?.i18n) {
12562
12618
  route = normalizeLocalePath(route, routesManifest.i18n.locales).pathname;
12563
12619
  }
12564
- delete lambdas[import_path4.default.posix.join(".", entryDirectory, route === "/" ? "index" : route)];
12620
+ delete lambdas[normalizeIndexOutput(
12621
+ import_path4.default.posix.join("./", entryDirectory, route === "/" ? "/index" : route),
12622
+ true
12623
+ )];
12565
12624
  });
12566
12625
  const middleware = await getMiddlewareBundle({
12567
12626
  config,
@@ -12950,7 +13009,7 @@ async function serverBuild({
12950
13009
  dest: import_path4.default.posix.join(
12951
13010
  "/",
12952
13011
  entryDirectory,
12953
- `/index${RSC_PREFETCH_SUFFIX}`
13012
+ `/__index${RSC_PREFETCH_SUFFIX}`
12954
13013
  ),
12955
13014
  headers: { vary: rscVaryHeader },
12956
13015
  continue: true,
@@ -13037,7 +13096,7 @@ async function serverBuild({
13037
13096
  src: import_path4.default.posix.join(
13038
13097
  "/",
13039
13098
  entryDirectory,
13040
- `/index${RSC_PREFETCH_SUFFIX}`
13099
+ `/__index${RSC_PREFETCH_SUFFIX}`
13041
13100
  ),
13042
13101
  dest: import_path4.default.posix.join("/", entryDirectory, "/index.rsc"),
13043
13102
  has: [
@@ -15266,45 +15325,6 @@ var prepareCache = async ({
15266
15325
  (0, import_build_utils3.debug)("Cache file manifest produced");
15267
15326
  return cache;
15268
15327
  };
15269
- async function getServerlessPages(params) {
15270
- const [pages, appPaths, middlewareManifest] = await Promise.all([
15271
- (0, import_build_utils3.glob)("**/!(_middleware).js", params.pagesDir),
15272
- params.appPathRoutesManifest ? Promise.all([
15273
- (0, import_build_utils3.glob)("**/page.js", import_path5.default.join(params.pagesDir, "../app")),
15274
- (0, import_build_utils3.glob)("**/route.js", import_path5.default.join(params.pagesDir, "../app")),
15275
- (0, import_build_utils3.glob)("**/_not-found.js", import_path5.default.join(params.pagesDir, "../app"))
15276
- ]).then((items) => Object.assign(...items)) : Promise.resolve({}),
15277
- getMiddlewareManifest(params.entryPath, params.outputDirectory)
15278
- ]);
15279
- const normalizedAppPaths = {};
15280
- if (params.appPathRoutesManifest) {
15281
- for (const [entry, normalizedEntry] of Object.entries(
15282
- params.appPathRoutesManifest
15283
- )) {
15284
- const normalizedPath = `${import_path5.default.join(
15285
- ".",
15286
- normalizedEntry === "/" ? "/index" : normalizedEntry
15287
- )}.js`;
15288
- const globPath = `${import_path5.default.join(".", entry)}.js`;
15289
- if (appPaths[globPath]) {
15290
- normalizedAppPaths[normalizedPath] = appPaths[globPath];
15291
- }
15292
- }
15293
- }
15294
- for (const edgeFunctionFile of Object.keys(
15295
- middlewareManifest?.functions ?? {}
15296
- )) {
15297
- let edgePath = middlewareManifest?.functions?.[edgeFunctionFile].name || edgeFunctionFile;
15298
- edgePath = normalizeEdgeFunctionPath(
15299
- edgePath,
15300
- params.appPathRoutesManifest || {}
15301
- );
15302
- edgePath = (edgePath || "index") + ".js";
15303
- delete normalizedAppPaths[edgePath];
15304
- delete pages[edgePath];
15305
- }
15306
- return { pages, appPaths: normalizedAppPaths };
15307
- }
15308
15328
  // Annotate the CommonJS export names for ESM import in node:
15309
15329
  0 && (module.exports = {
15310
15330
  MAX_AGE_ONE_YEAR,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
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": "7.2.2",
34
- "@vercel/routing-utils": "3.0.0",
33
+ "@vercel/build-utils": "7.2.3",
34
+ "@vercel/routing-utils": "3.1.0",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",
37
37
  "bytes": "3.1.2",
@@ -60,7 +60,9 @@
60
60
  "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand --testTimeout=360000",
61
61
  "test-unit": "pnpm test test/unit/",
62
62
  "test-next-local": "pnpm test test/integration/*.test.js test/integration/*.test.ts",
63
+ "test-next-local-legacy": "pnpm test test/integration/legacy/*.test.js",
63
64
  "test-next-local:middleware": "pnpm test test/integration/middleware.test.ts",
64
- "test-e2e": "rm -f test/builder-info.json; pnpm test test/fixtures/**/*.test.js"
65
+ "test-e2e": "rm -f test/builder-info.json; pnpm test test/fixtures/**/*.test.js",
66
+ "type-check": "tsc --noEmit"
65
67
  }
66
68
  }