@vercel/build-utils 2.16.1-canary.3 → 3.0.1-canary.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;
@@ -1,8 +1,8 @@
1
1
  import { NodeVersion } from '../types';
2
2
  export declare function getLatestNodeVersion(): {
3
- readonly major: 14;
4
- readonly range: "14.x";
5
- readonly runtime: "nodejs14.x";
3
+ readonly major: 16;
4
+ readonly range: "16.x";
5
+ readonly runtime: "nodejs16.x";
6
6
  };
7
7
  export declare function getDiscontinuedNodeVersions(): NodeVersion[];
8
8
  export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean): Promise<NodeVersion>;
@@ -8,6 +8,7 @@ const semver_1 = require("semver");
8
8
  const errors_1 = require("../errors");
9
9
  const debug_1 = __importDefault(require("../debug"));
10
10
  const allOptions = [
11
+ { major: 16, range: '16.x', runtime: 'nodejs16.x' },
11
12
  { major: 14, range: '14.x', runtime: 'nodejs14.x' },
12
13
  { major: 12, range: '12.x', runtime: 'nodejs12.x' },
13
14
  {
@@ -136,10 +136,6 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
136
136
  const latest = node_version_1.getLatestNodeVersion();
137
137
  return { ...latest, runtime: 'nodejs' };
138
138
  }
139
- if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
140
- console.warn('Warning: Using experimental Node.js 16.x due to ENABLE_EXPERIMENTAL_NODE16=1');
141
- return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
142
- }
143
139
  const { packageJson } = await scanParentDirs(destPath, true);
144
140
  let { nodeVersion } = config;
145
141
  let isAuto = true;
@@ -313,11 +309,9 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
313
309
  }
314
310
  }
315
311
  else if (cliType === 'pnpm') {
316
- if (typeof lockfileVersion === 'number' &&
317
- lockfileVersion === 5.4 &&
318
- ((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) > 12) {
312
+ if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
319
313
  // Ensure that pnpm 7 is at the beginning of the `$PATH`
320
- newEnv.PATH = `/pnpm7/pnpm:${env.PATH}`;
314
+ newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
321
315
  console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
322
316
  }
323
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;
@@ -34763,6 +34781,7 @@ const semver_1 = __webpack_require__(2879);
34763
34781
  const errors_1 = __webpack_require__(3983);
34764
34782
  const debug_1 = __importDefault(__webpack_require__(1868));
34765
34783
  const allOptions = [
34784
+ { major: 16, range: '16.x', runtime: 'nodejs16.x' },
34766
34785
  { major: 14, range: '14.x', runtime: 'nodejs14.x' },
34767
34786
  { major: 12, range: '12.x', runtime: 'nodejs12.x' },
34768
34787
  {
@@ -35062,10 +35081,6 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
35062
35081
  const latest = node_version_1.getLatestNodeVersion();
35063
35082
  return { ...latest, runtime: 'nodejs' };
35064
35083
  }
35065
- if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
35066
- console.warn('Warning: Using experimental Node.js 16.x due to ENABLE_EXPERIMENTAL_NODE16=1');
35067
- return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
35068
- }
35069
35084
  const { packageJson } = await scanParentDirs(destPath, true);
35070
35085
  let { nodeVersion } = config;
35071
35086
  let isAuto = true;
@@ -35239,11 +35254,9 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
35239
35254
  }
35240
35255
  }
35241
35256
  else if (cliType === 'pnpm') {
35242
- if (typeof lockfileVersion === 'number' &&
35243
- lockfileVersion === 5.4 &&
35244
- ((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) > 12) {
35257
+ if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
35245
35258
  // Ensure that pnpm 7 is at the beginning of the `$PATH`
35246
- newEnv.PATH = `/pnpm7/pnpm:${env.PATH}`;
35259
+ newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
35247
35260
  console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
35248
35261
  }
35249
35262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.16.1-canary.3",
3
+ "version": "3.0.1-canary.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.8.1-canary.1",
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": "41d66661399754aed76a655c92f28c19afd0e8f1"
52
+ "gitHead": "4c20218e05122c439e5fa4f4997e9c5a5c7a93e2"
53
53
  }