@vercel/build-utils 6.7.1 → 6.7.3

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/lambda.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { Files, Config, FunctionFramework } from './types';
3
3
  interface Environment {
4
4
  [key: string]: string;
5
5
  }
6
- export declare type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
6
+ export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
7
7
  export interface LambdaOptionsBase {
8
8
  handler: string;
9
9
  runtime: string;
package/dist/lambda.js CHANGED
@@ -15,39 +15,39 @@ class Lambda {
15
15
  constructor(opts) {
16
16
  const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, supportsResponseStreaming, experimentalResponseStreaming, operationType, framework, } = opts;
17
17
  if ('files' in opts) {
18
- assert_1.default(typeof opts.files === 'object', '"files" must be an object');
18
+ (0, assert_1.default)(typeof opts.files === 'object', '"files" must be an object');
19
19
  }
20
20
  if ('zipBuffer' in opts) {
21
- assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
21
+ (0, assert_1.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
22
22
  }
23
- assert_1.default(typeof handler === 'string', '"handler" is not a string');
24
- assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
25
- assert_1.default(typeof environment === 'object', '"environment" is not an object');
23
+ (0, assert_1.default)(typeof handler === 'string', '"handler" is not a string');
24
+ (0, assert_1.default)(typeof runtime === 'string', '"runtime" is not a string');
25
+ (0, assert_1.default)(typeof environment === 'object', '"environment" is not an object');
26
26
  if (memory !== undefined) {
27
- assert_1.default(typeof memory === 'number', '"memory" is not a number');
27
+ (0, assert_1.default)(typeof memory === 'number', '"memory" is not a number');
28
28
  }
29
29
  if (maxDuration !== undefined) {
30
- assert_1.default(typeof maxDuration === 'number', '"maxDuration" is not a number');
30
+ (0, assert_1.default)(typeof maxDuration === 'number', '"maxDuration" is not a number');
31
31
  }
32
32
  if (allowQuery !== undefined) {
33
- assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
34
- assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
33
+ (0, assert_1.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
34
+ (0, assert_1.default)(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
35
35
  }
36
36
  if (supportsMultiPayloads !== undefined) {
37
- assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
37
+ (0, assert_1.default)(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
38
38
  }
39
39
  if (supportsWrapper !== undefined) {
40
- assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
40
+ (0, assert_1.default)(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
41
41
  }
42
42
  if (regions !== undefined) {
43
- assert_1.default(Array.isArray(regions), '"regions" is not an Array');
44
- assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
43
+ (0, assert_1.default)(Array.isArray(regions), '"regions" is not an Array');
44
+ (0, assert_1.default)(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
45
45
  }
46
46
  if (framework !== undefined) {
47
- assert_1.default(typeof framework === 'object', '"framework" is not an object');
48
- assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
47
+ (0, assert_1.default)(typeof framework === 'object', '"framework" is not an object');
48
+ (0, assert_1.default)(typeof framework.slug === 'string', '"framework.slug" is not a string');
49
49
  if (framework.version !== undefined) {
50
- assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
50
+ (0, assert_1.default)(typeof framework.version === 'string', '"framework.version" is not a string');
51
51
  }
52
52
  }
53
53
  this.type = 'Lambda';
@@ -111,8 +111,8 @@ async function createZip(files) {
111
111
  const symlinkTargets = new Map();
112
112
  for (const name of names) {
113
113
  const file = files[name];
114
- if (file.mode && download_1.isSymbolicLink(file.mode) && file.type === 'FileFsRef') {
115
- const symlinkTarget = await fs_extra_1.readlink(file.fsPath);
114
+ if (file.mode && (0, download_1.isSymbolicLink)(file.mode) && file.type === 'FileFsRef') {
115
+ const symlinkTarget = await (0, fs_extra_1.readlink)(file.fsPath);
116
116
  symlinkTargets.set(name, symlinkTarget);
117
117
  }
118
118
  }
@@ -125,7 +125,7 @@ async function createZip(files) {
125
125
  if (typeof symlinkTarget === 'string') {
126
126
  zipFile.addBuffer(Buffer.from(symlinkTarget, 'utf8'), name, opts);
127
127
  }
128
- else if (file.mode && download_1.isDirectory(file.mode)) {
128
+ else if (file.mode && (0, download_1.isDirectory)(file.mode)) {
129
129
  zipFile.addEmptyDirectory(name, opts);
130
130
  }
131
131
  else {
@@ -135,7 +135,7 @@ async function createZip(files) {
135
135
  }
136
136
  }
137
137
  zipFile.end();
138
- stream_to_buffer_1.default(zipFile.outputStream).then(resolve).catch(reject);
138
+ (0, stream_to_buffer_1.default)(zipFile.outputStream).then(resolve).catch(reject);
139
139
  });
140
140
  return zipBuffer;
141
141
  }
@@ -143,7 +143,7 @@ exports.createZip = createZip;
143
143
  async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
144
144
  if (config?.functions) {
145
145
  for (const [pattern, fn] of Object.entries(config.functions)) {
146
- if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
146
+ if (sourceFile === pattern || (0, minimatch_1.default)(sourceFile, pattern)) {
147
147
  return {
148
148
  memory: fn.memory,
149
149
  maxDuration: fn.maxDuration,
@@ -8,7 +8,7 @@ const shouldServe = ({ entrypoint, files, requestPath, }) => {
8
8
  if (entrypoint === requestPath && hasProp(files, entrypoint)) {
9
9
  return true;
10
10
  }
11
- const { dir, name } = path_1.parse(entrypoint);
11
+ const { dir, name } = (0, path_1.parse)(entrypoint);
12
12
  if (name === 'index' && dir === requestPath && hasProp(files, entrypoint)) {
13
13
  return true;
14
14
  }
package/dist/types.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { EdgeFunction } from './edge-function';
8
8
  export interface Env {
9
9
  [name: string]: string | undefined;
10
10
  }
11
- export declare type File = FileRef | FileFsRef | FileBlob;
11
+ export type File = FileRef | FileFsRef | FileBlob;
12
12
  export interface FileBase {
13
13
  type: string;
14
14
  mode: number;
@@ -151,7 +151,7 @@ export interface ShouldServeOptions {
151
151
  /**
152
152
  * `startDevServer()` is given the same parameters as `build()`.
153
153
  */
154
- export declare type StartDevServerOptions = BuildOptions;
154
+ export type StartDevServerOptions = BuildOptions;
155
155
  export interface StartDevServerSuccess {
156
156
  /**
157
157
  * Port number where the dev server can be connected to, assumed to be running
@@ -168,7 +168,7 @@ export interface StartDevServerSuccess {
168
168
  * `startDevServer()` may return `null` to opt-out of spawning a dev server for
169
169
  * a given `entrypoint`.
170
170
  */
171
- export declare type StartDevServerResult = StartDevServerSuccess | null;
171
+ export type StartDevServerResult = StartDevServerSuccess | null;
172
172
  /**
173
173
  * Credit to Iain Reid, MIT license.
174
174
  * Source: https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e
@@ -312,9 +312,9 @@ export interface BuilderV3 {
312
312
  shouldServe?: ShouldServe;
313
313
  startDevServer?: StartDevServer;
314
314
  }
315
- declare type ImageFormat = 'image/avif' | 'image/webp';
316
- declare type ImageContentDispositionType = 'inline' | 'attachment';
317
- export declare type RemotePattern = {
315
+ type ImageFormat = 'image/avif' | 'image/webp';
316
+ type ImageContentDispositionType = 'inline' | 'attachment';
317
+ export type RemotePattern = {
318
318
  /**
319
319
  * Must be `http` or `https`.
320
320
  */
@@ -391,14 +391,14 @@ export interface BuildResultV2Typical {
391
391
  version: string;
392
392
  };
393
393
  }
394
- export declare type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
394
+ export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
395
395
  export interface BuildResultV3 {
396
396
  routes?: any[];
397
397
  output: Lambda | EdgeFunction;
398
398
  }
399
- export declare type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
400
- export declare type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
401
- export declare type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
402
- export declare type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
403
- export declare type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
399
+ export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
400
+ export type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
401
+ export type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
402
+ export type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
403
+ export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
404
404
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "6.7.1",
3
+ "version": "6.7.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -10,12 +10,6 @@
10
10
  "url": "https://github.com/vercel/vercel.git",
11
11
  "directory": "packages/now-build-utils"
12
12
  },
13
- "scripts": {
14
- "build": "node build",
15
- "test": "jest --env node --verbose --runInBand --bail",
16
- "test-unit": "pnpm test test/unit.*test.*",
17
- "test-e2e": "pnpm test test/integration.test.ts"
18
- },
19
13
  "devDependencies": {
20
14
  "@iarna/toml": "2.2.3",
21
15
  "@types/async-retry": "^1.2.1",
@@ -32,6 +26,7 @@
32
26
  "@types/node-fetch": "^2.1.6",
33
27
  "@types/semver": "6.0.0",
34
28
  "@types/yazl": "2.4.2",
29
+ "@vercel/error-utils": "1.0.10",
35
30
  "@vercel/ncc": "0.24.0",
36
31
  "aggregate-error": "3.0.1",
37
32
  "async-retry": "1.2.3",
@@ -48,8 +43,13 @@
48
43
  "multistream": "2.1.1",
49
44
  "node-fetch": "2.6.7",
50
45
  "semver": "6.1.1",
51
- "typescript": "4.3.4",
46
+ "typescript": "4.9.5",
52
47
  "yazl": "2.5.1"
53
48
  },
54
- "gitHead": "925c8ba18ceec80174d9440cd2cad0e725ed4f56"
55
- }
49
+ "scripts": {
50
+ "build": "node build",
51
+ "test": "jest --env node --verbose --runInBand --bail",
52
+ "test-unit": "pnpm test test/unit.*test.*",
53
+ "test-e2e": "pnpm test test/integration.test.ts"
54
+ }
55
+ }