@vercel/build-utils 10.3.1 → 10.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 10.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Expose pnpm6 within the detected package manager path for future versions of the build container ([#13132](https://github.com/vercel/vercel/pull/13132))
8
+
9
+ ## 10.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Add support for expire values in Next.js prerender manifest ([#13087](https://github.com/vercel/vercel/pull/13087))
14
+
15
+ - Detect yarn version from lockfile version ([#13118](https://github.com/vercel/vercel/pull/13118))
16
+
3
17
  ## 10.3.1
4
18
 
5
19
  ### Patch Changes
@@ -144,11 +144,6 @@ export declare function detectPackageManager(cliType: CliType, lockfileVersion:
144
144
  detectedLockfile: string;
145
145
  detectedPackageManager: string;
146
146
  pnpmVersionRange: string;
147
- } | {
148
- path: undefined;
149
- detectedLockfile: string;
150
- detectedPackageManager: string;
151
- pnpmVersionRange: string;
152
147
  } | {
153
148
  path: string;
154
149
  detectedLockfile: string;
@@ -649,6 +649,20 @@ function detectPnpmVersion(lockfileVersion, projectCreatedAt) {
649
649
  return "not found";
650
650
  }
651
651
  }
652
+ function detectYarnVersion(lockfileVersion) {
653
+ if (lockfileVersion) {
654
+ if ([1].includes(lockfileVersion)) {
655
+ return "yarn@1.x";
656
+ } else if ([4, 5].includes(lockfileVersion)) {
657
+ return "yarn@2.x";
658
+ } else if ([6, 7].includes(lockfileVersion)) {
659
+ return "yarn@3.x";
660
+ } else if ([8].includes(lockfileVersion)) {
661
+ return "yarn@4.x";
662
+ }
663
+ }
664
+ return "unknown yarn";
665
+ }
652
666
  function validLockfileForPackageManager(cliType, lockfileVersion, packageManagerVersion) {
653
667
  const packageManagerMajorVersion = packageManagerVersion.major;
654
668
  switch (cliType) {
@@ -819,8 +833,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
819
833
  };
820
834
  case "pnpm 6":
821
835
  return {
822
- // undefined because pnpm@6 is the current default in the build container
823
- path: void 0,
836
+ path: "/pnpm6/node_modules/.bin",
824
837
  detectedLockfile: "pnpm-lock.yaml",
825
838
  detectedPackageManager: "pnpm@6.x",
826
839
  pnpmVersionRange: "6.x"
@@ -838,7 +851,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
838
851
  return {
839
852
  path: void 0,
840
853
  detectedLockfile: "yarn.lock",
841
- detectedPackageManager: "yarn"
854
+ detectedPackageManager: detectYarnVersion(lockfileVersion)
842
855
  };
843
856
  }
844
857
  }
package/dist/index.js CHANGED
@@ -22604,6 +22604,7 @@ var NodejsLambda = class extends Lambda {
22604
22604
  var Prerender = class {
22605
22605
  constructor({
22606
22606
  expiration,
22607
+ staleExpiration,
22607
22608
  lambda,
22608
22609
  fallback,
22609
22610
  group,
@@ -22620,6 +22621,7 @@ var Prerender = class {
22620
22621
  }) {
22621
22622
  this.type = "Prerender";
22622
22623
  this.expiration = expiration;
22624
+ this.staleExpiration = staleExpiration;
22623
22625
  this.sourcePath = sourcePath;
22624
22626
  this.lambda = lambda;
22625
22627
  if (this.lambda) {
@@ -23661,6 +23663,20 @@ function detectPnpmVersion(lockfileVersion, projectCreatedAt) {
23661
23663
  return "not found";
23662
23664
  }
23663
23665
  }
23666
+ function detectYarnVersion(lockfileVersion) {
23667
+ if (lockfileVersion) {
23668
+ if ([1].includes(lockfileVersion)) {
23669
+ return "yarn@1.x";
23670
+ } else if ([4, 5].includes(lockfileVersion)) {
23671
+ return "yarn@2.x";
23672
+ } else if ([6, 7].includes(lockfileVersion)) {
23673
+ return "yarn@3.x";
23674
+ } else if ([8].includes(lockfileVersion)) {
23675
+ return "yarn@4.x";
23676
+ }
23677
+ }
23678
+ return "unknown yarn";
23679
+ }
23664
23680
  function validLockfileForPackageManager(cliType, lockfileVersion, packageManagerVersion) {
23665
23681
  const packageManagerMajorVersion = packageManagerVersion.major;
23666
23682
  switch (cliType) {
@@ -23831,8 +23847,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
23831
23847
  };
23832
23848
  case "pnpm 6":
23833
23849
  return {
23834
- // undefined because pnpm@6 is the current default in the build container
23835
- path: void 0,
23850
+ path: "/pnpm6/node_modules/.bin",
23836
23851
  detectedLockfile: "pnpm-lock.yaml",
23837
23852
  detectedPackageManager: "pnpm@6.x",
23838
23853
  pnpmVersionRange: "6.x"
@@ -23850,7 +23865,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
23850
23865
  return {
23851
23866
  path: void 0,
23852
23867
  detectedLockfile: "yarn.lock",
23853
- detectedPackageManager: "yarn"
23868
+ detectedPackageManager: detectYarnVersion(lockfileVersion)
23854
23869
  };
23855
23870
  }
23856
23871
  }
@@ -2,6 +2,7 @@ import type { File, HasField, Chain } from './types';
2
2
  import { Lambda } from './lambda';
3
3
  interface PrerenderOptions {
4
4
  expiration: number | false;
5
+ staleExpiration?: number;
5
6
  lambda?: Lambda;
6
7
  fallback: File | null;
7
8
  group?: number;
@@ -18,7 +19,17 @@ interface PrerenderOptions {
18
19
  }
19
20
  export declare class Prerender {
20
21
  type: 'Prerender';
22
+ /**
23
+ * `expiration` is `revalidate` in Next.js terms, and `s-maxage` in
24
+ * `cache-control` terms.
25
+ */
21
26
  expiration: number | false;
27
+ /**
28
+ * `staleExpiration` is `expire` in Next.js terms, and
29
+ * `stale-while-revalidate` + `s-maxage` in `cache-control` terms. It's
30
+ * expected to be undefined if `expiration` is `false`.
31
+ */
32
+ staleExpiration?: number;
22
33
  lambda?: Lambda;
23
34
  fallback: File | null;
24
35
  group?: number;
@@ -32,6 +43,6 @@ export declare class Prerender {
32
43
  experimentalBypassFor?: HasField;
33
44
  experimentalStreamingLambdaPath?: string;
34
45
  chain?: Chain;
35
- constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
46
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
36
47
  }
37
48
  export {};
package/dist/prerender.js CHANGED
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(prerender_exports);
24
24
  class Prerender {
25
25
  constructor({
26
26
  expiration,
27
+ staleExpiration,
27
28
  lambda,
28
29
  fallback,
29
30
  group,
@@ -40,6 +41,7 @@ class Prerender {
40
41
  }) {
41
42
  this.type = "Prerender";
42
43
  this.expiration = expiration;
44
+ this.staleExpiration = staleExpiration;
43
45
  this.sourcePath = sourcePath;
44
46
  this.lambda = lambda;
45
47
  if (this.lambda) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "10.3.1",
3
+ "version": "10.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",