@vercel/build-utils 2.16.1-canary.4 → 3.0.1
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.
@@ -1,4 +1,9 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
export interface Stat {
|
3
|
+
name: string;
|
4
|
+
path: string;
|
5
|
+
type: 'file' | 'dir';
|
6
|
+
}
|
2
7
|
/**
|
3
8
|
* `DetectorFilesystem` is an abstract class that represents a virtual filesystem
|
4
9
|
* to perform read-only operations on in order to detect which framework is being
|
@@ -28,11 +33,22 @@ export declare abstract class DetectorFilesystem {
|
|
28
33
|
protected abstract _hasPath(name: string): Promise<boolean>;
|
29
34
|
protected abstract _readFile(name: string): Promise<Buffer>;
|
30
35
|
protected abstract _isFile(name: string): Promise<boolean>;
|
36
|
+
protected abstract _readdir(name: string): Promise<Stat[]>;
|
37
|
+
protected abstract _chdir(name: string): DetectorFilesystem;
|
31
38
|
private pathCache;
|
32
39
|
private fileCache;
|
33
40
|
private readFileCache;
|
41
|
+
private readdirCache;
|
34
42
|
constructor();
|
35
43
|
hasPath: (path: string) => Promise<boolean>;
|
36
44
|
isFile: (name: string) => Promise<boolean>;
|
37
45
|
readFile: (name: string) => Promise<Buffer>;
|
46
|
+
/**
|
47
|
+
* Returns a list of Stat objects from the current working directory.
|
48
|
+
*/
|
49
|
+
readdir: (name: string) => Promise<Stat[]>;
|
50
|
+
/**
|
51
|
+
* Changes the current directory to the specified path and returns a new instance of DetectorFilesystem.
|
52
|
+
*/
|
53
|
+
chdir: (name: string) => DetectorFilesystem;
|
38
54
|
}
|
@@ -52,9 +52,27 @@ class DetectorFilesystem {
|
|
52
52
|
}
|
53
53
|
return p;
|
54
54
|
};
|
55
|
+
/**
|
56
|
+
* Returns a list of Stat objects from the current working directory.
|
57
|
+
*/
|
58
|
+
this.readdir = async (name) => {
|
59
|
+
let p = this.readdirCache.get(name);
|
60
|
+
if (!p) {
|
61
|
+
p = this._readdir(name);
|
62
|
+
this.readdirCache.set(name, p);
|
63
|
+
}
|
64
|
+
return p;
|
65
|
+
};
|
66
|
+
/**
|
67
|
+
* Changes the current directory to the specified path and returns a new instance of DetectorFilesystem.
|
68
|
+
*/
|
69
|
+
this.chdir = (name) => {
|
70
|
+
return this._chdir(name);
|
71
|
+
};
|
55
72
|
this.pathCache = new Map();
|
56
73
|
this.fileCache = new Map();
|
57
74
|
this.readFileCache = new Map();
|
75
|
+
this.readdirCache = new Map();
|
58
76
|
}
|
59
77
|
}
|
60
78
|
exports.DetectorFilesystem = DetectorFilesystem;
|
@@ -309,11 +309,9 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
|
|
309
309
|
}
|
310
310
|
}
|
311
311
|
else if (cliType === 'pnpm') {
|
312
|
-
if (typeof lockfileVersion === 'number' &&
|
313
|
-
lockfileVersion === 5.4 &&
|
314
|
-
((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) > 12) {
|
312
|
+
if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
|
315
313
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
316
|
-
newEnv.PATH = `/pnpm7/
|
314
|
+
newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
|
317
315
|
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
318
316
|
}
|
319
317
|
}
|
package/dist/index.js
CHANGED
@@ -34239,9 +34239,27 @@ class DetectorFilesystem {
|
|
34239
34239
|
}
|
34240
34240
|
return p;
|
34241
34241
|
};
|
34242
|
+
/**
|
34243
|
+
* Returns a list of Stat objects from the current working directory.
|
34244
|
+
*/
|
34245
|
+
this.readdir = async (name) => {
|
34246
|
+
let p = this.readdirCache.get(name);
|
34247
|
+
if (!p) {
|
34248
|
+
p = this._readdir(name);
|
34249
|
+
this.readdirCache.set(name, p);
|
34250
|
+
}
|
34251
|
+
return p;
|
34252
|
+
};
|
34253
|
+
/**
|
34254
|
+
* Changes the current directory to the specified path and returns a new instance of DetectorFilesystem.
|
34255
|
+
*/
|
34256
|
+
this.chdir = (name) => {
|
34257
|
+
return this._chdir(name);
|
34258
|
+
};
|
34242
34259
|
this.pathCache = new Map();
|
34243
34260
|
this.fileCache = new Map();
|
34244
34261
|
this.readFileCache = new Map();
|
34262
|
+
this.readdirCache = new Map();
|
34245
34263
|
}
|
34246
34264
|
}
|
34247
34265
|
exports.DetectorFilesystem = DetectorFilesystem;
|
@@ -35236,11 +35254,9 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
|
|
35236
35254
|
}
|
35237
35255
|
}
|
35238
35256
|
else if (cliType === 'pnpm') {
|
35239
|
-
if (typeof lockfileVersion === 'number' &&
|
35240
|
-
lockfileVersion === 5.4 &&
|
35241
|
-
((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) > 12) {
|
35257
|
+
if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
|
35242
35258
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
35243
|
-
newEnv.PATH = `/pnpm7/
|
35259
|
+
newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
|
35244
35260
|
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
35245
35261
|
}
|
35246
35262
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
32
|
"@types/yazl": "2.4.2",
|
33
|
-
"@vercel/frameworks": "0.
|
33
|
+
"@vercel/frameworks": "0.9.0",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.5.1"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "5e66d4b2ccd80a7e6a21d53cf4be3b11f2861513"
|
53
53
|
}
|