@vercel/build-utils 13.20.0 → 13.21.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c56f851: Upgrade to TypeScript 5.9
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8e999cb]
12
+ - @vercel/python-analysis@0.11.1
13
+
3
14
  ## 13.20.0
4
15
 
5
16
  ### Minor Changes
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface ExtendedBodyData {
3
2
  prefix: string;
4
3
  suffix: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type FileFsRef from '../file-fs-ref';
3
2
  import { type Stats } from 'fs-extra';
4
3
  interface FileLike {
@@ -3,4 +3,4 @@ import type { Files } from './types';
3
3
  * Collects the total uncompressed size of a set of Lambda files.
4
4
  * Handles both FileBlob (in-memory) and FileFsRef (on-disk) file types.
5
5
  */
6
- export declare const collectUncompressedSize: (files: Files, ignoreFn?: ((fileKey: string) => boolean) | undefined) => Promise<number>;
6
+ export declare const collectUncompressedSize: (files: Files, ignoreFn?: (fileKey: string) => boolean) => Promise<number>;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { FileBase } from './types';
4
2
  interface FileBlobOptions {
5
3
  mode?: number;
package/dist/file-blob.js CHANGED
@@ -56,7 +56,9 @@ class FileBlob {
56
56
  (chunk) => (
57
57
  // Usually the chunks we receive here are already buffers, so we
58
58
  // avoid the extra buffer copy in those cases to save memory
59
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
59
+ chunks.push(
60
+ Uint8Array.from(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
61
+ )
60
62
  )
61
63
  );
62
64
  stream.on("error", (error) => reject(error));
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { FileBase } from './types';
3
2
  interface FileFsRefOptions {
4
3
  mode?: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { FileBase } from './types';
3
2
  interface FileRefOptions {
4
3
  mode?: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Lambda } from './lambda';
3
2
  import type { NodejsLambda } from './nodejs-lambda';
4
3
  import type { BytecodeCachingOptions } from './process-serverless/get-lambda-preload-scripts';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { SpawnOptions } from 'child_process';
4
2
  import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
5
3
  export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
@@ -1,4 +1,2 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export default function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>;
4
2
  export declare function streamToBufferChunks(stream: NodeJS.ReadableStream, chunkSize?: number): Promise<Buffer[]>;
@@ -36,7 +36,10 @@ var import_end_of_stream = __toESM(require("end-of-stream"));
36
36
  function streamToBuffer(stream) {
37
37
  return new Promise((resolve, reject) => {
38
38
  const buffers = [];
39
- stream.on("data", buffers.push.bind(buffers));
39
+ stream.on("data", (chunk) => {
40
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
41
+ buffers.push(Uint8Array.from(buffer));
42
+ });
40
43
  (0, import_end_of_stream.default)(stream, (err) => {
41
44
  if (err) {
42
45
  reject(err);
@@ -48,7 +51,7 @@ function streamToBuffer(stream) {
48
51
  resolve(Buffer.allocUnsafe(0));
49
52
  break;
50
53
  case 1:
51
- resolve(buffers[0]);
54
+ resolve(Buffer.from(buffers[0]));
52
55
  break;
53
56
  default:
54
57
  resolve(Buffer.concat(buffers));
@@ -70,7 +73,9 @@ async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
70
73
  while (offset < buffer.length) {
71
74
  const remainingSpace = chunkSize - currentSize;
72
75
  const sliceSize = Math.min(remainingSpace, buffer.length - offset);
73
- currentChunk.push(buffer.slice(offset, offset + sliceSize));
76
+ currentChunk.push(
77
+ Uint8Array.from(buffer.subarray(offset, offset + sliceSize))
78
+ );
74
79
  currentSize += sliceSize;
75
80
  offset += sliceSize;
76
81
  if (currentSize >= chunkSize) {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export interface FileDigest {
4
2
  md5: string;
5
3
  sha256: string;
@@ -41,8 +41,9 @@ async function streamToDigestAsync(stream) {
41
41
  stream.on("readable", () => {
42
42
  let chunk;
43
43
  while (null !== (chunk = stream.read())) {
44
- md52.update(chunk);
45
- sha2562.update(chunk);
44
+ const buffer = Buffer.isBuffer(chunk) ? Uint8Array.from(chunk) : Uint8Array.from(Buffer.from(chunk));
45
+ md52.update(buffer);
46
+ sha2562.update(buffer);
46
47
  count += chunk.length;
47
48
  }
48
49
  });
@@ -52,7 +53,7 @@ function sha256(value) {
52
53
  return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
53
54
  }
54
55
  function md5(value) {
55
- return (0, import_crypto.createHash)("md5").update(value).digest("hex");
56
+ return (0, import_crypto.createHash)("md5").update(Uint8Array.from(value)).digest("hex");
56
57
  }
57
58
  // Annotate the CommonJS export names for ESM import in node:
58
59
  0 && (module.exports = {
package/dist/index.js CHANGED
@@ -28412,7 +28412,9 @@ var FileBlob = class _FileBlob {
28412
28412
  (chunk) => (
28413
28413
  // Usually the chunks we receive here are already buffers, so we
28414
28414
  // avoid the extra buffer copy in those cases to save memory
28415
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
28415
+ chunks.push(
28416
+ Uint8Array.from(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
28417
+ )
28416
28418
  )
28417
28419
  );
28418
28420
  stream.on("error", (error) => reject(error));
@@ -28739,7 +28741,10 @@ var import_end_of_stream = __toESM(require_end_of_stream());
28739
28741
  function streamToBuffer(stream) {
28740
28742
  return new Promise((resolve, reject) => {
28741
28743
  const buffers = [];
28742
- stream.on("data", buffers.push.bind(buffers));
28744
+ stream.on("data", (chunk) => {
28745
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
28746
+ buffers.push(Uint8Array.from(buffer));
28747
+ });
28743
28748
  (0, import_end_of_stream.default)(stream, (err) => {
28744
28749
  if (err) {
28745
28750
  reject(err);
@@ -28751,7 +28756,7 @@ function streamToBuffer(stream) {
28751
28756
  resolve(Buffer.allocUnsafe(0));
28752
28757
  break;
28753
28758
  case 1:
28754
- resolve(buffers[0]);
28759
+ resolve(Buffer.from(buffers[0]));
28755
28760
  break;
28756
28761
  default:
28757
28762
  resolve(Buffer.concat(buffers));
@@ -28773,7 +28778,9 @@ async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
28773
28778
  while (offset < buffer.length) {
28774
28779
  const remainingSpace = chunkSize - currentSize;
28775
28780
  const sliceSize = Math.min(remainingSpace, buffer.length - offset);
28776
- currentChunk.push(buffer.slice(offset, offset + sliceSize));
28781
+ currentChunk.push(
28782
+ Uint8Array.from(buffer.subarray(offset, offset + sliceSize))
28783
+ );
28777
28784
  currentSize += sliceSize;
28778
28785
  offset += sliceSize;
28779
28786
  if (currentSize >= chunkSize) {
@@ -32603,8 +32610,9 @@ async function streamToDigestAsync(stream) {
32603
32610
  stream.on("readable", () => {
32604
32611
  let chunk;
32605
32612
  while (null !== (chunk = stream.read())) {
32606
- md52.update(chunk);
32607
- sha2562.update(chunk);
32613
+ const buffer = Buffer.isBuffer(chunk) ? Uint8Array.from(chunk) : Uint8Array.from(Buffer.from(chunk));
32614
+ md52.update(buffer);
32615
+ sha2562.update(buffer);
32608
32616
  count += chunk.length;
32609
32617
  }
32610
32618
  });
@@ -32614,7 +32622,7 @@ function sha256(value) {
32614
32622
  return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
32615
32623
  }
32616
32624
  function md5(value) {
32617
- return (0, import_crypto.createHash)("md5").update(value).digest("hex");
32625
+ return (0, import_crypto.createHash)("md5").update(Uint8Array.from(value)).digest("hex");
32618
32626
  }
32619
32627
 
32620
32628
  // src/collect-build-result/get-lambda-by-output-path.ts
package/dist/lambda.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Config, Env, Files, FunctionFramework, MaxDuration, TriggerEvent, TriggerEventInput } from './types';
3
2
  export type { TriggerEvent, TriggerEventInput };
4
3
  /**
package/dist/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type FileRef from './file-ref';
4
2
  import type FileFsRef from './file-fs-ref';
5
3
  import type FileBlob from './file-blob';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { NowBuildError } from './errors';
3
2
  /**
4
3
  * Max compressed ZIP size (300 MB).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.20.0",
3
+ "version": "13.21.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "cjs-module-lexer": "1.2.3",
15
15
  "es-module-lexer": "1.5.0",
16
- "@vercel/python-analysis": "0.11.0"
16
+ "@vercel/python-analysis": "0.11.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "bytes": "3.1.2",
@@ -52,12 +52,11 @@
52
52
  "multistream": "2.1.1",
53
53
  "node-fetch": "2.6.7",
54
54
  "semver": "6.3.1",
55
- "typescript": "4.9.5",
56
55
  "yazl": "2.5.1",
57
56
  "vitest": "2.0.1",
58
57
  "json5": "2.2.3",
59
- "@vercel/error-utils": "2.0.3",
60
- "@vercel/routing-utils": "6.1.1"
58
+ "@vercel/error-utils": "2.1.0",
59
+ "@vercel/routing-utils": "6.2.0"
61
60
  },
62
61
  "scripts": {
63
62
  "build": "node build.mjs",