@vercel/build-utils 10.3.1 → 10.3.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.
- package/CHANGELOG.md +8 -0
- package/dist/fs/run-user-scripts.js +15 -1
- package/dist/index.js +17 -1
- package/dist/prerender.d.ts +12 -1
- package/dist/prerender.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 10.3.2
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Add support for expire values in Next.js prerender manifest ([#13087](https://github.com/vercel/vercel/pull/13087))
|
8
|
+
|
9
|
+
- Detect yarn version from lockfile version ([#13118](https://github.com/vercel/vercel/pull/13118))
|
10
|
+
|
3
11
|
## 10.3.1
|
4
12
|
|
5
13
|
### Patch Changes
|
@@ -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) {
|
@@ -838,7 +852,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
|
|
838
852
|
return {
|
839
853
|
path: void 0,
|
840
854
|
detectedLockfile: "yarn.lock",
|
841
|
-
detectedPackageManager:
|
855
|
+
detectedPackageManager: detectYarnVersion(lockfileVersion)
|
842
856
|
};
|
843
857
|
}
|
844
858
|
}
|
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) {
|
@@ -23850,7 +23866,7 @@ function detectPackageManager(cliType, lockfileVersion, projectCreatedAt) {
|
|
23850
23866
|
return {
|
23851
23867
|
path: void 0,
|
23852
23868
|
detectedLockfile: "yarn.lock",
|
23853
|
-
detectedPackageManager:
|
23869
|
+
detectedPackageManager: detectYarnVersion(lockfileVersion)
|
23854
23870
|
};
|
23855
23871
|
}
|
23856
23872
|
}
|
package/dist/prerender.d.ts
CHANGED
@@ -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) {
|