@vercel/build-utils 2.14.1-canary.4 → 2.14.1-canary.7

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,34 +1,35 @@
1
- $ node build
2
- ncc: Version 0.24.0
3
- ncc: Compiling file index.js
4
- ncc: Using typescript@4.3.4 (local user-provided)
5
- 0kB dist/main/should-serve.d.ts
6
- 0kB dist/main/get-platform-env.d.ts
7
- 0kB dist/main/get-ignore-filter.d.ts
8
- 0kB dist/main/fs/stream-to-buffer.d.ts
9
- 0kB dist/main/fs/rename.d.ts
10
- 0kB dist/main/fs/read-config-file.d.ts
11
- 0kB dist/main/fs/normalize-path.d.ts
12
- 0kB dist/main/fs/node-version.d.ts
13
- 0kB dist/main/fs/glob.d.ts
14
- 0kB dist/main/fs/get-writable-directory.d.ts
15
- 0kB dist/main/fs/download.d.ts
16
- 0kB dist/main/detect-framework.d.ts
17
- 0kB dist/main/debug.d.ts
18
- 1kB dist/main/schemas.d.ts
19
- 1kB dist/main/prerender.d.ts
20
- 1kB dist/main/nodejs-lambda.d.ts
21
- 1kB dist/main/file-ref.d.ts
22
- 1kB dist/main/file-fs-ref.d.ts
23
- 1kB dist/main/file-blob.d.ts
24
- 1kB dist/main/errors.d.ts
25
- 1kB dist/main/edge-function.d.ts
26
- 1kB dist/main/detect-file-system-api.d.ts
27
- 1kB dist/main/detect-builders.d.ts
28
- 2kB dist/main/lambda.d.ts
29
- 2kB dist/main/detectors/filesystem.d.ts
30
- 3kB dist/main/index.d.ts
31
- 4kB dist/main/fs/run-user-scripts.d.ts
32
- 10kB dist/main/types.d.ts
33
- 1234kB dist/main/index.js
34
- 1265kB [7426ms] - ncc 0.24.0
1
+ @vercel/build-utils:build: cache hit, replaying output ff709bb37a2bf1c5
2
+ @vercel/build-utils:build: $ node build
3
+ @vercel/build-utils:build: ncc: Version 0.24.0
4
+ @vercel/build-utils:build: ncc: Compiling file index.js
5
+ @vercel/build-utils:build: ncc: Using typescript@4.3.4 (local user-provided)
6
+ @vercel/build-utils:build: 0kB dist/main/should-serve.d.ts
7
+ @vercel/build-utils:build: 0kB dist/main/get-platform-env.d.ts
8
+ @vercel/build-utils:build: 0kB dist/main/get-ignore-filter.d.ts
9
+ @vercel/build-utils:build: 0kB dist/main/fs/stream-to-buffer.d.ts
10
+ @vercel/build-utils:build: 0kB dist/main/fs/rename.d.ts
11
+ @vercel/build-utils:build: 0kB dist/main/fs/read-config-file.d.ts
12
+ @vercel/build-utils:build: 0kB dist/main/fs/normalize-path.d.ts
13
+ @vercel/build-utils:build: 0kB dist/main/fs/node-version.d.ts
14
+ @vercel/build-utils:build: 0kB dist/main/fs/glob.d.ts
15
+ @vercel/build-utils:build: 0kB dist/main/fs/get-writable-directory.d.ts
16
+ @vercel/build-utils:build: 0kB dist/main/fs/download.d.ts
17
+ @vercel/build-utils:build: 0kB dist/main/detect-framework.d.ts
18
+ @vercel/build-utils:build: 0kB dist/main/debug.d.ts
19
+ @vercel/build-utils:build: 1kB dist/main/schemas.d.ts
20
+ @vercel/build-utils:build: 1kB dist/main/prerender.d.ts
21
+ @vercel/build-utils:build: 1kB dist/main/nodejs-lambda.d.ts
22
+ @vercel/build-utils:build: 1kB dist/main/file-ref.d.ts
23
+ @vercel/build-utils:build: 1kB dist/main/file-fs-ref.d.ts
24
+ @vercel/build-utils:build: 1kB dist/main/file-blob.d.ts
25
+ @vercel/build-utils:build: 1kB dist/main/errors.d.ts
26
+ @vercel/build-utils:build: 1kB dist/main/edge-function.d.ts
27
+ @vercel/build-utils:build: 1kB dist/main/detect-file-system-api.d.ts
28
+ @vercel/build-utils:build: 1kB dist/main/detect-builders.d.ts
29
+ @vercel/build-utils:build: 2kB dist/main/lambda.d.ts
30
+ @vercel/build-utils:build: 2kB dist/main/detectors/filesystem.d.ts
31
+ @vercel/build-utils:build: 3kB dist/main/index.d.ts
32
+ @vercel/build-utils:build: 4kB dist/main/fs/run-user-scripts.d.ts
33
+ @vercel/build-utils:build: 9kB dist/main/types.d.ts
34
+ @vercel/build-utils:build: 1235kB dist/main/index.js
35
+ @vercel/build-utils:build: 1265kB [6917ms] - ncc 0.24.0
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileBlobOptions {
4
4
  mode?: number;
5
5
  contentType?: string;
@@ -10,13 +10,14 @@ interface FromStreamOptions {
10
10
  contentType?: string;
11
11
  stream: NodeJS.ReadableStream;
12
12
  }
13
- export default class FileBlob implements File {
13
+ export default class FileBlob implements FileBase {
14
14
  type: 'FileBlob';
15
15
  mode: number;
16
16
  data: string | Buffer;
17
17
  contentType: string | undefined;
18
18
  constructor({ mode, contentType, data }: FileBlobOptions);
19
19
  static fromStream({ mode, contentType, stream, }: FromStreamOptions): Promise<FileBlob>;
20
+ toStreamAsync(): Promise<NodeJS.ReadableStream>;
20
21
  toStream(): NodeJS.ReadableStream;
21
22
  }
22
23
  export {};
package/dist/file-blob.js CHANGED
@@ -26,6 +26,9 @@ class FileBlob {
26
26
  const data = Buffer.concat(chunks);
27
27
  return new FileBlob({ mode, contentType, data });
28
28
  }
29
+ async toStreamAsync() {
30
+ return this.toStream();
31
+ }
29
32
  toStream() {
30
33
  return into_stream_1.default(this.data);
31
34
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileFsRefOptions {
4
4
  mode?: number;
5
5
  contentType?: string;
@@ -11,7 +11,7 @@ interface FromStreamOptions {
11
11
  stream: NodeJS.ReadableStream;
12
12
  fsPath: string;
13
13
  }
14
- declare class FileFsRef implements File {
14
+ declare class FileFsRef implements FileBase {
15
15
  type: 'FileFsRef';
16
16
  mode: number;
17
17
  fsPath: string;
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileRefOptions {
4
4
  mode?: number;
5
5
  digest: string;
6
6
  contentType?: string;
7
7
  mutable?: boolean;
8
8
  }
9
- export default class FileRef implements File {
9
+ export default class FileRef implements FileBase {
10
10
  type: 'FileRef';
11
11
  mode: number;
12
12
  digest: string;
@@ -8,26 +8,38 @@ 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
+ const stream_to_buffer_1 = __importDefault(require("./stream-to-buffer"));
11
12
  const S_IFMT = 61440; /* 0170000 type of file */
12
13
  const S_IFLNK = 40960; /* 0120000 symbolic link */
13
14
  function isSymbolicLink(mode) {
14
15
  return (mode & S_IFMT) === S_IFLNK;
15
16
  }
16
17
  exports.isSymbolicLink = isSymbolicLink;
18
+ async function prepareSymlinkTarget(file, fsPath) {
19
+ const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath));
20
+ if (file.type === 'FileFsRef') {
21
+ const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]);
22
+ return target;
23
+ }
24
+ if (file.type === 'FileRef' || file.type === 'FileBlob') {
25
+ const targetPathBufferPromise = await stream_to_buffer_1.default(await file.toStreamAsync());
26
+ const [targetPathBuffer] = await Promise.all([
27
+ targetPathBufferPromise,
28
+ mkdirPromise,
29
+ ]);
30
+ return targetPathBuffer.toString('utf8');
31
+ }
32
+ throw new Error(`file.type "${file.type}" not supported for symlink`);
33
+ }
17
34
  async function downloadFile(file, fsPath) {
18
35
  const { mode } = file;
19
- if (mode && isSymbolicLink(mode) && file.type === 'FileFsRef') {
20
- const [target] = await Promise.all([
21
- fs_extra_1.readlink(file.fsPath),
22
- fs_extra_1.mkdirp(path_1.default.dirname(fsPath)),
23
- ]);
36
+ if (isSymbolicLink(mode)) {
37
+ const target = await prepareSymlinkTarget(file, fsPath);
24
38
  await fs_extra_1.symlink(target, fsPath);
25
39
  return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
26
40
  }
27
- else {
28
- const stream = file.toStream();
29
- return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
30
- }
41
+ const stream = file.toStream();
42
+ return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
31
43
  }
32
44
  async function removeFile(basePath, fileMatched) {
33
45
  const file = path_1.default.join(basePath, fileMatched);
package/dist/index.js CHANGED
@@ -26617,6 +26617,7 @@ exports.frameworks = [
26617
26617
  slug: 'nextjs',
26618
26618
  demo: 'https://nextjs-template.vercel.app',
26619
26619
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/next.svg',
26620
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/nextjs.png',
26620
26621
  tagline: 'Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.',
26621
26622
  description: 'A Next.js app and a Serverless Function API.',
26622
26623
  website: 'https://nextjs.org',
@@ -27613,6 +27614,7 @@ exports.frameworks = [
27613
27614
  slug: 'sveltekit',
27614
27615
  demo: 'https://sveltekit-template.vercel.app',
27615
27616
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
27617
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/sveltekit.png',
27616
27618
  tagline: 'SvelteKit is a framework for building web applications of all sizes.',
27617
27619
  description: 'A SvelteKit app optimized Edge-first.',
27618
27620
  website: 'https://kit.svelte.dev',
@@ -28122,6 +28124,7 @@ exports.frameworks = [
28122
28124
  slug: 'nuxtjs',
28123
28125
  demo: 'https://nuxtjs-template.vercel.app',
28124
28126
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/nuxt.svg',
28127
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/nuxtjs.png',
28125
28128
  tagline: 'Nuxt.js is the web comprehensive framework that lets you dream big with Vue.js.',
28126
28129
  description: 'A Nuxt.js app, bootstrapped with create-nuxt-app.',
28127
28130
  website: 'https://nuxtjs.org',
@@ -28255,7 +28258,7 @@ exports.frameworks = [
28255
28258
  }));
28256
28259
  return (config && config.publishDir) || 'public';
28257
28260
  },
28258
- defaultVersion: '0.92.2',
28261
+ defaultVersion: '0.58.2',
28259
28262
  },
28260
28263
  {
28261
28264
  name: 'Jekyll',
@@ -34085,6 +34088,9 @@ class FileBlob {
34085
34088
  const data = Buffer.concat(chunks);
34086
34089
  return new FileBlob({ mode, contentType, data });
34087
34090
  }
34091
+ async toStreamAsync() {
34092
+ return this.toStream();
34093
+ }
34088
34094
  toStream() {
34089
34095
  return into_stream_1.default(this.data);
34090
34096
  }
@@ -34279,26 +34285,38 @@ const path_1 = __importDefault(__webpack_require__(5622));
34279
34285
  const debug_1 = __importDefault(__webpack_require__(1868));
34280
34286
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
34281
34287
  const fs_extra_1 = __webpack_require__(5392);
34288
+ const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
34282
34289
  const S_IFMT = 61440; /* 0170000 type of file */
34283
34290
  const S_IFLNK = 40960; /* 0120000 symbolic link */
34284
34291
  function isSymbolicLink(mode) {
34285
34292
  return (mode & S_IFMT) === S_IFLNK;
34286
34293
  }
34287
34294
  exports.isSymbolicLink = isSymbolicLink;
34295
+ async function prepareSymlinkTarget(file, fsPath) {
34296
+ const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath));
34297
+ if (file.type === 'FileFsRef') {
34298
+ const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]);
34299
+ return target;
34300
+ }
34301
+ if (file.type === 'FileRef' || file.type === 'FileBlob') {
34302
+ const targetPathBufferPromise = await stream_to_buffer_1.default(await file.toStreamAsync());
34303
+ const [targetPathBuffer] = await Promise.all([
34304
+ targetPathBufferPromise,
34305
+ mkdirPromise,
34306
+ ]);
34307
+ return targetPathBuffer.toString('utf8');
34308
+ }
34309
+ throw new Error(`file.type "${file.type}" not supported for symlink`);
34310
+ }
34288
34311
  async function downloadFile(file, fsPath) {
34289
34312
  const { mode } = file;
34290
- if (mode && isSymbolicLink(mode) && file.type === 'FileFsRef') {
34291
- const [target] = await Promise.all([
34292
- fs_extra_1.readlink(file.fsPath),
34293
- fs_extra_1.mkdirp(path_1.default.dirname(fsPath)),
34294
- ]);
34313
+ if (isSymbolicLink(mode)) {
34314
+ const target = await prepareSymlinkTarget(file, fsPath);
34295
34315
  await fs_extra_1.symlink(target, fsPath);
34296
34316
  return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
34297
34317
  }
34298
- else {
34299
- const stream = file.toStream();
34300
- return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
34301
- }
34318
+ const stream = file.toStream();
34319
+ return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
34302
34320
  }
34303
34321
  async function removeFile(basePath, fileMatched) {
34304
34322
  const file = path_1.default.join(basePath, fileMatched);
package/dist/lambda.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Files, Config } from './types';
2
+ import type { Files, Config } from './types';
3
3
  interface Environment {
4
4
  [key: string]: string;
5
5
  }
@@ -1,11 +1,9 @@
1
- import FileBlob from './file-blob';
2
- import FileFsRef from './file-fs-ref';
3
- import FileRef from './file-ref';
1
+ import { File } from './types';
4
2
  import { Lambda } from './lambda';
5
3
  interface PrerenderOptions {
6
4
  expiration: number | false;
7
5
  lambda: Lambda;
8
- fallback: FileBlob | FileFsRef | FileRef | null;
6
+ fallback: File | null;
9
7
  group?: number;
10
8
  bypassToken?: string | null;
11
9
  allowQuery?: string[];
@@ -14,7 +12,7 @@ export declare class Prerender {
14
12
  type: 'Prerender';
15
13
  expiration: number | false;
16
14
  lambda: Lambda;
17
- fallback: FileBlob | FileFsRef | FileRef | null;
15
+ fallback: File | null;
18
16
  group?: number;
19
17
  bypassToken: string | null;
20
18
  allowQuery?: string[];
package/dist/types.d.ts CHANGED
@@ -1,30 +1,25 @@
1
1
  /// <reference types="node" />
2
2
  import type FileRef from './file-ref';
3
3
  import type FileFsRef from './file-fs-ref';
4
+ import type FileBlob from './file-blob';
4
5
  import type { Lambda } from './lambda';
5
6
  import type { Prerender } from './prerender';
6
7
  import type { EdgeFunction } from './edge-function';
7
8
  export interface Env {
8
9
  [name: string]: string | undefined;
9
10
  }
10
- export interface File {
11
+ export declare type File = FileRef | FileFsRef | FileBlob;
12
+ export interface FileBase {
11
13
  type: string;
12
14
  mode: number;
13
15
  contentType?: string;
14
16
  toStream: () => NodeJS.ReadableStream;
15
17
  toStreamAsync?: () => Promise<NodeJS.ReadableStream>;
16
- /**
17
- * The absolute path to the file in the filesystem
18
- */
19
- fsPath?: string;
20
18
  }
21
19
  export interface Files {
22
20
  [filePath: string]: File;
23
21
  }
24
22
  export interface Config {
25
- [key: string]: string | string[] | boolean | number | {
26
- [key: string]: string;
27
- } | BuilderFunctions | ProjectSettings | undefined | null;
28
23
  maxLambdaSize?: string;
29
24
  includeFiles?: string | string[];
30
25
  excludeFiles?: string | string[];
@@ -45,6 +40,7 @@ export interface Config {
45
40
  devCommand?: string;
46
41
  framework?: string | null;
47
42
  nodeVersion?: string;
43
+ [key: string]: unknown;
48
44
  }
49
45
  export interface Meta {
50
46
  isDev?: boolean;
@@ -56,31 +52,7 @@ export interface Meta {
56
52
  env?: Env;
57
53
  buildEnv?: Env;
58
54
  avoidTopLevelInstall?: boolean;
59
- }
60
- export interface AnalyzeOptions {
61
- /**
62
- * All source files of the project
63
- */
64
- files: {
65
- [filePath: string]: FileRef;
66
- };
67
- /**
68
- * Name of entrypoint file for this particular build job. Value
69
- * `files[entrypoint]` is guaranteed to exist and be a valid File reference.
70
- * `entrypoint` is always a discrete file and never a glob, since globs are
71
- * expanded into separate builds at deployment time.
72
- */
73
- entrypoint: string;
74
- /**
75
- * A writable temporary directory where you are encouraged to perform your
76
- * build process. This directory will be populated with the restored cache.
77
- */
78
- workPath: string;
79
- /**
80
- * An arbitrary object passed by the user in the build definition defined
81
- * in `vercel.json`.
82
- */
83
- config: Config;
55
+ [key: string]: unknown;
84
56
  }
85
57
  export interface BuildOptions {
86
58
  /**
@@ -344,7 +316,7 @@ export interface BuildResultV2 {
344
316
  routes?: any[];
345
317
  images?: Images;
346
318
  output: {
347
- [key: string]: File | Lambda | Prerender | EdgeFunction;
319
+ [key: string]: FileBase | Lambda | Prerender | EdgeFunction;
348
320
  };
349
321
  wildcard?: Array<{
350
322
  domain: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.14.1-canary.4",
3
+ "version": "2.14.1-canary.7",
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.1",
33
- "@vercel/frameworks": "0.6.1-canary.3",
33
+ "@vercel/frameworks": "0.6.1-canary.6",
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.4.3"
51
51
  },
52
- "gitHead": "a24fd64bce88d5025c52ac7dfbdc3c0f457de077"
52
+ "gitHead": "34055e3599376144629c1d1efb0ce5b4deb6c675"
53
53
  }