@vercel/next 4.11.0 → 4.11.2

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 +57 -17
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11963,6 +11963,30 @@ async function getPageLambdaGroups({
11963
11963
  });
11964
11964
  opts = { ...vercelConfigOpts, ...opts };
11965
11965
  }
11966
+ const isGeneratedSteps = routeName.includes("api/generated/steps");
11967
+ const isGeneratedWorkflows = routeName.includes("api/generated/workflows");
11968
+ if (isGeneratedSteps || isGeneratedWorkflows) {
11969
+ const sourceFile = await getSourceFilePathFromPage({
11970
+ workPath: entryPath,
11971
+ page: normalizeSourceFilePageFromManifest(
11972
+ routeName,
11973
+ page,
11974
+ inversedAppPathManifest
11975
+ ),
11976
+ pageExtensions
11977
+ });
11978
+ const config2 = JSON.parse(
11979
+ await import_fs_extra3.default.readFile(
11980
+ import_path2.default.join(entryPath, import_path2.default.dirname(sourceFile), "../config.json"),
11981
+ "utf8"
11982
+ ).catch(() => "{}")
11983
+ );
11984
+ if (isGeneratedSteps && config2.steps) {
11985
+ Object.assign(opts, config2.steps);
11986
+ } else if (isGeneratedWorkflows && config2.workflows) {
11987
+ Object.assign(opts, config2.workflows);
11988
+ }
11989
+ }
11966
11990
  let matchingGroup = experimentalAllowBundling ? void 0 : groups.find((group) => {
11967
11991
  const matches = group.maxDuration === opts.maxDuration && group.memory === opts.memory && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR && JSON.stringify(group.experimentalTriggers) === JSON.stringify(opts.experimentalTriggers);
11968
11992
  if (matches) {
@@ -15212,7 +15236,18 @@ ${JSON.stringify(
15212
15236
  ...nodeMiddleware?.lambdas,
15213
15237
  ...isNextDataServerResolving ? {
15214
15238
  __next_data_catchall: nextDataCatchallOutput
15215
- } : {}
15239
+ } : {},
15240
+ // When bots crawl a site, they may render the page after awhile (e.g. re-sync),
15241
+ // and the sub-assets may not be available then. In this case, the link to
15242
+ // static assets could be not found, and return a 404 HTML. This behavior can
15243
+ // bait the bots as if they found 404 pages. In Next.js it is handled on the
15244
+ // server to return a plain text "Not Found". However, as we handle the "_next/static/"
15245
+ // routes in Vercel CLI, the Next.js behavior is overwritten. Therefore, create a
15246
+ // ".txt" file with "Not Found" content and rewrite any not found static assets to it.
15247
+ [import_path4.default.posix.join(".", entryDirectory, "_next/static/not-found.txt")]: new import_build_utils2.FileBlob({
15248
+ data: "Not Found",
15249
+ contentType: "text/plain"
15250
+ })
15216
15251
  },
15217
15252
  routes: [
15218
15253
  /*
@@ -15616,14 +15651,17 @@ ${JSON.stringify(
15616
15651
  // We need to make sure to 404 for /_next after handle: miss since
15617
15652
  // handle: miss is called before rewrites and to prevent rewriting /_next
15618
15653
  {
15619
- src: import_path4.default.posix.join(
15654
+ src: import_path4.default.posix.join("/", entryDirectory, "_next/static/.+"),
15655
+ status: 404,
15656
+ check: true,
15657
+ dest: import_path4.default.posix.join(
15620
15658
  "/",
15621
15659
  entryDirectory,
15622
- "_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+"
15660
+ "_next/static/not-found.txt"
15623
15661
  ),
15624
- status: 404,
15625
- check: true,
15626
- dest: "$0"
15662
+ headers: {
15663
+ "content-type": "text/plain; charset=utf-8"
15664
+ }
15627
15665
  },
15628
15666
  // remove locale prefixes to check public files and
15629
15667
  // to allow checking non-prefixed lambda outputs
@@ -16580,14 +16618,17 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16580
16618
  // /_next
16581
16619
  { handle: "miss" },
16582
16620
  {
16583
- src: import_path5.default.posix.join(
16621
+ src: import_path5.default.posix.join("/", entryDirectory, "_next/static/.+"),
16622
+ status: 404,
16623
+ check: true,
16624
+ dest: import_path5.default.posix.join(
16584
16625
  "/",
16585
16626
  entryDirectory,
16586
- "_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+"
16627
+ "_next/static/not-found.txt"
16587
16628
  ),
16588
- status: 404,
16589
- check: true,
16590
- dest: "$0"
16629
+ headers: {
16630
+ "content-type": "text/plain; charset=utf-8"
16631
+ }
16591
16632
  },
16592
16633
  // Dynamic routes
16593
16634
  // TODO: do we want to do this?: ...dynamicRoutes,
@@ -17828,14 +17869,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17828
17869
  // handle: miss is called before rewrites and to prevent rewriting /_next
17829
17870
  { handle: "miss" },
17830
17871
  {
17831
- src: import_path5.default.join(
17832
- "/",
17833
- entryDirectory,
17834
- "_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+"
17835
- ),
17872
+ src: import_path5.default.join("/", entryDirectory, "_next/static/.+"),
17836
17873
  status: 404,
17837
17874
  check: true,
17838
- dest: "$0"
17875
+ dest: import_path5.default.join("/", entryDirectory, "_next/static/not-found.txt"),
17876
+ headers: {
17877
+ "content-type": "text/plain; charset=utf-8"
17878
+ }
17839
17879
  },
17840
17880
  // remove locale prefixes to check public files
17841
17881
  ...i18n ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.11.0",
3
+ "version": "4.11.2",
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": "11.0.0",
33
+ "@vercel/build-utils": "11.0.1",
34
34
  "@vercel/routing-utils": "5.1.1",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",