@vercel/build-utils 5.7.4 → 5.7.5

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.
@@ -3,6 +3,7 @@ import { File, Files, Meta } from '../types';
3
3
  export interface DownloadedFiles {
4
4
  [filePath: string]: FileFsRef;
5
5
  }
6
+ export declare function isDirectory(mode: number): boolean;
6
7
  export declare function isSymbolicLink(mode: number): boolean;
7
8
  export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
8
9
  export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;
@@ -3,14 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadFile = exports.isSymbolicLink = void 0;
6
+ exports.downloadFile = exports.isSymbolicLink = exports.isDirectory = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const debug_1 = __importDefault(require("../debug"));
9
9
  const file_fs_ref_1 = __importDefault(require("../file-fs-ref"));
10
10
  const fs_extra_1 = require("fs-extra");
11
11
  const stream_to_buffer_1 = __importDefault(require("./stream-to-buffer"));
12
- const S_IFMT = 61440; /* 0170000 type of file */
12
+ const S_IFDIR = 16384; /* 0040000 directory */
13
13
  const S_IFLNK = 40960; /* 0120000 symbolic link */
14
+ const S_IFMT = 61440; /* 0170000 type of file */
15
+ function isDirectory(mode) {
16
+ return (mode & S_IFMT) === S_IFDIR;
17
+ }
18
+ exports.isDirectory = isDirectory;
14
19
  function isSymbolicLink(mode) {
15
20
  return (mode & S_IFMT) === S_IFLNK;
16
21
  }
package/dist/index.js CHANGED
@@ -30519,14 +30519,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30519
30519
  return (mod && mod.__esModule) ? mod : { "default": mod };
30520
30520
  };
30521
30521
  Object.defineProperty(exports, "__esModule", ({ value: true }));
30522
- exports.downloadFile = exports.isSymbolicLink = void 0;
30522
+ exports.downloadFile = exports.isSymbolicLink = exports.isDirectory = void 0;
30523
30523
  const path_1 = __importDefault(__webpack_require__(5622));
30524
30524
  const debug_1 = __importDefault(__webpack_require__(1868));
30525
30525
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
30526
30526
  const fs_extra_1 = __webpack_require__(5392);
30527
30527
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
30528
- const S_IFMT = 61440; /* 0170000 type of file */
30528
+ const S_IFDIR = 16384; /* 0040000 directory */
30529
30529
  const S_IFLNK = 40960; /* 0120000 symbolic link */
30530
+ const S_IFMT = 61440; /* 0170000 type of file */
30531
+ function isDirectory(mode) {
30532
+ return (mode & S_IFMT) === S_IFDIR;
30533
+ }
30534
+ exports.isDirectory = isDirectory;
30530
30535
  function isSymbolicLink(mode) {
30531
30536
  return (mode & S_IFMT) === S_IFLNK;
30532
30537
  }
@@ -31757,6 +31762,9 @@ async function createZip(files) {
31757
31762
  if (typeof symlinkTarget === 'string') {
31758
31763
  zipFile.addBuffer(Buffer.from(symlinkTarget, 'utf8'), name, opts);
31759
31764
  }
31765
+ else if (file.mode && download_1.isDirectory(file.mode)) {
31766
+ zipFile.addEmptyDirectory(name, opts);
31767
+ }
31760
31768
  else {
31761
31769
  const stream = file.toStream();
31762
31770
  stream.on('error', reject);
package/dist/lambda.js CHANGED
@@ -107,6 +107,9 @@ async function createZip(files) {
107
107
  if (typeof symlinkTarget === 'string') {
108
108
  zipFile.addBuffer(Buffer.from(symlinkTarget, 'utf8'), name, opts);
109
109
  }
110
+ else if (file.mode && download_1.isDirectory(file.mode)) {
111
+ zipFile.addEmptyDirectory(name, opts);
112
+ }
110
113
  else {
111
114
  const stream = file.toStream();
112
115
  stream.on('error', reject);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "5.7.4",
3
+ "version": "5.7.5",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -47,5 +47,5 @@
47
47
  "typescript": "4.3.4",
48
48
  "yazl": "2.5.1"
49
49
  },
50
- "gitHead": "721cd3afcbff994fa96704b4eb79e5f6da7ab73c"
50
+ "gitHead": "4c3bc0532216f21f354623ada76b2315ef8ba519"
51
51
  }