@vercel/build-utils 6.2.0 → 6.2.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/dist/fs/glob.js +13 -2
- package/dist/index.js +21 -3
- package/dist/prerender.d.ts +3 -1
- package/dist/prerender.js +8 -1
- package/package.json +2 -2
package/dist/fs/glob.js
CHANGED
@@ -32,13 +32,24 @@ async function glob(pattern, opts, mountpoint) {
|
|
32
32
|
const dirs = new Set();
|
33
33
|
const dirsWithEntries = new Set();
|
34
34
|
for (const relativePath of files) {
|
35
|
-
const
|
35
|
+
const absPath = path_1.default.join(options.cwd, relativePath);
|
36
|
+
const fsPath = normalize_path_1.normalizePath(absPath);
|
36
37
|
let stat = statCache[fsPath];
|
37
38
|
assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
|
38
39
|
const isSymlink = symlinks[fsPath];
|
40
|
+
// When `follow` mode is enabled, ensure that the entry is not a symlink
|
41
|
+
// that points to outside of `cwd`
|
42
|
+
if (options.follow &&
|
43
|
+
(isSymlink || (await fs_extra_1.lstat(fsPath)).isSymbolicLink())) {
|
44
|
+
const target = await fs_extra_1.readlink(absPath);
|
45
|
+
const absTarget = path_1.default.resolve(path_1.default.dirname(absPath), target);
|
46
|
+
if (path_1.default.relative(options.cwd, absTarget).startsWith(`..${path_1.default.sep}`)) {
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
}
|
39
50
|
if (isSymlink || stat.isFile() || stat.isDirectory()) {
|
40
51
|
if (isSymlink) {
|
41
|
-
stat = await fs_extra_1.lstat(
|
52
|
+
stat = await fs_extra_1.lstat(absPath);
|
42
53
|
}
|
43
54
|
// Some bookkeeping to track which directories already have entries within
|
44
55
|
const dirname = path_1.default.dirname(relativePath);
|
package/dist/index.js
CHANGED
@@ -30744,13 +30744,24 @@ async function glob(pattern, opts, mountpoint) {
|
|
30744
30744
|
const dirs = new Set();
|
30745
30745
|
const dirsWithEntries = new Set();
|
30746
30746
|
for (const relativePath of files) {
|
30747
|
-
const
|
30747
|
+
const absPath = path_1.default.join(options.cwd, relativePath);
|
30748
|
+
const fsPath = normalize_path_1.normalizePath(absPath);
|
30748
30749
|
let stat = statCache[fsPath];
|
30749
30750
|
assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
|
30750
30751
|
const isSymlink = symlinks[fsPath];
|
30752
|
+
// When `follow` mode is enabled, ensure that the entry is not a symlink
|
30753
|
+
// that points to outside of `cwd`
|
30754
|
+
if (options.follow &&
|
30755
|
+
(isSymlink || (await fs_extra_1.lstat(fsPath)).isSymbolicLink())) {
|
30756
|
+
const target = await fs_extra_1.readlink(absPath);
|
30757
|
+
const absTarget = path_1.default.resolve(path_1.default.dirname(absPath), target);
|
30758
|
+
if (path_1.default.relative(options.cwd, absTarget).startsWith(`..${path_1.default.sep}`)) {
|
30759
|
+
continue;
|
30760
|
+
}
|
30761
|
+
}
|
30751
30762
|
if (isSymlink || stat.isFile() || stat.isDirectory()) {
|
30752
30763
|
if (isSymlink) {
|
30753
|
-
stat = await fs_extra_1.lstat(
|
30764
|
+
stat = await fs_extra_1.lstat(absPath);
|
30754
30765
|
}
|
30755
30766
|
// Some bookkeeping to track which directories already have entries within
|
30756
30767
|
const dirname = path_1.default.dirname(relativePath);
|
@@ -31893,7 +31904,7 @@ exports.NodejsLambda = NodejsLambda;
|
|
31893
31904
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
31894
31905
|
exports.Prerender = void 0;
|
31895
31906
|
class Prerender {
|
31896
|
-
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, }) {
|
31907
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, }) {
|
31897
31908
|
this.type = 'Prerender';
|
31898
31909
|
this.expiration = expiration;
|
31899
31910
|
this.lambda = lambda;
|
@@ -31906,6 +31917,13 @@ class Prerender {
|
|
31906
31917
|
throw new Error('The `group` argument for `Prerender` needs to be a natural number.');
|
31907
31918
|
}
|
31908
31919
|
this.group = group;
|
31920
|
+
if (passQuery === true) {
|
31921
|
+
this.passQuery = true;
|
31922
|
+
}
|
31923
|
+
else if (typeof passQuery !== 'boolean' &&
|
31924
|
+
typeof passQuery !== 'undefined') {
|
31925
|
+
throw new Error(`The \`passQuery\` argument for \`Prerender\` must be a boolean.`);
|
31926
|
+
}
|
31909
31927
|
if (bypassToken == null) {
|
31910
31928
|
this.bypassToken = null;
|
31911
31929
|
}
|
package/dist/prerender.d.ts
CHANGED
@@ -9,6 +9,7 @@ interface PrerenderOptions {
|
|
9
9
|
allowQuery?: string[];
|
10
10
|
initialHeaders?: Record<string, string>;
|
11
11
|
initialStatus?: number;
|
12
|
+
passQuery?: boolean;
|
12
13
|
}
|
13
14
|
export declare class Prerender {
|
14
15
|
type: 'Prerender';
|
@@ -20,6 +21,7 @@ export declare class Prerender {
|
|
20
21
|
allowQuery?: string[];
|
21
22
|
initialHeaders?: Record<string, string>;
|
22
23
|
initialStatus?: number;
|
23
|
-
|
24
|
+
passQuery?: boolean;
|
25
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, }: PrerenderOptions);
|
24
26
|
}
|
25
27
|
export {};
|
package/dist/prerender.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Prerender = void 0;
|
4
4
|
class Prerender {
|
5
|
-
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, }) {
|
5
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, }) {
|
6
6
|
this.type = 'Prerender';
|
7
7
|
this.expiration = expiration;
|
8
8
|
this.lambda = lambda;
|
@@ -15,6 +15,13 @@ class Prerender {
|
|
15
15
|
throw new Error('The `group` argument for `Prerender` needs to be a natural number.');
|
16
16
|
}
|
17
17
|
this.group = group;
|
18
|
+
if (passQuery === true) {
|
19
|
+
this.passQuery = true;
|
20
|
+
}
|
21
|
+
else if (typeof passQuery !== 'boolean' &&
|
22
|
+
typeof passQuery !== 'undefined') {
|
23
|
+
throw new Error(`The \`passQuery\` argument for \`Prerender\` must be a boolean.`);
|
24
|
+
}
|
18
25
|
if (bypassToken == null) {
|
19
26
|
this.bypassToken = null;
|
20
27
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "6.2.
|
3
|
+
"version": "6.2.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -51,5 +51,5 @@
|
|
51
51
|
"typescript": "4.3.4",
|
52
52
|
"yazl": "2.5.1"
|
53
53
|
},
|
54
|
-
"gitHead": "
|
54
|
+
"gitHead": "95a4dcfb33d813f1a0ef18d766232d42c876ce69"
|
55
55
|
}
|