Update app and tooling

This commit is contained in:
Lawrence Chen 2026-01-29 17:36:26 -08:00
parent 3046531bdd
commit e620ec7349
4950 changed files with 2975120 additions and 10 deletions

202
node_modules/@vercel/backends/LICENSE generated vendored Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 Vercel, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

8
node_modules/@vercel/backends/dist/index.d.mts generated vendored Normal file
View file

@ -0,0 +1,8 @@
import { BuildV2, PrepareCache } from "@vercel/build-utils";
//#region src/index.d.ts
declare const version = 2;
declare const build: BuildV2;
declare const prepareCache: PrepareCache;
//#endregion
export { build, prepareCache, version };

56861
node_modules/@vercel/backends/dist/index.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

51
node_modules/@vercel/backends/package.json generated vendored Normal file
View file

@ -0,0 +1,51 @@
{
"name": "@vercel/backends",
"version": "0.0.23",
"license": "Apache-2.0",
"main": "./dist/index.mjs",
"homepage": "https://vercel.com/docs",
"type": "module",
"publishConfig": {
"access": "public"
},
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "https://github.com/vercel/vercel.git",
"directory": "packages/backends"
},
"files": [
"dist"
],
"dependencies": {
"@vercel/nft": "1.1.1",
"fs-extra": "11.1.0",
"@vercel/static-config": "3.1.2",
"@vercel/cervel": "0.0.10",
"@vercel/introspection": "0.0.10"
},
"devDependencies": {
"@types/express": "5.0.3",
"@types/fs-extra": "11",
"@types/jest": "27.5.1",
"@types/node": "20.11.0",
"execa": "3.2.0",
"hono": "4.10.1",
"jest-junit": "16.0.0",
"tsdown": "0.16.3",
"vite": "^5.1.6",
"vitest": "^2.0.1",
"@vercel/build-utils": "13.2.14"
},
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"scripts": {
"build": "tsdown",
"vitest-run": "vitest -c ../../vitest.config.mts",
"vitest-unit": "glob --absolute 'test/unit/**/*.test.ts' 'test/unit/**/*.test.mts'",
"type-check": "tsc --noEmit"
}
}

86
node_modules/@vercel/blob/README.md generated vendored Normal file
View file

@ -0,0 +1,86 @@
# 🍙 @vercel/blob
The Vercel Blob JavaScript API client.
---
<p align="center">
👉
<a href="https://vercel.com/docs/vercel-blob">
<b>Quickstart</b>
</a>
<a href="https://vercel.com/docs/vercel-blob/using-blob-sdk">
<b>SDK Reference</b>
</a>
👈
</b>
</p>
---
## Installation
```sh
npm install @vercel/blob
```
## Quickstart
We have examples on the vercel.com documentation, there are two ways to upload files to Vercel Blob:
1. [Server uploads](https://vercel.com/docs/vercel-blob/server-upload): This is the most common way to upload files. The file is first sent to your server and then to Vercel Blob. It's straightforward to implement, but you are limited to the request body your server can handle. Which in case of a Vercel-hosted website is 4.5 MB. **This means you can't upload files larger than 4.5 MB on Vercel when using this method.**
2. [Client uploads](https://vercel.com/docs/vercel-blob/client-upload): This is a more advanced solution for when you need to upload larger files. The file is securely sent directly from the client (a browser for example) to Vercel Blob. This requires a bit more work to implement, but it allows you to upload files up to 5 TB.
## Releasing
Make sure to include a changeset in your PR. You can do this by running:
```sh
pnpm changeset
git commit -am "changeset"
git push
```
Once such a commit gets merged in main, then GitHub will open a versioning PR you can merge. And the package will be automatically published to npm.
## A note for Vite users
`@vercel/blob` reads the token from the environment variables on `process.env`. In general, `process.env` is automatically populated from your `.env` file during development, which is created when you run `vc env pull`. However, Vite does not expose the `.env` variables on `process.env.`
You can fix this in **one** of following two ways:
1. You can populate `process.env` yourself using something like `dotenv-expand`:
```shell
pnpm install --save-dev dotenv dotenv-expand
```
```js
// vite.config.js
import dotenvExpand from 'dotenv-expand';
import { loadEnv, defineConfig } from 'vite';
export default defineConfig(({ mode }) => {
// This check is important!
if (mode === 'development') {
const env = loadEnv(mode, process.cwd(), '');
dotenvExpand.expand({ parsed: env });
}
return {
...
};
});
```
2. You can provide the credentials explicitly, instead of relying on a zero-config setup. For example, this is how you could create a client in SvelteKit, which makes private environment variables available via `$env/static/private`:
```diff
import { put } from '@vercel/blob';
+ import { BLOB_TOKEN } from '$env/static/private';
const blob = await head("filepath", {
- token: '<token>',
+ token: BLOB_TOKEN,
});
```

1345
node_modules/@vercel/blob/dist/chunk-KLNTTDLT.cjs generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

1345
node_modules/@vercel/blob/dist/chunk-Z56QURM6.js generated vendored Normal file

File diff suppressed because it is too large Load diff

1
node_modules/@vercel/blob/dist/chunk-Z56QURM6.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

287
node_modules/@vercel/blob/dist/client.cjs generated vendored Normal file
View file

@ -0,0 +1,287 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
var _chunkKLNTTDLTcjs = require('./chunk-KLNTTDLT.cjs');
// src/client.ts
var _crypto = require('crypto'); var crypto = _interopRequireWildcard(_crypto);
var _undici = require('undici');
function createPutExtraChecks(methodName) {
return function extraChecks(options) {
if (!options.token.startsWith("vercel_blob_client_")) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(`${methodName} must be called with a client token`);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.allowOverwrite !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`${methodName} doesn't allow \`addRandomSuffix\`, \`cacheControlMaxAge\` or \`allowOverwrite\`. Configure these options at the server side when generating client tokens.`
);
}
};
}
var put = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`put`")
});
var createMultipartUpload = _chunkKLNTTDLTcjs.createCreateMultipartUploadMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
});
var createMultipartUploader = _chunkKLNTTDLTcjs.createCreateMultipartUploaderMethod.call(void 0,
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
}
);
var uploadPart = _chunkKLNTTDLTcjs.createUploadPartMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`multipartUpload`")
});
var completeMultipartUpload = _chunkKLNTTDLTcjs.createCompleteMultipartUploadMethod.call(void 0,
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`completeMultipartUpload`")
}
);
var upload = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks(options) {
if (options.handleUploadUrl === void 0) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
"client/`upload` requires the 'handleUploadUrl' parameter"
);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.createPutExtraChecks !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
"client/`upload` doesn't allow `addRandomSuffix`, `cacheControlMaxAge` or `allowOverwrite`. Configure these options at the server side when generating client tokens."
);
}
},
async getToken(pathname, options) {
var _a, _b;
return retrieveClientToken({
handleUploadUrl: options.handleUploadUrl,
pathname,
clientPayload: (_a = options.clientPayload) != null ? _a : null,
multipart: (_b = options.multipart) != null ? _b : false
});
}
});
async function importKey(token) {
return globalThis.crypto.subtle.importKey(
"raw",
new TextEncoder().encode(token),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign", "verify"]
);
}
async function signPayload(payload, token) {
if (!globalThis.crypto) {
return crypto.createHmac("sha256", token).update(payload).digest("hex");
}
const signature = await globalThis.crypto.subtle.sign(
"HMAC",
await importKey(token),
new TextEncoder().encode(payload)
);
return Buffer.from(new Uint8Array(signature)).toString("hex");
}
async function verifyCallbackSignature({
token,
signature,
body
}) {
const secret = token;
if (!globalThis.crypto) {
const digest = crypto.createHmac("sha256", secret).update(body).digest("hex");
const digestBuffer = Buffer.from(digest);
const signatureBuffer = Buffer.from(signature);
return digestBuffer.length === signatureBuffer.length && crypto.timingSafeEqual(digestBuffer, signatureBuffer);
}
const verified = await globalThis.crypto.subtle.verify(
"HMAC",
await importKey(token),
hexToArrayByte(signature),
new TextEncoder().encode(body)
);
return verified;
}
function hexToArrayByte(input) {
if (input.length % 2 !== 0) {
throw new RangeError("Expected string to be an even number of characters");
}
const view = new Uint8Array(input.length / 2);
for (let i = 0; i < input.length; i += 2) {
view[i / 2] = parseInt(input.substring(i, i + 2), 16);
}
return Buffer.from(view);
}
function getPayloadFromClientToken(clientToken) {
const [, , , , encodedToken] = clientToken.split("_");
const encodedPayload = Buffer.from(encodedToken != null ? encodedToken : "", "base64").toString().split(".")[1];
const decodedPayload = Buffer.from(encodedPayload != null ? encodedPayload : "", "base64").toString();
return JSON.parse(decodedPayload);
}
var EventTypes = {
generateClientToken: "blob.generate-client-token",
uploadCompleted: "blob.upload-completed"
};
async function handleUpload({
token,
request,
body,
onBeforeGenerateToken,
onUploadCompleted
}) {
var _a, _b, _c, _d;
const resolvedToken = _chunkKLNTTDLTcjs.getTokenFromOptionsOrEnv.call(void 0, { token });
const type = body.type;
switch (type) {
case "blob.generate-client-token": {
const { pathname, callbackUrl, clientPayload, multipart } = body.payload;
const payload = await onBeforeGenerateToken(
pathname,
clientPayload,
multipart
);
const tokenPayload = (_a = payload.tokenPayload) != null ? _a : clientPayload;
const oneHourInSeconds = 60 * 60;
const now = /* @__PURE__ */ new Date();
const validUntil = (_b = payload.validUntil) != null ? _b : now.setSeconds(now.getSeconds() + oneHourInSeconds);
return {
type,
clientToken: await generateClientTokenFromReadWriteToken({
...payload,
token: resolvedToken,
pathname,
onUploadCompleted: {
callbackUrl,
tokenPayload
},
validUntil
})
};
}
case "blob.upload-completed": {
const signatureHeader = "x-vercel-signature";
const signature = "credentials" in request ? (_c = request.headers.get(signatureHeader)) != null ? _c : "" : (_d = request.headers[signatureHeader]) != null ? _d : "";
if (!signature) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Missing callback signature");
}
const isVerified = await verifyCallbackSignature({
token: resolvedToken,
signature,
body: JSON.stringify(body)
});
if (!isVerified) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Invalid callback signature");
}
await onUploadCompleted(body.payload);
return { type, response: "ok" };
}
default:
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Invalid event type");
}
}
async function retrieveClientToken(options) {
const { handleUploadUrl, pathname } = options;
const url = isAbsoluteUrl(handleUploadUrl) ? handleUploadUrl : toAbsoluteUrl(handleUploadUrl);
const event = {
type: EventTypes.generateClientToken,
payload: {
pathname,
callbackUrl: url,
clientPayload: options.clientPayload,
multipart: options.multipart
}
};
const res = await _undici.fetch.call(void 0, url, {
method: "POST",
body: JSON.stringify(event),
headers: {
"content-type": "application/json"
},
signal: options.abortSignal
});
if (!res.ok) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Failed to retrieve the client token");
}
try {
const { clientToken } = await res.json();
return clientToken;
} catch (e) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Failed to retrieve the client token");
}
}
function toAbsoluteUrl(url) {
return new URL(url, location.href).href;
}
function isAbsoluteUrl(url) {
try {
return Boolean(new URL(url));
} catch (e) {
return false;
}
}
async function generateClientTokenFromReadWriteToken({
token,
...argsWithoutToken
}) {
var _a;
if (typeof window !== "undefined") {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
'"generateClientTokenFromReadWriteToken" must be called from a server environment'
);
}
const timestamp = /* @__PURE__ */ new Date();
timestamp.setSeconds(timestamp.getSeconds() + 30);
const readWriteToken = _chunkKLNTTDLTcjs.getTokenFromOptionsOrEnv.call(void 0, { token });
const [, , , storeId = null] = readWriteToken.split("_");
if (!storeId) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
token ? "Invalid `token` parameter" : "Invalid `BLOB_READ_WRITE_TOKEN`"
);
}
const payload = Buffer.from(
JSON.stringify({
...argsWithoutToken,
validUntil: (_a = argsWithoutToken.validUntil) != null ? _a : timestamp.getTime()
})
).toString("base64");
const securedKey = await signPayload(payload, readWriteToken);
if (!securedKey) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Unable to sign client token");
}
return `vercel_blob_client_${storeId}_${Buffer.from(
`${securedKey}.${payload}`
).toString("base64")}`;
}
exports.completeMultipartUpload = completeMultipartUpload; exports.createFolder = _chunkKLNTTDLTcjs.createFolder; exports.createMultipartUpload = createMultipartUpload; exports.createMultipartUploader = createMultipartUploader; exports.generateClientTokenFromReadWriteToken = generateClientTokenFromReadWriteToken; exports.getPayloadFromClientToken = getPayloadFromClientToken; exports.handleUpload = handleUpload; exports.put = put; exports.upload = upload; exports.uploadPart = uploadPart;
//# sourceMappingURL=client.cjs.map

1
node_modules/@vercel/blob/dist/client.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

397
node_modules/@vercel/blob/dist/client.d.cts generated vendored Normal file
View file

@ -0,0 +1,397 @@
import { W as WithUploadProgress, P as PutBody, a as PutBlobResult, b as Part, C as CommonMultipartUploadOptions, c as CommonCompleteMultipartUploadOptions, B as BlobCommandOptions } from './create-folder-C02EFEPE.cjs';
export { d as createFolder } from './create-folder-C02EFEPE.cjs';
import { IncomingMessage } from 'node:http';
import 'stream';
import 'undici';
/**
* Interface for put, upload and multipart upload operations.
* This type omits all options that are encoded in the client token.
*/
interface ClientCommonCreateBlobOptions {
/**
* Whether the blob should be publicly accessible.
*/
access: 'public';
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname.
* Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
/**
* Shared interface for put and multipart operations that use client tokens.
*/
interface ClientTokenOptions {
/**
* A client token that was generated by your server using the `generateClientToken` method.
*/
token: string;
}
/**
* Shared interface for put and upload operations.
* @internal This is an internal interface not intended for direct use by consumers.
*/
interface ClientCommonPutOptions extends ClientCommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files.
* It will split the file into multiple parts, upload them in parallel and retry failed parts.
*/
multipart?: boolean;
}
/**
* Options for the client-side put operation.
*/
type ClientPutCommandOptions = ClientCommonPutOptions & ClientTokenOptions;
/**
* Uploads a file to the blob store using a client token.
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob.
* @param body - The content of your blob. Can be a string, File, Blob, Buffer or ReadableStream.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: ClientPutCommandOptions) => Promise<PutBlobResult>;
/**
* Options for creating a multipart upload from the client side.
*/
type ClientCreateMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* @internal Internal type for multipart upload options.
*/
type ClientMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonMultipartUploadOptions & WithUploadProgress;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: ClientMultipartUploadCommandOptions) => Promise<Part>;
/**
* @internal Internal type for completing multipart uploads.
*/
type ClientCompleteMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonCompleteMultipartUploadOptions;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: ClientCompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
/**
* Options for client-side upload operations.
*/
interface CommonUploadOptions {
/**
* A route that implements the `handleUpload` function for generating a client token.
*/
handleUploadUrl: string;
/**
* Additional data which will be sent to your `handleUpload` route.
*/
clientPayload?: string;
}
/**
* Options for the upload method, which handles client-side uploads.
*/
type UploadOptions = ClientCommonPutOptions & CommonUploadOptions;
/**
* Uploads a blob into your store from the client.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* If you want to upload from your server instead, check out the documentation for the put operation: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* Unlike the put method, this method does not require a client token as it will fetch one from your server.
*
* @param pathname - The pathname to upload the blob to. This includes the filename and extension.
* @param body - The contents of your blob. This has to be a supported fetch body type (string, Blob, File, ArrayBuffer, etc).
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - handleUploadUrl - (Required) A string specifying the route to call for generating client tokens for client uploads.
* - clientPayload - (Optional) A string to be sent to your handleUpload server code. Example use-case: attaching the post id an image relates to.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const upload: (pathname: string, body: PutBody, optionsInput: UploadOptions) => Promise<PutBlobResult>;
/**
* Decoded payload from a client token.
*/
type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & {
/**
* Timestamp in milliseconds when the token will expire.
*/
validUntil: number;
};
/**
* Extracts and decodes the payload from a client token.
*
* @param clientToken - The client token string to decode
* @returns The decoded payload containing token options
*/
declare function getPayloadFromClientToken(clientToken: string): DecodedClientTokenPayload;
/**
* @internal Event type constants for internal use.
*/
declare const EventTypes: {
readonly generateClientToken: "blob.generate-client-token";
readonly uploadCompleted: "blob.upload-completed";
};
/**
* Event for generating a client token for blob uploads.
* @internal This is an internal interface used by the SDK.
*/
interface GenerateClientTokenEvent {
/**
* Type identifier for the generate client token event.
*/
type: (typeof EventTypes)['generateClientToken'];
/**
* Payload containing information needed to generate a client token.
*/
payload: {
/**
* The destination path for the blob.
*/
pathname: string;
/**
* URL where upload completion callbacks will be sent.
*/
callbackUrl: string;
/**
* Whether the upload will use multipart uploading.
*/
multipart: boolean;
/**
* Additional data from the client which will be available in onBeforeGenerateToken.
*/
clientPayload: string | null;
};
}
/**
* Event that occurs when a client upload has completed.
* @internal This is an internal interface used by the SDK.
*/
interface UploadCompletedEvent {
/**
* Type identifier for the upload completed event.
*/
type: (typeof EventTypes)['uploadCompleted'];
/**
* Payload containing information about the uploaded blob.
*/
payload: {
/**
* Details about the blob that was uploaded.
*/
blob: PutBlobResult;
/**
* Optional payload that was defined during token generation.
*/
tokenPayload?: string | null;
};
}
/**
* Union type representing either a request to generate a client token or a notification that an upload completed.
*/
type HandleUploadBody = GenerateClientTokenEvent | UploadCompletedEvent;
/**
* Type representing either a Node.js IncomingMessage or a web standard Request object.
* @internal This is an internal type used by the SDK.
*/
type RequestType = IncomingMessage | Request;
/**
* Options for the handleUpload function.
*/
interface HandleUploadOptions {
/**
* The request body containing upload information.
*/
body: HandleUploadBody;
/**
* Function called before generating the client token for uploads.
*
* @param pathname - The destination path for the blob
* @param clientPayload - A string payload specified on the client when calling upload()
* @param multipart - A boolean specifying whether the file is a multipart upload
*
* @returns An object with configuration options for the client token
*/
onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'allowOverwrite' | 'cacheControlMaxAge'> & {
tokenPayload?: string | null;
}>;
/**
* Function called by Vercel Blob when the client upload finishes.
* This is useful to update your database with the blob URL that was uploaded.
*
* @param body - Contains information about the completed upload including the blob details
*/
onUploadCompleted: (body: UploadCompletedEvent['payload']) => Promise<void>;
/**
* A string specifying the read-write token to use when making requests.
* It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
*/
token?: string;
/**
* An IncomingMessage or Request object to be used to determine the action to take.
*/
request: RequestType;
}
/**
* A server-side route helper to manage client uploads. It has two responsibilities:
* 1. Generate tokens for client uploads
* 2. Listen for completed client uploads, so you can update your database with the URL of the uploaded file
*
* @param options - Configuration options for handling uploads
* - request - (Required) An IncomingMessage or Request object to be used to determine the action to take.
* - body - (Required) The request body containing upload information.
* - onBeforeGenerateToken - (Required) Function called before generating the client token for uploads.
* - onUploadCompleted - (Required) Function called by Vercel Blob when the client upload finishes.
* - token - (Optional) A string specifying the read-write token to use when making requests. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* @returns A promise that resolves to either a client token generation result or an upload completion result
*/
declare function handleUpload({ token, request, body, onBeforeGenerateToken, onUploadCompleted, }: HandleUploadOptions): Promise<{
type: 'blob.generate-client-token';
clientToken: string;
} | {
type: 'blob.upload-completed';
response: 'ok';
}>;
/**
* Generates a client token from a read-write token. This function must be called from a server environment.
* The client token contains permissions and constraints that limit what the client can do.
*
* @param options - Options for generating the client token
* - pathname - (Required) The destination path for the blob.
* - token - (Optional) A string specifying the read-write token to use. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* - onUploadCompleted - (Optional) Configuration for upload completion callback.
* - maximumSizeInBytes - (Optional) A number specifying the maximum size in bytes that can be uploaded (max 5TB).
* - allowedContentTypes - (Optional) An array of media types that are allowed to be uploaded. Wildcards are supported (text/*).
* - validUntil - (Optional) A timestamp in ms when the token will expire. Defaults to one hour from generation.
* - addRandomSuffix - (Optional) Whether to add a random suffix to the filename. Defaults to false.
* - allowOverwrite - (Optional) Whether to allow overwriting existing blobs. Defaults to false.
* - cacheControlMaxAge - (Optional) Number of seconds to configure cache duration. Defaults to one month.
* @returns A promise that resolves to the generated client token string which can be used in client-side upload operations.
*/
declare function generateClientTokenFromReadWriteToken({ token, ...argsWithoutToken }: GenerateClientTokenOptions): Promise<string>;
/**
* Options for generating a client token.
*/
interface GenerateClientTokenOptions extends BlobCommandOptions {
/**
* The destination path for the blob
*/
pathname: string;
/**
* Configuration for upload completion callback
*/
onUploadCompleted?: {
callbackUrl: string;
tokenPayload?: string | null;
};
/**
* A number specifying the maximum size in bytes that can be uploaded. The maximum is 5TB.
*/
maximumSizeInBytes?: number;
/**
* An array of strings specifying the media type that are allowed to be uploaded.
* By default, it's all content types. Wildcards are supported (text/*)
*/
allowedContentTypes?: string[];
/**
* A number specifying the timestamp in ms when the token will expire.
* By default, it's now + 1 hour.
*/
validUntil?: number;
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
export { type ClientCommonCreateBlobOptions, type ClientCreateMultipartUploadCommandOptions, type ClientPutCommandOptions, type ClientTokenOptions, type CommonUploadOptions, type DecodedClientTokenPayload, type GenerateClientTokenOptions, type HandleUploadBody, type HandleUploadOptions, type UploadOptions, completeMultipartUpload, createMultipartUpload, createMultipartUploader, generateClientTokenFromReadWriteToken, getPayloadFromClientToken, handleUpload, put, upload, uploadPart };

397
node_modules/@vercel/blob/dist/client.d.ts generated vendored Normal file
View file

@ -0,0 +1,397 @@
import { W as WithUploadProgress, P as PutBody, a as PutBlobResult, b as Part, C as CommonMultipartUploadOptions, c as CommonCompleteMultipartUploadOptions, B as BlobCommandOptions } from './create-folder-C02EFEPE.js';
export { d as createFolder } from './create-folder-C02EFEPE.js';
import { IncomingMessage } from 'node:http';
import 'stream';
import 'undici';
/**
* Interface for put, upload and multipart upload operations.
* This type omits all options that are encoded in the client token.
*/
interface ClientCommonCreateBlobOptions {
/**
* Whether the blob should be publicly accessible.
*/
access: 'public';
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname.
* Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
/**
* Shared interface for put and multipart operations that use client tokens.
*/
interface ClientTokenOptions {
/**
* A client token that was generated by your server using the `generateClientToken` method.
*/
token: string;
}
/**
* Shared interface for put and upload operations.
* @internal This is an internal interface not intended for direct use by consumers.
*/
interface ClientCommonPutOptions extends ClientCommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files.
* It will split the file into multiple parts, upload them in parallel and retry failed parts.
*/
multipart?: boolean;
}
/**
* Options for the client-side put operation.
*/
type ClientPutCommandOptions = ClientCommonPutOptions & ClientTokenOptions;
/**
* Uploads a file to the blob store using a client token.
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob.
* @param body - The content of your blob. Can be a string, File, Blob, Buffer or ReadableStream.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: ClientPutCommandOptions) => Promise<PutBlobResult>;
/**
* Options for creating a multipart upload from the client side.
*/
type ClientCreateMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* @internal Internal type for multipart upload options.
*/
type ClientMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonMultipartUploadOptions & WithUploadProgress;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: ClientMultipartUploadCommandOptions) => Promise<Part>;
/**
* @internal Internal type for completing multipart uploads.
*/
type ClientCompleteMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonCompleteMultipartUploadOptions;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: ClientCompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
/**
* Options for client-side upload operations.
*/
interface CommonUploadOptions {
/**
* A route that implements the `handleUpload` function for generating a client token.
*/
handleUploadUrl: string;
/**
* Additional data which will be sent to your `handleUpload` route.
*/
clientPayload?: string;
}
/**
* Options for the upload method, which handles client-side uploads.
*/
type UploadOptions = ClientCommonPutOptions & CommonUploadOptions;
/**
* Uploads a blob into your store from the client.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* If you want to upload from your server instead, check out the documentation for the put operation: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* Unlike the put method, this method does not require a client token as it will fetch one from your server.
*
* @param pathname - The pathname to upload the blob to. This includes the filename and extension.
* @param body - The contents of your blob. This has to be a supported fetch body type (string, Blob, File, ArrayBuffer, etc).
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - handleUploadUrl - (Required) A string specifying the route to call for generating client tokens for client uploads.
* - clientPayload - (Optional) A string to be sent to your handleUpload server code. Example use-case: attaching the post id an image relates to.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const upload: (pathname: string, body: PutBody, optionsInput: UploadOptions) => Promise<PutBlobResult>;
/**
* Decoded payload from a client token.
*/
type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & {
/**
* Timestamp in milliseconds when the token will expire.
*/
validUntil: number;
};
/**
* Extracts and decodes the payload from a client token.
*
* @param clientToken - The client token string to decode
* @returns The decoded payload containing token options
*/
declare function getPayloadFromClientToken(clientToken: string): DecodedClientTokenPayload;
/**
* @internal Event type constants for internal use.
*/
declare const EventTypes: {
readonly generateClientToken: "blob.generate-client-token";
readonly uploadCompleted: "blob.upload-completed";
};
/**
* Event for generating a client token for blob uploads.
* @internal This is an internal interface used by the SDK.
*/
interface GenerateClientTokenEvent {
/**
* Type identifier for the generate client token event.
*/
type: (typeof EventTypes)['generateClientToken'];
/**
* Payload containing information needed to generate a client token.
*/
payload: {
/**
* The destination path for the blob.
*/
pathname: string;
/**
* URL where upload completion callbacks will be sent.
*/
callbackUrl: string;
/**
* Whether the upload will use multipart uploading.
*/
multipart: boolean;
/**
* Additional data from the client which will be available in onBeforeGenerateToken.
*/
clientPayload: string | null;
};
}
/**
* Event that occurs when a client upload has completed.
* @internal This is an internal interface used by the SDK.
*/
interface UploadCompletedEvent {
/**
* Type identifier for the upload completed event.
*/
type: (typeof EventTypes)['uploadCompleted'];
/**
* Payload containing information about the uploaded blob.
*/
payload: {
/**
* Details about the blob that was uploaded.
*/
blob: PutBlobResult;
/**
* Optional payload that was defined during token generation.
*/
tokenPayload?: string | null;
};
}
/**
* Union type representing either a request to generate a client token or a notification that an upload completed.
*/
type HandleUploadBody = GenerateClientTokenEvent | UploadCompletedEvent;
/**
* Type representing either a Node.js IncomingMessage or a web standard Request object.
* @internal This is an internal type used by the SDK.
*/
type RequestType = IncomingMessage | Request;
/**
* Options for the handleUpload function.
*/
interface HandleUploadOptions {
/**
* The request body containing upload information.
*/
body: HandleUploadBody;
/**
* Function called before generating the client token for uploads.
*
* @param pathname - The destination path for the blob
* @param clientPayload - A string payload specified on the client when calling upload()
* @param multipart - A boolean specifying whether the file is a multipart upload
*
* @returns An object with configuration options for the client token
*/
onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'allowOverwrite' | 'cacheControlMaxAge'> & {
tokenPayload?: string | null;
}>;
/**
* Function called by Vercel Blob when the client upload finishes.
* This is useful to update your database with the blob URL that was uploaded.
*
* @param body - Contains information about the completed upload including the blob details
*/
onUploadCompleted: (body: UploadCompletedEvent['payload']) => Promise<void>;
/**
* A string specifying the read-write token to use when making requests.
* It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
*/
token?: string;
/**
* An IncomingMessage or Request object to be used to determine the action to take.
*/
request: RequestType;
}
/**
* A server-side route helper to manage client uploads. It has two responsibilities:
* 1. Generate tokens for client uploads
* 2. Listen for completed client uploads, so you can update your database with the URL of the uploaded file
*
* @param options - Configuration options for handling uploads
* - request - (Required) An IncomingMessage or Request object to be used to determine the action to take.
* - body - (Required) The request body containing upload information.
* - onBeforeGenerateToken - (Required) Function called before generating the client token for uploads.
* - onUploadCompleted - (Required) Function called by Vercel Blob when the client upload finishes.
* - token - (Optional) A string specifying the read-write token to use when making requests. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* @returns A promise that resolves to either a client token generation result or an upload completion result
*/
declare function handleUpload({ token, request, body, onBeforeGenerateToken, onUploadCompleted, }: HandleUploadOptions): Promise<{
type: 'blob.generate-client-token';
clientToken: string;
} | {
type: 'blob.upload-completed';
response: 'ok';
}>;
/**
* Generates a client token from a read-write token. This function must be called from a server environment.
* The client token contains permissions and constraints that limit what the client can do.
*
* @param options - Options for generating the client token
* - pathname - (Required) The destination path for the blob.
* - token - (Optional) A string specifying the read-write token to use. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* - onUploadCompleted - (Optional) Configuration for upload completion callback.
* - maximumSizeInBytes - (Optional) A number specifying the maximum size in bytes that can be uploaded (max 5TB).
* - allowedContentTypes - (Optional) An array of media types that are allowed to be uploaded. Wildcards are supported (text/*).
* - validUntil - (Optional) A timestamp in ms when the token will expire. Defaults to one hour from generation.
* - addRandomSuffix - (Optional) Whether to add a random suffix to the filename. Defaults to false.
* - allowOverwrite - (Optional) Whether to allow overwriting existing blobs. Defaults to false.
* - cacheControlMaxAge - (Optional) Number of seconds to configure cache duration. Defaults to one month.
* @returns A promise that resolves to the generated client token string which can be used in client-side upload operations.
*/
declare function generateClientTokenFromReadWriteToken({ token, ...argsWithoutToken }: GenerateClientTokenOptions): Promise<string>;
/**
* Options for generating a client token.
*/
interface GenerateClientTokenOptions extends BlobCommandOptions {
/**
* The destination path for the blob
*/
pathname: string;
/**
* Configuration for upload completion callback
*/
onUploadCompleted?: {
callbackUrl: string;
tokenPayload?: string | null;
};
/**
* A number specifying the maximum size in bytes that can be uploaded. The maximum is 5TB.
*/
maximumSizeInBytes?: number;
/**
* An array of strings specifying the media type that are allowed to be uploaded.
* By default, it's all content types. Wildcards are supported (text/*)
*/
allowedContentTypes?: string[];
/**
* A number specifying the timestamp in ms when the token will expire.
* By default, it's now + 1 hour.
*/
validUntil?: number;
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
export { type ClientCommonCreateBlobOptions, type ClientCreateMultipartUploadCommandOptions, type ClientPutCommandOptions, type ClientTokenOptions, type CommonUploadOptions, type DecodedClientTokenPayload, type GenerateClientTokenOptions, type HandleUploadBody, type HandleUploadOptions, type UploadOptions, completeMultipartUpload, createMultipartUpload, createMultipartUploader, generateClientTokenFromReadWriteToken, getPayloadFromClientToken, handleUpload, put, upload, uploadPart };

287
node_modules/@vercel/blob/dist/client.js generated vendored Normal file
View file

@ -0,0 +1,287 @@
import {
BlobError,
createCompleteMultipartUploadMethod,
createCreateMultipartUploadMethod,
createCreateMultipartUploaderMethod,
createFolder,
createPutMethod,
createUploadPartMethod,
getTokenFromOptionsOrEnv
} from "./chunk-Z56QURM6.js";
// src/client.ts
import * as crypto from "crypto";
import { fetch } from "undici";
function createPutExtraChecks(methodName) {
return function extraChecks(options) {
if (!options.token.startsWith("vercel_blob_client_")) {
throw new BlobError(`${methodName} must be called with a client token`);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.allowOverwrite !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new BlobError(
`${methodName} doesn't allow \`addRandomSuffix\`, \`cacheControlMaxAge\` or \`allowOverwrite\`. Configure these options at the server side when generating client tokens.`
);
}
};
}
var put = createPutMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`put`")
});
var createMultipartUpload = createCreateMultipartUploadMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
});
var createMultipartUploader = createCreateMultipartUploaderMethod(
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
}
);
var uploadPart = createUploadPartMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`multipartUpload`")
});
var completeMultipartUpload = createCompleteMultipartUploadMethod(
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`completeMultipartUpload`")
}
);
var upload = createPutMethod({
allowedOptions: ["contentType"],
extraChecks(options) {
if (options.handleUploadUrl === void 0) {
throw new BlobError(
"client/`upload` requires the 'handleUploadUrl' parameter"
);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.createPutExtraChecks !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new BlobError(
"client/`upload` doesn't allow `addRandomSuffix`, `cacheControlMaxAge` or `allowOverwrite`. Configure these options at the server side when generating client tokens."
);
}
},
async getToken(pathname, options) {
var _a, _b;
return retrieveClientToken({
handleUploadUrl: options.handleUploadUrl,
pathname,
clientPayload: (_a = options.clientPayload) != null ? _a : null,
multipart: (_b = options.multipart) != null ? _b : false
});
}
});
async function importKey(token) {
return globalThis.crypto.subtle.importKey(
"raw",
new TextEncoder().encode(token),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign", "verify"]
);
}
async function signPayload(payload, token) {
if (!globalThis.crypto) {
return crypto.createHmac("sha256", token).update(payload).digest("hex");
}
const signature = await globalThis.crypto.subtle.sign(
"HMAC",
await importKey(token),
new TextEncoder().encode(payload)
);
return Buffer.from(new Uint8Array(signature)).toString("hex");
}
async function verifyCallbackSignature({
token,
signature,
body
}) {
const secret = token;
if (!globalThis.crypto) {
const digest = crypto.createHmac("sha256", secret).update(body).digest("hex");
const digestBuffer = Buffer.from(digest);
const signatureBuffer = Buffer.from(signature);
return digestBuffer.length === signatureBuffer.length && crypto.timingSafeEqual(digestBuffer, signatureBuffer);
}
const verified = await globalThis.crypto.subtle.verify(
"HMAC",
await importKey(token),
hexToArrayByte(signature),
new TextEncoder().encode(body)
);
return verified;
}
function hexToArrayByte(input) {
if (input.length % 2 !== 0) {
throw new RangeError("Expected string to be an even number of characters");
}
const view = new Uint8Array(input.length / 2);
for (let i = 0; i < input.length; i += 2) {
view[i / 2] = parseInt(input.substring(i, i + 2), 16);
}
return Buffer.from(view);
}
function getPayloadFromClientToken(clientToken) {
const [, , , , encodedToken] = clientToken.split("_");
const encodedPayload = Buffer.from(encodedToken != null ? encodedToken : "", "base64").toString().split(".")[1];
const decodedPayload = Buffer.from(encodedPayload != null ? encodedPayload : "", "base64").toString();
return JSON.parse(decodedPayload);
}
var EventTypes = {
generateClientToken: "blob.generate-client-token",
uploadCompleted: "blob.upload-completed"
};
async function handleUpload({
token,
request,
body,
onBeforeGenerateToken,
onUploadCompleted
}) {
var _a, _b, _c, _d;
const resolvedToken = getTokenFromOptionsOrEnv({ token });
const type = body.type;
switch (type) {
case "blob.generate-client-token": {
const { pathname, callbackUrl, clientPayload, multipart } = body.payload;
const payload = await onBeforeGenerateToken(
pathname,
clientPayload,
multipart
);
const tokenPayload = (_a = payload.tokenPayload) != null ? _a : clientPayload;
const oneHourInSeconds = 60 * 60;
const now = /* @__PURE__ */ new Date();
const validUntil = (_b = payload.validUntil) != null ? _b : now.setSeconds(now.getSeconds() + oneHourInSeconds);
return {
type,
clientToken: await generateClientTokenFromReadWriteToken({
...payload,
token: resolvedToken,
pathname,
onUploadCompleted: {
callbackUrl,
tokenPayload
},
validUntil
})
};
}
case "blob.upload-completed": {
const signatureHeader = "x-vercel-signature";
const signature = "credentials" in request ? (_c = request.headers.get(signatureHeader)) != null ? _c : "" : (_d = request.headers[signatureHeader]) != null ? _d : "";
if (!signature) {
throw new BlobError("Missing callback signature");
}
const isVerified = await verifyCallbackSignature({
token: resolvedToken,
signature,
body: JSON.stringify(body)
});
if (!isVerified) {
throw new BlobError("Invalid callback signature");
}
await onUploadCompleted(body.payload);
return { type, response: "ok" };
}
default:
throw new BlobError("Invalid event type");
}
}
async function retrieveClientToken(options) {
const { handleUploadUrl, pathname } = options;
const url = isAbsoluteUrl(handleUploadUrl) ? handleUploadUrl : toAbsoluteUrl(handleUploadUrl);
const event = {
type: EventTypes.generateClientToken,
payload: {
pathname,
callbackUrl: url,
clientPayload: options.clientPayload,
multipart: options.multipart
}
};
const res = await fetch(url, {
method: "POST",
body: JSON.stringify(event),
headers: {
"content-type": "application/json"
},
signal: options.abortSignal
});
if (!res.ok) {
throw new BlobError("Failed to retrieve the client token");
}
try {
const { clientToken } = await res.json();
return clientToken;
} catch (e) {
throw new BlobError("Failed to retrieve the client token");
}
}
function toAbsoluteUrl(url) {
return new URL(url, location.href).href;
}
function isAbsoluteUrl(url) {
try {
return Boolean(new URL(url));
} catch (e) {
return false;
}
}
async function generateClientTokenFromReadWriteToken({
token,
...argsWithoutToken
}) {
var _a;
if (typeof window !== "undefined") {
throw new BlobError(
'"generateClientTokenFromReadWriteToken" must be called from a server environment'
);
}
const timestamp = /* @__PURE__ */ new Date();
timestamp.setSeconds(timestamp.getSeconds() + 30);
const readWriteToken = getTokenFromOptionsOrEnv({ token });
const [, , , storeId = null] = readWriteToken.split("_");
if (!storeId) {
throw new BlobError(
token ? "Invalid `token` parameter" : "Invalid `BLOB_READ_WRITE_TOKEN`"
);
}
const payload = Buffer.from(
JSON.stringify({
...argsWithoutToken,
validUntil: (_a = argsWithoutToken.validUntil) != null ? _a : timestamp.getTime()
})
).toString("base64");
const securedKey = await signPayload(payload, readWriteToken);
if (!securedKey) {
throw new BlobError("Unable to sign client token");
}
return `vercel_blob_client_${storeId}_${Buffer.from(
`${securedKey}.${payload}`
).toString("base64")}`;
}
export {
completeMultipartUpload,
createFolder,
createMultipartUpload,
createMultipartUploader,
generateClientTokenFromReadWriteToken,
getPayloadFromClientToken,
handleUpload,
put,
upload,
uploadPart
};
//# sourceMappingURL=client.js.map

1
node_modules/@vercel/blob/dist/client.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,205 @@
import { Readable } from 'stream';
import { File } from 'undici';
interface BlobCommandOptions {
/**
* Define your blob API token.
* @defaultvalue process.env.BLOB_READ_WRITE_TOKEN
*/
token?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
interface CommonCreateBlobOptions extends BlobCommandOptions {
/**
* Whether the blob should be publicly accessible. The only currently allowed value is `public`.
*/
access: 'public';
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname. Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* Number in seconds to configure the edge and browser cache. The minimum is 1 minute. There's no maximum but keep in mind that browser and edge caches will do a best effort to respect this value.
* Detailed documentation can be found here: https://vercel.com/docs/storage/vercel-blob#caching
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
/**
* Event object passed to the onUploadProgress callback.
*/
interface UploadProgressEvent {
/**
* The number of bytes uploaded.
*/
loaded: number;
/**
* The total number of bytes to upload.
*/
total: number;
/**
* The percentage of the upload that has been completed.
*/
percentage: number;
}
/**
* Callback type for tracking upload progress.
*/
type OnUploadProgressCallback = (progressEvent: UploadProgressEvent) => void;
/**
* Interface for including upload progress tracking capabilities.
*/
interface WithUploadProgress {
/**
* Callback to track the upload progress. You will receive an object with the following properties:
* - `loaded`: The number of bytes uploaded
* - `total`: The total number of bytes to upload
* - `percentage`: The percentage of the upload that has been completed
*/
onUploadProgress?: OnUploadProgressCallback;
}
declare class BlobError extends Error {
constructor(message: string);
}
/**
* Generates a download URL for a blob.
* The download URL includes a ?download=1 parameter which causes browsers to download
* the file instead of displaying it inline.
*
* @param blobUrl - The URL of the blob to generate a download URL for
* @returns A string containing the download URL with the download parameter appended
*/
declare function getDownloadUrl(blobUrl: string): string;
/**
* Result of a successful put or copy operation.
*/
interface PutBlobResult {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content-type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
}
/**
* Represents the body content for a put operation.
* Can be one of several supported types.
*/
type PutBody = string | Readable | Buffer | Blob | ArrayBuffer | ReadableStream | File;
/**
* Input format for a multipart upload part.
* Used internally for processing multipart uploads.
*/
interface PartInput {
/**
* The part number (1-based index).
*/
partNumber: number;
/**
* The content of the part.
*/
blob: PutBody;
}
/**
* Represents a single part of a multipart upload.
* This structure is used when completing a multipart upload to specify the
* uploaded parts and their order.
*/
interface Part {
/**
* The ETag value returned when the part was uploaded.
* This value is used to verify the integrity of the uploaded part.
*/
etag: string;
/**
* The part number of this part (1-based).
* This number is used to order the parts when completing the multipart upload.
*/
partNumber: number;
}
/**
* Options for completing a multipart upload.
* Used with the completeMultipartUpload method.
*/
interface CommonCompleteMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to identify which multipart upload is being completed.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
}
type CompleteMultipartUploadCommandOptions = CommonCompleteMultipartUploadOptions & CommonCreateBlobOptions;
/**
* Options for uploading a part in a multipart upload process.
* Used with the uploadPart method.
*/
interface CommonMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to associate all uploaded parts with the same multipart upload.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
/**
* A number identifying which part is being uploaded (1-based).
* This number is used to order the parts when completing the multipart upload.
* Parts must be uploaded with consecutive part numbers starting from 1.
*/
partNumber: number;
}
type UploadPartCommandOptions = CommonMultipartUploadOptions & CommonCreateBlobOptions;
interface CreateFolderResult {
pathname: string;
url: string;
}
/**
* Creates a folder in your store. Vercel Blob has no real concept of folders, our file browser on Vercel.com displays folders based on the presence of trailing slashes in the pathname. Unless you are building a file browser system, you probably don't need to use this method.
*
* Use the resulting `url` to delete the folder, just like you would delete a blob.
* @param pathname - Can be user1/ or user1/avatars/
* @param options - Additional options like `token`
*/
declare function createFolder(pathname: string, options?: BlobCommandOptions): Promise<CreateFolderResult>;
export { type BlobCommandOptions as B, type CommonMultipartUploadOptions as C, type OnUploadProgressCallback as O, type PutBody as P, type UploadPartCommandOptions as U, type WithUploadProgress as W, type PutBlobResult as a, type Part as b, type CommonCompleteMultipartUploadOptions as c, createFolder as d, type CommonCreateBlobOptions as e, BlobError as f, type CompleteMultipartUploadCommandOptions as g, getDownloadUrl as h, type UploadProgressEvent as i, type PartInput as j };

View file

@ -0,0 +1,205 @@
import { Readable } from 'stream';
import { File } from 'undici';
interface BlobCommandOptions {
/**
* Define your blob API token.
* @defaultvalue process.env.BLOB_READ_WRITE_TOKEN
*/
token?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
interface CommonCreateBlobOptions extends BlobCommandOptions {
/**
* Whether the blob should be publicly accessible. The only currently allowed value is `public`.
*/
access: 'public';
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname. Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* Number in seconds to configure the edge and browser cache. The minimum is 1 minute. There's no maximum but keep in mind that browser and edge caches will do a best effort to respect this value.
* Detailed documentation can be found here: https://vercel.com/docs/storage/vercel-blob#caching
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
/**
* Event object passed to the onUploadProgress callback.
*/
interface UploadProgressEvent {
/**
* The number of bytes uploaded.
*/
loaded: number;
/**
* The total number of bytes to upload.
*/
total: number;
/**
* The percentage of the upload that has been completed.
*/
percentage: number;
}
/**
* Callback type for tracking upload progress.
*/
type OnUploadProgressCallback = (progressEvent: UploadProgressEvent) => void;
/**
* Interface for including upload progress tracking capabilities.
*/
interface WithUploadProgress {
/**
* Callback to track the upload progress. You will receive an object with the following properties:
* - `loaded`: The number of bytes uploaded
* - `total`: The total number of bytes to upload
* - `percentage`: The percentage of the upload that has been completed
*/
onUploadProgress?: OnUploadProgressCallback;
}
declare class BlobError extends Error {
constructor(message: string);
}
/**
* Generates a download URL for a blob.
* The download URL includes a ?download=1 parameter which causes browsers to download
* the file instead of displaying it inline.
*
* @param blobUrl - The URL of the blob to generate a download URL for
* @returns A string containing the download URL with the download parameter appended
*/
declare function getDownloadUrl(blobUrl: string): string;
/**
* Result of a successful put or copy operation.
*/
interface PutBlobResult {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content-type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
}
/**
* Represents the body content for a put operation.
* Can be one of several supported types.
*/
type PutBody = string | Readable | Buffer | Blob | ArrayBuffer | ReadableStream | File;
/**
* Input format for a multipart upload part.
* Used internally for processing multipart uploads.
*/
interface PartInput {
/**
* The part number (1-based index).
*/
partNumber: number;
/**
* The content of the part.
*/
blob: PutBody;
}
/**
* Represents a single part of a multipart upload.
* This structure is used when completing a multipart upload to specify the
* uploaded parts and their order.
*/
interface Part {
/**
* The ETag value returned when the part was uploaded.
* This value is used to verify the integrity of the uploaded part.
*/
etag: string;
/**
* The part number of this part (1-based).
* This number is used to order the parts when completing the multipart upload.
*/
partNumber: number;
}
/**
* Options for completing a multipart upload.
* Used with the completeMultipartUpload method.
*/
interface CommonCompleteMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to identify which multipart upload is being completed.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
}
type CompleteMultipartUploadCommandOptions = CommonCompleteMultipartUploadOptions & CommonCreateBlobOptions;
/**
* Options for uploading a part in a multipart upload process.
* Used with the uploadPart method.
*/
interface CommonMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to associate all uploaded parts with the same multipart upload.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
/**
* A number identifying which part is being uploaded (1-based).
* This number is used to order the parts when completing the multipart upload.
* Parts must be uploaded with consecutive part numbers starting from 1.
*/
partNumber: number;
}
type UploadPartCommandOptions = CommonMultipartUploadOptions & CommonCreateBlobOptions;
interface CreateFolderResult {
pathname: string;
url: string;
}
/**
* Creates a folder in your store. Vercel Blob has no real concept of folders, our file browser on Vercel.com displays folders based on the presence of trailing slashes in the pathname. Unless you are building a file browser system, you probably don't need to use this method.
*
* Use the resulting `url` to delete the folder, just like you would delete a blob.
* @param pathname - Can be user1/ or user1/avatars/
* @param options - Additional options like `token`
*/
declare function createFolder(pathname: string, options?: BlobCommandOptions): Promise<CreateFolderResult>;
export { type BlobCommandOptions as B, type CommonMultipartUploadOptions as C, type OnUploadProgressCallback as O, type PutBody as P, type UploadPartCommandOptions as U, type WithUploadProgress as W, type PutBlobResult as a, type Part as b, type CommonCompleteMultipartUploadOptions as c, createFolder as d, type CommonCreateBlobOptions as e, BlobError as f, type CompleteMultipartUploadCommandOptions as g, getDownloadUrl as h, type UploadProgressEvent as i, type PartInput as j };

7
node_modules/@vercel/blob/dist/crypto-browser.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
export function createHmac() {
throw new Error('Not implemented');
}
export function timingSafeEqual() {
throw new Error('Not implemented');
}

232
node_modules/@vercel/blob/dist/index.cjs generated vendored Normal file
View file

@ -0,0 +1,232 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkKLNTTDLTcjs = require('./chunk-KLNTTDLT.cjs');
// src/del.ts
async function del(url, options) {
await _chunkKLNTTDLTcjs.requestApi.call(void 0,
"/delete",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ urls: Array.isArray(url) ? url : [url] }),
signal: options == null ? void 0 : options.abortSignal
},
options
);
}
// src/head.ts
async function head(url, options) {
const searchParams = new URLSearchParams({ url });
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${searchParams.toString()}`,
// HEAD can't have body as a response, so we use GET
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
size: response.size,
contentType: response.contentType,
contentDisposition: response.contentDisposition,
cacheControl: response.cacheControl,
uploadedAt: new Date(response.uploadedAt)
};
}
// src/list.ts
async function list(options) {
var _a;
const searchParams = new URLSearchParams();
if (options == null ? void 0 : options.limit) {
searchParams.set("limit", options.limit.toString());
}
if (options == null ? void 0 : options.prefix) {
searchParams.set("prefix", options.prefix);
}
if (options == null ? void 0 : options.cursor) {
searchParams.set("cursor", options.cursor);
}
if (options == null ? void 0 : options.mode) {
searchParams.set("mode", options.mode);
}
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${searchParams.toString()}`,
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
if ((options == null ? void 0 : options.mode) === "folded") {
return {
folders: (_a = response.folders) != null ? _a : [],
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
return {
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
function mapBlobResult(blobResult) {
return {
url: blobResult.url,
downloadUrl: blobResult.downloadUrl,
pathname: blobResult.pathname,
size: blobResult.size,
uploadedAt: new Date(blobResult.uploadedAt)
};
}
// src/copy.ts
async function copy(fromUrl, toPathname, options) {
if (!options) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("missing options, see usage");
}
if (options.access !== "public") {
throw new (0, _chunkKLNTTDLTcjs.BlobError)('access must be "public"');
}
if (toPathname.length > _chunkKLNTTDLTcjs.MAXIMUM_PATHNAME_LENGTH) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`pathname is too long, maximum length is ${_chunkKLNTTDLTcjs.MAXIMUM_PATHNAME_LENGTH}`
);
}
for (const invalidCharacter of _chunkKLNTTDLTcjs.disallowedPathnameCharacters) {
if (toPathname.includes(invalidCharacter)) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`pathname cannot contain "${invalidCharacter}", please encode it if needed`
);
}
}
const headers = {};
if (options.addRandomSuffix !== void 0) {
headers["x-add-random-suffix"] = options.addRandomSuffix ? "1" : "0";
}
if (options.allowOverwrite !== void 0) {
headers["x-allow-overwrite"] = options.allowOverwrite ? "1" : "0";
}
if (options.contentType) {
headers["x-content-type"] = options.contentType;
}
if (options.cacheControlMaxAge !== void 0) {
headers["x-cache-control-max-age"] = options.cacheControlMaxAge.toString();
}
const params = new URLSearchParams({ pathname: toPathname, fromUrl });
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${params.toString()}`,
{
method: "PUT",
headers,
signal: options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
contentType: response.contentType,
contentDisposition: response.contentDisposition
};
}
// src/index.ts
var put = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUpload = _chunkKLNTTDLTcjs.createCreateMultipartUploadMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUploader = _chunkKLNTTDLTcjs.createCreateMultipartUploaderMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var uploadPart = _chunkKLNTTDLTcjs.createUploadPartMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var completeMultipartUpload = _chunkKLNTTDLTcjs.createCompleteMultipartUploadMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
exports.BlobAccessError = _chunkKLNTTDLTcjs.BlobAccessError; exports.BlobClientTokenExpiredError = _chunkKLNTTDLTcjs.BlobClientTokenExpiredError; exports.BlobContentTypeNotAllowedError = _chunkKLNTTDLTcjs.BlobContentTypeNotAllowedError; exports.BlobError = _chunkKLNTTDLTcjs.BlobError; exports.BlobFileTooLargeError = _chunkKLNTTDLTcjs.BlobFileTooLargeError; exports.BlobNotFoundError = _chunkKLNTTDLTcjs.BlobNotFoundError; exports.BlobPathnameMismatchError = _chunkKLNTTDLTcjs.BlobPathnameMismatchError; exports.BlobRequestAbortedError = _chunkKLNTTDLTcjs.BlobRequestAbortedError; exports.BlobServiceNotAvailable = _chunkKLNTTDLTcjs.BlobServiceNotAvailable; exports.BlobServiceRateLimited = _chunkKLNTTDLTcjs.BlobServiceRateLimited; exports.BlobStoreNotFoundError = _chunkKLNTTDLTcjs.BlobStoreNotFoundError; exports.BlobStoreSuspendedError = _chunkKLNTTDLTcjs.BlobStoreSuspendedError; exports.BlobUnknownError = _chunkKLNTTDLTcjs.BlobUnknownError; exports.completeMultipartUpload = completeMultipartUpload; exports.copy = copy; exports.createFolder = _chunkKLNTTDLTcjs.createFolder; exports.createMultipartUpload = createMultipartUpload; exports.createMultipartUploader = createMultipartUploader; exports.del = del; exports.getDownloadUrl = _chunkKLNTTDLTcjs.getDownloadUrl; exports.head = head; exports.list = list; exports.put = put; exports.uploadPart = uploadPart;
//# sourceMappingURL=index.cjs.map

1
node_modules/@vercel/blob/dist/index.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

337
node_modules/@vercel/blob/dist/index.d.cts generated vendored Normal file
View file

@ -0,0 +1,337 @@
import { e as CommonCreateBlobOptions, W as WithUploadProgress, f as BlobError, B as BlobCommandOptions, P as PutBody, a as PutBlobResult, b as Part, U as UploadPartCommandOptions, g as CompleteMultipartUploadCommandOptions } from './create-folder-C02EFEPE.cjs';
export { O as OnUploadProgressCallback, j as PartInput, i as UploadProgressEvent, d as createFolder, h as getDownloadUrl } from './create-folder-C02EFEPE.cjs';
import 'stream';
import 'undici';
interface PutCommandOptions extends CommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* @defaultvalue false
*/
multipart?: boolean;
}
declare class BlobAccessError extends BlobError {
constructor();
}
declare class BlobContentTypeNotAllowedError extends BlobError {
constructor(message: string);
}
declare class BlobPathnameMismatchError extends BlobError {
constructor(message: string);
}
declare class BlobClientTokenExpiredError extends BlobError {
constructor();
}
declare class BlobFileTooLargeError extends BlobError {
constructor(message: string);
}
declare class BlobStoreNotFoundError extends BlobError {
constructor();
}
declare class BlobStoreSuspendedError extends BlobError {
constructor();
}
declare class BlobUnknownError extends BlobError {
constructor();
}
declare class BlobNotFoundError extends BlobError {
constructor();
}
declare class BlobServiceNotAvailable extends BlobError {
constructor();
}
declare class BlobServiceRateLimited extends BlobError {
readonly retryAfter: number;
constructor(seconds?: number);
}
declare class BlobRequestAbortedError extends BlobError {
constructor();
}
/**
* Deletes one or multiple blobs from your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#delete-a-blob
*
* @param url - Blob url or array of blob urls that identify the blobs to be deleted. You can only delete blobs that are located in a store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param options - Additional options for the request.
*/
declare function del(url: string[] | string, options?: BlobCommandOptions): Promise<void>;
/**
* Result of the head method containing metadata about a blob.
*/
interface HeadBlobResult {
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The cache control header value.
*/
cacheControl: string;
}
/**
* Fetches metadata of a blob object.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#get-blob-metadata
*
* @param url - Blob url to lookup.
* @param options - Additional options for the request.
*/
declare function head(url: string, options?: BlobCommandOptions): Promise<HeadBlobResult>;
/**
* Basic blob object information returned by the list method.
*/
interface ListBlobResultBlob {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
}
/**
* Result of the list method in expanded mode (default).
*/
interface ListBlobResult {
/**
* Array of blob objects in the store.
*/
blobs: ListBlobResultBlob[];
/**
* Pagination cursor for the next set of results, if hasMore is true.
*/
cursor?: string;
/**
* Indicates if there are more results available.
*/
hasMore: boolean;
}
/**
* Result of the list method in folded mode.
*/
interface ListFoldedBlobResult extends ListBlobResult {
/**
* Array of folder paths in the store.
*/
folders: string[];
}
/**
* Options for the list method.
*/
interface ListCommandOptions<M extends 'expanded' | 'folded' | undefined = undefined> extends BlobCommandOptions {
/**
* The maximum number of blobs to return.
* @defaultvalue 1000
*/
limit?: number;
/**
* Filters the result to only include blobs that start with this prefix.
* If used together with `mode: 'folded'`, make sure to include a trailing slash after the foldername.
*/
prefix?: string;
/**
* The cursor to use for pagination. Can be obtained from the response of a previous `list` request.
*/
cursor?: string;
/**
* Defines how the blobs are listed
* - `expanded` the blobs property contains all blobs.
* - `folded` the blobs property contains only the blobs at the root level of your store. Blobs that are located inside a folder get merged into a single entry in the folder response property.
* @defaultvalue 'expanded'
*/
mode?: M;
}
/**
* @internal Type helper to determine the return type based on the mode parameter.
*/
type ListCommandResult<M extends 'expanded' | 'folded' | undefined = undefined> = M extends 'folded' ? ListFoldedBlobResult : ListBlobResult;
/**
* Fetches a paginated list of blob objects from your store.
*
* @param options - Configuration options including:
* - token - (Optional) A string specifying the read-write token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - limit - (Optional) The maximum number of blobs to return. Defaults to 1000.
* - prefix - (Optional) Filters the result to only include blobs that start with this prefix. If used with mode: 'folded', include a trailing slash after the folder name.
* - cursor - (Optional) The cursor to use for pagination. Can be obtained from the response of a previous list request.
* - mode - (Optional) Defines how the blobs are listed. Can be 'expanded' (default) or 'folded'. In folded mode, blobs located inside a folder are merged into a single entry in the folders response property.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - blobs: An array of blob objects with size, uploadedAt, pathname, url, and downloadUrl properties
* - cursor: A string for pagination (if hasMore is true)
* - hasMore: A boolean indicating if there are more results available
* - folders: (Only in 'folded' mode) An array of folder paths
*/
declare function list<M extends 'expanded' | 'folded' | undefined = undefined>(options?: ListCommandOptions<M>): Promise<ListCommandResult<M>>;
type CopyCommandOptions = CommonCreateBlobOptions;
interface CopyBlobResult {
url: string;
downloadUrl: string;
pathname: string;
contentType: string;
contentDisposition: string;
}
/**
* Copies a blob to another location in your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#copy-a-blob
*
* @param fromUrl - The blob URL to copy. You can only copy blobs that are in the store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param toPathname - The pathname to copy the blob to. This includes the filename.
* @param options - Additional options. The copy method will not preserve any metadata configuration (e.g.: 'cacheControlMaxAge') of the source blob. If you want to copy the metadata, you need to define it here again.
*/
declare function copy(fromUrl: string, toPathname: string, options: CopyCommandOptions): Promise<CopyBlobResult>;
/**
* Uploads a blob into your store from your server.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* If you want to upload from the browser directly, or if you're hitting Vercel upload limits, check out the documentation for client uploads: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob like https://$storeId.public.blob.vercel-storage.com/$pathname.
* @param body - The content of your blob, can be a: string, File, Blob, Buffer or Stream. We support almost everything fetch supports: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#body.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to false. We recommend using this option to ensure there are no conflicts in your blob filenames.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: PutCommandOptions) => Promise<PutBlobResult>;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: UploadPartCommandOptions) => Promise<Part>;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: CompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
export { BlobAccessError, BlobClientTokenExpiredError, BlobContentTypeNotAllowedError, BlobError, BlobFileTooLargeError, BlobNotFoundError, BlobPathnameMismatchError, BlobRequestAbortedError, BlobServiceNotAvailable, BlobServiceRateLimited, BlobStoreNotFoundError, BlobStoreSuspendedError, BlobUnknownError, CompleteMultipartUploadCommandOptions, type CopyBlobResult, type CopyCommandOptions, type HeadBlobResult, type ListBlobResult, type ListBlobResultBlob, type ListCommandOptions, type ListFoldedBlobResult, Part, PutBlobResult, type PutCommandOptions, UploadPartCommandOptions, completeMultipartUpload, copy, createMultipartUpload, createMultipartUploader, del, head, list, put, uploadPart };

337
node_modules/@vercel/blob/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,337 @@
import { e as CommonCreateBlobOptions, W as WithUploadProgress, f as BlobError, B as BlobCommandOptions, P as PutBody, a as PutBlobResult, b as Part, U as UploadPartCommandOptions, g as CompleteMultipartUploadCommandOptions } from './create-folder-C02EFEPE.js';
export { O as OnUploadProgressCallback, j as PartInput, i as UploadProgressEvent, d as createFolder, h as getDownloadUrl } from './create-folder-C02EFEPE.js';
import 'stream';
import 'undici';
interface PutCommandOptions extends CommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* @defaultvalue false
*/
multipart?: boolean;
}
declare class BlobAccessError extends BlobError {
constructor();
}
declare class BlobContentTypeNotAllowedError extends BlobError {
constructor(message: string);
}
declare class BlobPathnameMismatchError extends BlobError {
constructor(message: string);
}
declare class BlobClientTokenExpiredError extends BlobError {
constructor();
}
declare class BlobFileTooLargeError extends BlobError {
constructor(message: string);
}
declare class BlobStoreNotFoundError extends BlobError {
constructor();
}
declare class BlobStoreSuspendedError extends BlobError {
constructor();
}
declare class BlobUnknownError extends BlobError {
constructor();
}
declare class BlobNotFoundError extends BlobError {
constructor();
}
declare class BlobServiceNotAvailable extends BlobError {
constructor();
}
declare class BlobServiceRateLimited extends BlobError {
readonly retryAfter: number;
constructor(seconds?: number);
}
declare class BlobRequestAbortedError extends BlobError {
constructor();
}
/**
* Deletes one or multiple blobs from your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#delete-a-blob
*
* @param url - Blob url or array of blob urls that identify the blobs to be deleted. You can only delete blobs that are located in a store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param options - Additional options for the request.
*/
declare function del(url: string[] | string, options?: BlobCommandOptions): Promise<void>;
/**
* Result of the head method containing metadata about a blob.
*/
interface HeadBlobResult {
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The cache control header value.
*/
cacheControl: string;
}
/**
* Fetches metadata of a blob object.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#get-blob-metadata
*
* @param url - Blob url to lookup.
* @param options - Additional options for the request.
*/
declare function head(url: string, options?: BlobCommandOptions): Promise<HeadBlobResult>;
/**
* Basic blob object information returned by the list method.
*/
interface ListBlobResultBlob {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
}
/**
* Result of the list method in expanded mode (default).
*/
interface ListBlobResult {
/**
* Array of blob objects in the store.
*/
blobs: ListBlobResultBlob[];
/**
* Pagination cursor for the next set of results, if hasMore is true.
*/
cursor?: string;
/**
* Indicates if there are more results available.
*/
hasMore: boolean;
}
/**
* Result of the list method in folded mode.
*/
interface ListFoldedBlobResult extends ListBlobResult {
/**
* Array of folder paths in the store.
*/
folders: string[];
}
/**
* Options for the list method.
*/
interface ListCommandOptions<M extends 'expanded' | 'folded' | undefined = undefined> extends BlobCommandOptions {
/**
* The maximum number of blobs to return.
* @defaultvalue 1000
*/
limit?: number;
/**
* Filters the result to only include blobs that start with this prefix.
* If used together with `mode: 'folded'`, make sure to include a trailing slash after the foldername.
*/
prefix?: string;
/**
* The cursor to use for pagination. Can be obtained from the response of a previous `list` request.
*/
cursor?: string;
/**
* Defines how the blobs are listed
* - `expanded` the blobs property contains all blobs.
* - `folded` the blobs property contains only the blobs at the root level of your store. Blobs that are located inside a folder get merged into a single entry in the folder response property.
* @defaultvalue 'expanded'
*/
mode?: M;
}
/**
* @internal Type helper to determine the return type based on the mode parameter.
*/
type ListCommandResult<M extends 'expanded' | 'folded' | undefined = undefined> = M extends 'folded' ? ListFoldedBlobResult : ListBlobResult;
/**
* Fetches a paginated list of blob objects from your store.
*
* @param options - Configuration options including:
* - token - (Optional) A string specifying the read-write token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - limit - (Optional) The maximum number of blobs to return. Defaults to 1000.
* - prefix - (Optional) Filters the result to only include blobs that start with this prefix. If used with mode: 'folded', include a trailing slash after the folder name.
* - cursor - (Optional) The cursor to use for pagination. Can be obtained from the response of a previous list request.
* - mode - (Optional) Defines how the blobs are listed. Can be 'expanded' (default) or 'folded'. In folded mode, blobs located inside a folder are merged into a single entry in the folders response property.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - blobs: An array of blob objects with size, uploadedAt, pathname, url, and downloadUrl properties
* - cursor: A string for pagination (if hasMore is true)
* - hasMore: A boolean indicating if there are more results available
* - folders: (Only in 'folded' mode) An array of folder paths
*/
declare function list<M extends 'expanded' | 'folded' | undefined = undefined>(options?: ListCommandOptions<M>): Promise<ListCommandResult<M>>;
type CopyCommandOptions = CommonCreateBlobOptions;
interface CopyBlobResult {
url: string;
downloadUrl: string;
pathname: string;
contentType: string;
contentDisposition: string;
}
/**
* Copies a blob to another location in your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#copy-a-blob
*
* @param fromUrl - The blob URL to copy. You can only copy blobs that are in the store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param toPathname - The pathname to copy the blob to. This includes the filename.
* @param options - Additional options. The copy method will not preserve any metadata configuration (e.g.: 'cacheControlMaxAge') of the source blob. If you want to copy the metadata, you need to define it here again.
*/
declare function copy(fromUrl: string, toPathname: string, options: CopyCommandOptions): Promise<CopyBlobResult>;
/**
* Uploads a blob into your store from your server.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* If you want to upload from the browser directly, or if you're hitting Vercel upload limits, check out the documentation for client uploads: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob like https://$storeId.public.blob.vercel-storage.com/$pathname.
* @param body - The content of your blob, can be a: string, File, Blob, Buffer or Stream. We support almost everything fetch supports: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#body.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to false. We recommend using this option to ensure there are no conflicts in your blob filenames.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: PutCommandOptions) => Promise<PutBlobResult>;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: UploadPartCommandOptions) => Promise<Part>;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: CompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
export { BlobAccessError, BlobClientTokenExpiredError, BlobContentTypeNotAllowedError, BlobError, BlobFileTooLargeError, BlobNotFoundError, BlobPathnameMismatchError, BlobRequestAbortedError, BlobServiceNotAvailable, BlobServiceRateLimited, BlobStoreNotFoundError, BlobStoreSuspendedError, BlobUnknownError, CompleteMultipartUploadCommandOptions, type CopyBlobResult, type CopyCommandOptions, type HeadBlobResult, type ListBlobResult, type ListBlobResultBlob, type ListCommandOptions, type ListFoldedBlobResult, Part, PutBlobResult, type PutCommandOptions, UploadPartCommandOptions, completeMultipartUpload, copy, createMultipartUpload, createMultipartUploader, del, head, list, put, uploadPart };

232
node_modules/@vercel/blob/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,232 @@
import {
BlobAccessError,
BlobClientTokenExpiredError,
BlobContentTypeNotAllowedError,
BlobError,
BlobFileTooLargeError,
BlobNotFoundError,
BlobPathnameMismatchError,
BlobRequestAbortedError,
BlobServiceNotAvailable,
BlobServiceRateLimited,
BlobStoreNotFoundError,
BlobStoreSuspendedError,
BlobUnknownError,
MAXIMUM_PATHNAME_LENGTH,
createCompleteMultipartUploadMethod,
createCreateMultipartUploadMethod,
createCreateMultipartUploaderMethod,
createFolder,
createPutMethod,
createUploadPartMethod,
disallowedPathnameCharacters,
getDownloadUrl,
requestApi
} from "./chunk-Z56QURM6.js";
// src/del.ts
async function del(url, options) {
await requestApi(
"/delete",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ urls: Array.isArray(url) ? url : [url] }),
signal: options == null ? void 0 : options.abortSignal
},
options
);
}
// src/head.ts
async function head(url, options) {
const searchParams = new URLSearchParams({ url });
const response = await requestApi(
`?${searchParams.toString()}`,
// HEAD can't have body as a response, so we use GET
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
size: response.size,
contentType: response.contentType,
contentDisposition: response.contentDisposition,
cacheControl: response.cacheControl,
uploadedAt: new Date(response.uploadedAt)
};
}
// src/list.ts
async function list(options) {
var _a;
const searchParams = new URLSearchParams();
if (options == null ? void 0 : options.limit) {
searchParams.set("limit", options.limit.toString());
}
if (options == null ? void 0 : options.prefix) {
searchParams.set("prefix", options.prefix);
}
if (options == null ? void 0 : options.cursor) {
searchParams.set("cursor", options.cursor);
}
if (options == null ? void 0 : options.mode) {
searchParams.set("mode", options.mode);
}
const response = await requestApi(
`?${searchParams.toString()}`,
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
if ((options == null ? void 0 : options.mode) === "folded") {
return {
folders: (_a = response.folders) != null ? _a : [],
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
return {
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
function mapBlobResult(blobResult) {
return {
url: blobResult.url,
downloadUrl: blobResult.downloadUrl,
pathname: blobResult.pathname,
size: blobResult.size,
uploadedAt: new Date(blobResult.uploadedAt)
};
}
// src/copy.ts
async function copy(fromUrl, toPathname, options) {
if (!options) {
throw new BlobError("missing options, see usage");
}
if (options.access !== "public") {
throw new BlobError('access must be "public"');
}
if (toPathname.length > MAXIMUM_PATHNAME_LENGTH) {
throw new BlobError(
`pathname is too long, maximum length is ${MAXIMUM_PATHNAME_LENGTH}`
);
}
for (const invalidCharacter of disallowedPathnameCharacters) {
if (toPathname.includes(invalidCharacter)) {
throw new BlobError(
`pathname cannot contain "${invalidCharacter}", please encode it if needed`
);
}
}
const headers = {};
if (options.addRandomSuffix !== void 0) {
headers["x-add-random-suffix"] = options.addRandomSuffix ? "1" : "0";
}
if (options.allowOverwrite !== void 0) {
headers["x-allow-overwrite"] = options.allowOverwrite ? "1" : "0";
}
if (options.contentType) {
headers["x-content-type"] = options.contentType;
}
if (options.cacheControlMaxAge !== void 0) {
headers["x-cache-control-max-age"] = options.cacheControlMaxAge.toString();
}
const params = new URLSearchParams({ pathname: toPathname, fromUrl });
const response = await requestApi(
`?${params.toString()}`,
{
method: "PUT",
headers,
signal: options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
contentType: response.contentType,
contentDisposition: response.contentDisposition
};
}
// src/index.ts
var put = createPutMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUpload = createCreateMultipartUploadMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUploader = createCreateMultipartUploaderMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var uploadPart = createUploadPartMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var completeMultipartUpload = createCompleteMultipartUploadMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
export {
BlobAccessError,
BlobClientTokenExpiredError,
BlobContentTypeNotAllowedError,
BlobError,
BlobFileTooLargeError,
BlobNotFoundError,
BlobPathnameMismatchError,
BlobRequestAbortedError,
BlobServiceNotAvailable,
BlobServiceRateLimited,
BlobStoreNotFoundError,
BlobStoreSuspendedError,
BlobUnknownError,
completeMultipartUpload,
copy,
createFolder,
createMultipartUpload,
createMultipartUploader,
del,
getDownloadUrl,
head,
list,
put,
uploadPart
};
//# sourceMappingURL=index.js.map

1
node_modules/@vercel/blob/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

11
node_modules/@vercel/blob/dist/stream-browser.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
// This file is here because Edge Functions have no support for Node.js streams by default
// It's unlikely someone would try to read/use a Node.js stream in an Edge function but we still put
// a message in case this happens
export const Readable = {
toWeb() {
throw new Error(
'Vercel Blob: Sorry, we cannot get a Readable stream in this environment. If you see this message please open an issue here: https://github.com/vercel/storage/ with details on your environment.',
);
},
};

8
node_modules/@vercel/blob/dist/undici-browser.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
// this file gets copied to the dist folder
// it makes undici work in the browser by reusing the global fetch
// it's the simplest way I've found to make http requests work in Node.js, Serverles Functions, Edge Functions, and the browser
// this should work as long as this module is used via Next.js/Webpack
// moving forward we will have to solve this problem in a more robust way
// reusing https://github.com/inrupt/universal-fetch
// or seeing how/if cross-fetch solves https://github.com/lquixada/cross-fetch/issues/69
export const fetch = globalThis.fetch.bind(globalThis);

201
node_modules/@vercel/blob/license.md generated vendored Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Vercel, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

85
node_modules/@vercel/blob/package.json generated vendored Normal file
View file

@ -0,0 +1,85 @@
{
"name": "@vercel/blob",
"version": "1.0.2",
"description": "The Vercel Blob JavaScript API client",
"homepage": "https://vercel.com/storage/blob",
"repository": {
"type": "git",
"url": "https://github.com/vercel/storage.git",
"directory": "packages/blob"
},
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./client": {
"import": "./dist/client.js",
"require": "./dist/client.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": {
"undici": "./dist/undici-browser.js",
"crypto": "./dist/crypto-browser.js",
"stream": "./dist/stream-browser.js"
},
"typesVersions": {
"*": {
"client": [
"dist/client.d.ts"
]
}
},
"files": [
"dist"
],
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"testEnvironmentOptions": {
"url": "http://localhost:3000"
}
},
"dependencies": {
"async-retry": "^1.3.3",
"is-buffer": "^2.0.5",
"is-node-process": "^1.2.0",
"throttleit": "^2.1.0",
"undici": "^5.28.4"
},
"devDependencies": {
"@edge-runtime/jest-environment": "2.3.10",
"@edge-runtime/types": "2.2.9",
"@types/async-retry": "1.4.9",
"@types/jest": "29.5.14",
"@types/node": "22.13.5",
"eslint": "8.56.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-jest": "29.2.6",
"tsup": "8.4.0",
"eslint-config-custom": "0.0.0",
"tsconfig": "0.0.0"
},
"engines": {
"node": ">=16.14"
},
"scripts": {
"build": "tsup && pnpm run copy-shims",
"copy-shims": "cp src/*-browser.js dist/",
"dev": "pnpm run copy-shims && tsup --watch --clean=false",
"lint": "eslint --max-warnings=0 .",
"prettier-check": "prettier --check .",
"publint": "npx publint",
"test": "pnpm run test:node && pnpm run test:edge && pnpm run test:browser",
"test:browser": "jest --env jsdom .browser.test.ts --setupFilesAfterEnv ./jest/setup.js",
"test:edge": "jest --env @edge-runtime/jest-environment .edge.test.ts",
"test:node": "jest --env node .node.test.ts",
"type-check": "tsc --noEmit"
}
}

856
node_modules/@vercel/build-utils/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,856 @@
# @vercel/build-utils
## 13.2.16
### Patch Changes
- Add maxConcurrency to experimentalTriggers ([#14725](https://github.com/vercel/vercel/pull/14725))
- Add maxConcurrency trigger field ([#14725](https://github.com/vercel/vercel/pull/14725))
## 13.2.15
### Patch Changes
- Optimize `getAvailableNodeVersions` to skip discontinued versions and use non-throwing `statSync` ([#14686](https://github.com/vercel/vercel/pull/14686))
## 13.2.14
### Patch Changes
- Add `experimentalServices` to `vercel.json` ([#14612](https://github.com/vercel/vercel/pull/14612))
## 13.2.13
### Patch Changes
- [python] experimental python runtime framework preset ([#14646](https://github.com/vercel/vercel/pull/14646))
## 13.2.12
### Patch Changes
- Add `findPackageJson` function for optimized package.json lookup without lockfile scanning. This improves `getNodeVersion` performance by avoiding unnecessary lockfile parsing. ([#14658](https://github.com/vercel/vercel/pull/14658))
## 13.2.10
### Patch Changes
- Add 'go' as a valid runtimeLanguage option for Lambda functions ([#14624](https://github.com/vercel/vercel/pull/14624))
## 13.2.9
### Patch Changes
- replace getRuntimeNodeVersion with getNodeVersion ([#14622](https://github.com/vercel/vercel/pull/14622))
## 13.2.8
### Patch Changes
- Remove getSpawnOptions ([#14604](https://github.com/vercel/vercel/pull/14604))
## 13.2.7
### Patch Changes
- Replace getNodeVersion with getRuntimeNodeVersion ([#14600](https://github.com/vercel/vercel/pull/14600))
- Add zero-config support for Koa.js ([#14567](https://github.com/vercel/vercel/pull/14567))
## 13.2.6
### Patch Changes
- Update http links in Node.js version incompatibility message to https ([#14583](https://github.com/vercel/vercel/pull/14583))
- Ensure internal build step runs if a build script is missing ([#14564](https://github.com/vercel/vercel/pull/14564))
## 13.2.5
### Patch Changes
- Adding in user configured deploymentId to build output type ([#14497](https://github.com/vercel/vercel/pull/14497))
- skip secondary installation for vercel.ts ([#14471](https://github.com/vercel/vercel/pull/14471))
## 13.2.4
### Patch Changes
- [python] only create api builders for `.py` files that export an app or handler ([#14493](https://github.com/vercel/vercel/pull/14493))
## 13.2.3
### Patch Changes
- Use `workspace:*` for workspace dependencies ([#14396](https://github.com/vercel/vercel/pull/14396))
## 13.2.2
### Patch Changes
- Bump NFT dependency ([#14373](https://github.com/vercel/vercel/pull/14373))
## 13.2.1
### Patch Changes
- Disables auto instrumentation when the app has manual instrumentation setup ([#14345](https://github.com/vercel/vercel/pull/14345))
## 13.2.0
### Minor Changes
- Remove env var check for node24 ([#14355](https://github.com/vercel/vercel/pull/14355))
## 13.1.2
### Patch Changes
- Support `runtimeLanguage` in build-utils ([#14344](https://github.com/vercel/vercel/pull/14344))
## 13.1.1
### Patch Changes
- Only run introspection when isExperimentalBackendsWithoutIntrospectionEnabled is truthy ([#14336](https://github.com/vercel/vercel/pull/14336))
## 13.1.0
### Minor Changes
- Remove --unsafe-perm from npm install command ([#14302](https://github.com/vercel/vercel/pull/14302))
## 13.0.2
### Patch Changes
- Improve warning messages surrounding Elysia ([#14272](https://github.com/vercel/vercel/pull/14272))
## 13.0.1
### Patch Changes
- Revert "Remove getSpawnOptions" ([#14261](https://github.com/vercel/vercel/pull/14261))
## 13.0.0
### Major Changes
- Remove getSpawnOptions ([#14176](https://github.com/vercel/vercel/pull/14176))
## 12.2.4
### Patch Changes
- Add helper for detecting backend builders ([#14182](https://github.com/vercel/vercel/pull/14182))
## 12.2.3
### Patch Changes
- Add Elysia framework ([#14164](https://github.com/vercel/vercel/pull/14164))
## 12.2.2
### Patch Changes
- Allow Node.js 24 behind env var feature flag ([#14160](https://github.com/vercel/vercel/pull/14160))
## 12.2.1
### Patch Changes
- Add backend util helpers ([#14152](https://github.com/vercel/vercel/pull/14152))
## 12.2.0
### Minor Changes
- Add support for Bun through a vercel.json property ([#14130](https://github.com/vercel/vercel/pull/14130))
## 12.1.3
### Patch Changes
- Revert the prebuilt archive split from 20MB back to 100MB ([#14103](https://github.com/vercel/vercel/pull/14103))
## 12.1.2
### Patch Changes
- Reuse duplicated node builder logic ([#14031](https://github.com/vercel/vercel/pull/14031))
## 12.1.1
### Patch Changes
- Change archive split from 100MB -> 20MB ([#14046](https://github.com/vercel/vercel/pull/14046))
## 12.1.0
### Minor Changes
- Support turbo.jsonc ([#13792](https://github.com/vercel/vercel/pull/13792))
## 12.0.0
### Major Changes
- Drop Node.js 18, bump minimum to Node.js 20 ([#13856](https://github.com/vercel/vercel/pull/13856))
## 11.0.2
### Patch Changes
- Add support for the supportsCancellation function flag ([#13807](https://github.com/vercel/vercel/pull/13807))
## 11.0.1
### Patch Changes
- Fix 404 status for /api routes when using Hono with the vercel dev server ([#13706](https://github.com/vercel/vercel/pull/13706))
## 11.0.0
### Major Changes
- Add support for vlt as a package manager ([#13591](https://github.com/vercel/vercel/pull/13591))
## 10.6.7
### Patch Changes
- Reverting support for `preferredRegion` ([#13566](https://github.com/vercel/vercel/pull/13566))
## 10.6.6
### Patch Changes
- Deprecate Node.js 18.x with warning ([#13549](https://github.com/vercel/vercel/pull/13549))
## 10.6.5
### Patch Changes
- rename experimental maxAttempts to maxDeliveries ([#13534](https://github.com/vercel/vercel/pull/13534))
## 10.6.4
### Patch Changes
- simplify experimental triggers ([#13527](https://github.com/vercel/vercel/pull/13527))
## 10.6.3
### Patch Changes
- make POST method required ([#13518](https://github.com/vercel/vercel/pull/13518))
- Update more handling for experimentalTriggers ([#13517](https://github.com/vercel/vercel/pull/13517))
## 10.6.2
### Patch Changes
- Add CloudEventTrigger support for Lambda functions ([#13503](https://github.com/vercel/vercel/pull/13503))
## 10.6.1
### Patch Changes
- next package uses @vercel/routing-utils HasField rather than redefining & stricter validation. ([#13409](https://github.com/vercel/vercel/pull/13409))
- Make architecture a defined property on Lambda classes to apply when creating ([#13398](https://github.com/vercel/vercel/pull/13398))
- [env-vars] expose VERCEL_PROJECT_ID as NEXT_PUBLIC_VERCEL_PROJECT_ID ([#13431](https://github.com/vercel/vercel/pull/13431))
## 10.6.0
### Minor Changes
- provide a more verbose error when package.json is not valid ([#13346](https://github.com/vercel/vercel/pull/13346))
- Allow configuring functions `architecture` via the `vercel.json` configuration ([#13344](https://github.com/vercel/vercel/pull/13344))
## 10.5.1
### Patch Changes
- Display warning when yarn dynamic require error may happen ([#13143](https://github.com/vercel/vercel/pull/13143))
- [build-utils] increase max memory limit ([#13162](https://github.com/vercel/vercel/pull/13162))
## 10.5.0
### Minor Changes
- Disable yarn global cache before installs so build cache caches deps ([#13144](https://github.com/vercel/vercel/pull/13144))
## 10.4.0
### Minor Changes
- Expose pnpm6 within the detected package manager path for future versions of the build container ([#13132](https://github.com/vercel/vercel/pull/13132))
## 10.3.2
### Patch Changes
- Add support for expire values in Next.js prerender manifest ([#13087](https://github.com/vercel/vercel/pull/13087))
- Detect yarn version from lockfile version ([#13118](https://github.com/vercel/vercel/pull/13118))
## 10.3.1
### Patch Changes
- Parse yarn.lock file version ([#13114](https://github.com/vercel/vercel/pull/13114))
- [env-vars] expose VERCEL_DEPLOYMENT_ID as NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID ([#13115](https://github.com/vercel/vercel/pull/13115))
- Fix vitest-e2e glob to include integration.test.ts ([#13097](https://github.com/vercel/vercel/pull/13097))
## 10.3.0
### Minor Changes
- Delay pnpm@10 preferred date ([#13100](https://github.com/vercel/vercel/pull/13100))
### Patch Changes
- Type-check tests ([#13096](https://github.com/vercel/vercel/pull/13096))
## 10.2.0
### Minor Changes
- Detect v9 pnpm lock files as pnpm 10 for new projects ([#13072](https://github.com/vercel/vercel/pull/13072))
### Patch Changes
- Improve build log messages surrounding pnpm 10 ([#13088](https://github.com/vercel/vercel/pull/13088))
- [build-utils] extract checkIfAlreadyInstalled helper to clarify intent ([#13060](https://github.com/vercel/vercel/pull/13060))
- Allow pnpm 10 to use package.json#packageManager without an engines error ([#13083](https://github.com/vercel/vercel/pull/13083))
## 10.1.0
### Minor Changes
- [envs] add `VERCEL_TARGET_ENV` to prefixed env vars ([#13069](https://github.com/vercel/vercel/pull/13069))
## 10.0.1
### Patch Changes
- [build-utils] Move `runNpmInstallSema` closer to where it's used ([#13061](https://github.com/vercel/vercel/pull/13061))
- [build-utils] extract getInstallCommandForPackageManager to module scope ([#13058](https://github.com/vercel/vercel/pull/13058))
- [build-utils] remove redundant sema release ([#13059](https://github.com/vercel/vercel/pull/13059))
- Revert support pnpm 10 ([#13064](https://github.com/vercel/vercel/pull/13064))
## 10.0.0
### Major Changes
- Detect v9 pnpm lockfiles as pnpm 10 generated ([#12852](https://github.com/vercel/vercel/pull/12852))
## 9.3.1
### Patch Changes
- [build-utils] extract install command specific logic into helper ([#13049](https://github.com/vercel/vercel/pull/13049))
- [build-utils] remove dead node 16 check ([#13047](https://github.com/vercel/vercel/pull/13047))
## 9.3.0
### Minor Changes
- Support process tracing ([#12894](https://github.com/vercel/vercel/pull/12894))
## 9.2.1
### Patch Changes
- Add tracer utility to @vercel/build-utils ([#13013](https://github.com/vercel/vercel/pull/13013))
## 9.2.0
### Minor Changes
- Add .yarn/cache to build cache ([#12961](https://github.com/vercel/vercel/pull/12961))
## 9.1.1
### Patch Changes
- [cli] shift node 16 deprecation date to 2025-02-03 ([#12981](https://github.com/vercel/vercel/pull/12981))
## 9.1.0
### Minor Changes
- Add `useWebApi` property to `NodejsLambda` class ([#12873](https://github.com/vercel/vercel/pull/12873))
- [build-utils] convert NodeVersion to class and add state getter ([#12883](https://github.com/vercel/vercel/pull/12883))
[ruby] convert RubyVersion to class and add state getter
## 9.0.1
### Patch Changes
- Revert build utils refactor ([#12818](https://github.com/vercel/vercel/pull/12818))
## 9.0.0
### Major Changes
- Change getPathOverrideForPackageManager() to use detectedLockfile argument ([#12813](https://github.com/vercel/vercel/pull/12813))
### Patch Changes
- Refactor build-util usage to reuse detected lockfile ([#12813](https://github.com/vercel/vercel/pull/12813))
- add support for `images.qualities` ([#12813](https://github.com/vercel/vercel/pull/12813))
## 8.8.0
### Minor Changes
- Add bun detection using bun.lock ([#12740](https://github.com/vercel/vercel/pull/12740))
## 8.7.0
### Minor Changes
- Support splitting archive deployments in parts. ([#12671](https://github.com/vercel/vercel/pull/12671))
## 8.6.0
### Minor Changes
- Add support for `NOW_EPHEMERAL_FILES_S3_URL`, `NOW_FILES_CLOUDFRONT_URL` and `NOW_FILES_S3_URL` environment variables ([#12643](https://github.com/vercel/vercel/pull/12643))
## 8.5.0
### Minor Changes
- Remove `VERCEL_ALLOW_NODEJS22` env var check ([#12614](https://github.com/vercel/vercel/pull/12614))
## 8.4.12
### Patch Changes
- Support allowHeader from Next.js for filtering request headers during revalidation ([#12420](https://github.com/vercel/vercel/pull/12420))
## 8.4.11
### Patch Changes
- Improve parsing of `turbo.json` ([#12266](https://github.com/vercel/vercel/pull/12266))
- Fix corepack `packageManager` detection on monorepos ([#12258](https://github.com/vercel/vercel/pull/12258))
## 8.4.10
### Patch Changes
- Parse `turbo.json` as json5 ([#12259](https://github.com/vercel/vercel/pull/12259))
## 8.4.9
### Patch Changes
- Fix special version specifier handling for `turbo` ([#12249](https://github.com/vercel/vercel/pull/12249))
## 8.4.8
### Patch Changes
- Revert "[build-utils] Fix corepack `packageManager` detection on monorepos" ([#12242](https://github.com/vercel/vercel/pull/12242))
## 8.4.7
### Patch Changes
- Disable corepack when Turborepo does not support `COREPACK_HOME` ([#12211](https://github.com/vercel/vercel/pull/12211))
- Fix corepack `packageManager` detection on monorepos ([#12219](https://github.com/vercel/vercel/pull/12219))
## 8.4.6
### Patch Changes
- add support for `images.localPatterns` ([#12195](https://github.com/vercel/vercel/pull/12195))
## 8.4.5
### Patch Changes
- [build-utils] add types for `images.remotePatterns.search` to vercel.json ([#12158](https://github.com/vercel/vercel/pull/12158))
## 8.4.4
### Patch Changes
- Allow Node.js v22 behind env var feature flag ([#12159](https://github.com/vercel/vercel/pull/12159))
## 8.4.3
### Patch Changes
- Introduce new chain configuration types for Partial Prerendering ([#12063](https://github.com/vercel/vercel/pull/12063))
## 8.4.2
### Patch Changes
- Revert "Revert "Revert "Fix corepack `packageManager` detection on monorepos""" ([#12099](https://github.com/vercel/vercel/pull/12099))
## 8.4.1
### Patch Changes
- Revert "Revert "Fix corepack `packageManager` detection on monorepos"" ([#11871](https://github.com/vercel/vercel/pull/11871))
## 8.4.0
### Minor Changes
- Change warnings to errors in invalid corepack package manager states ([#12062](https://github.com/vercel/vercel/pull/12062))
## 8.3.9
### Patch Changes
- Provide help when users get ERR_PNPM_UNSUPPORTED_ENGINE errors without corepack ([#12034](https://github.com/vercel/vercel/pull/12034))
- Fix package-manager-warning-1 to happen only happen in correct cases ([#12050](https://github.com/vercel/vercel/pull/12050))
## 8.3.8
### Patch Changes
- Limit `package.json#packageManager` parsing to concrete versions ([#12025](https://github.com/vercel/vercel/pull/12025))
- Catch PNPM_UNSUPPORTED_ENGINE when corepack is enabled and throw a more helpful error ([#12017](https://github.com/vercel/vercel/pull/12017))
## 8.3.7
### Patch Changes
- Revert "Revert "warn on mismatched corepack and detected package managers"" ([#11887](https://github.com/vercel/vercel/pull/11887))
## 8.3.6
### Patch Changes
- Remove implicit reliance on `@types/glob` for downstream consumers ([#11914](https://github.com/vercel/vercel/pull/11914))
## 8.3.5
### Patch Changes
- Revert "warn on mismatched corepack and detected package managers" ([#11879](https://github.com/vercel/vercel/pull/11879))
## 8.3.4
### Patch Changes
- Revert "Fix corepack `packageManager` detection on monorepos" ([#11865](https://github.com/vercel/vercel/pull/11865))
## 8.3.3
### Patch Changes
- Fix corepack `packageManager` detection on monorepos ([#11811](https://github.com/vercel/vercel/pull/11811))
## 8.3.2
### Patch Changes
- reject mismatched corepack and detected package managers ([#11603](https://github.com/vercel/vercel/pull/11603))
## 8.3.1
### Patch Changes
- Add build callback handling ([#11807](https://github.com/vercel/vercel/pull/11807))
## 8.3.0
### Minor Changes
- Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](https://github.com/vercel/vercel/pull/11653))
Implements the diagnostics step in the `next` builder.
### Patch Changes
- Add resolved node version range to warning message ([#11742](https://github.com/vercel/vercel/pull/11742))
## 8.2.2
### Patch Changes
- Change node 16.x EOL for Vercel ([#11704](https://github.com/vercel/vercel/pull/11704))
- Improve error message and refactor ([#11706](https://github.com/vercel/vercel/pull/11706))
- [built-utils] Handle case of not having lockfile when corepack is enabled ([#11697](https://github.com/vercel/vercel/pull/11697))
## 8.2.1
### Patch Changes
- [node] update node@16 deprecation day ([#11671](https://github.com/vercel/vercel/pull/11671))
## 8.2.0
### Minor Changes
- fix corepack detection for package manager version determination ([#11596](https://github.com/vercel/vercel/pull/11596))
### Patch Changes
- Fix triggering of ignored project settings node version warning ([#11550](https://github.com/vercel/vercel/pull/11550))
## 8.1.3
### Patch Changes
- [build-utils] log more around package manager detection ([#11594](https://github.com/vercel/vercel/pull/11594))
## 8.1.2
### Patch Changes
- add log to package manager version detection ([#11592](https://github.com/vercel/vercel/pull/11592))
## 8.1.1
### Patch Changes
- [build-utils] pnpm lockfile testing and fixing ([#11591](https://github.com/vercel/vercel/pull/11591))
## 8.1.0
### Minor Changes
- Update pnpm version detection logic ([#11445](https://github.com/vercel/vercel/pull/11445))
Add support for pnpm 9
## 8.0.0
### Major Changes
- Remove legacy `avoidTopLevelInstall` logic ([#11513](https://github.com/vercel/vercel/pull/11513))
### Patch Changes
- [build-utils] Add `VERCEL_PROJECT_PRODUCTION_URL` framework env var prefix ([#11506](https://github.com/vercel/vercel/pull/11506))
## 7.12.0
### Minor Changes
- Trigger release ([#11465](https://github.com/vercel/vercel/pull/11465))
## 7.11.0
### Minor Changes
- Add `getOsRelease()` and `getProvidedRuntime()` functions ([#11370](https://github.com/vercel/vercel/pull/11370))
## 7.10.0
### Minor Changes
- Allow environment variables to be specified for `EdgeFunction` ([#11029](https://github.com/vercel/vercel/pull/11029))
## 7.9.1
### Patch Changes
- Export `getSupportedNodeVersion` ([#11277](https://github.com/vercel/vercel/pull/11277))
## 7.9.0
### Minor Changes
- Add `base` parameter to `scanParentDirs()` ([#11261](https://github.com/vercel/vercel/pull/11261))
## 7.8.0
### Minor Changes
- Remove `VERCEL_ENABLE_NPM_DEFAULT` env var check ([#11242](https://github.com/vercel/vercel/pull/11242))
### Patch Changes
- Rename variants to flags and remove legacy flags ([#11121](https://github.com/vercel/vercel/pull/11121))
## 7.7.1
### Patch Changes
- [build-utils] increase max memory limit ([#11209](https://github.com/vercel/vercel/pull/11209))
## 7.7.0
### Minor Changes
- Revert "Revert "Default ruby to only currently supported version (3.2.0)"" ([#11137](https://github.com/vercel/vercel/pull/11137))
## 7.6.0
### Minor Changes
- Revert "Default ruby to only currently supported version (3.2.0)" ([#11135](https://github.com/vercel/vercel/pull/11135))
- Mark `flags` as deprecated and replace them with `variants` ([#11098](https://github.com/vercel/vercel/pull/11098))
- [build-utils] change default package manager when no lockfile detected from `yarn` to `npm` (gated behind feature flag) ([#11131](https://github.com/vercel/vercel/pull/11131))
### Patch Changes
- Update internal type for variants ([#11111](https://github.com/vercel/vercel/pull/11111))
## 7.5.1
### Patch Changes
- Add experimental field to Lambda and size to FileFsRef output ([#11059](https://github.com/vercel/vercel/pull/11059))
## 7.5.0
### Minor Changes
- Deprecate `EdgeFunction#name` property ([#11010](https://github.com/vercel/vercel/pull/11010))
## 7.4.1
### Patch Changes
- Extend Node v16 discontinue date to 2024-06-15 ([#10967](https://github.com/vercel/vercel/pull/10967))
## 7.4.0
### Minor Changes
- Adds new helper `getPathForPackageManager()` ([#10918](https://github.com/vercel/vercel/pull/10918))
## 7.3.0
### Minor Changes
- [cli] add `--deprecated` option to `vc project ls` command ([#10919](https://github.com/vercel/vercel/pull/10919))
## 7.2.5
### Patch Changes
- Remove Node.js v20 env var check ([#10834](https://github.com/vercel/vercel/pull/10834))
## 7.2.4
### Patch Changes
- Select Node.js version based on what's available in build-container ([#10822](https://github.com/vercel/vercel/pull/10822))
## 7.2.3
### Patch Changes
- Add experimental flag to allow Node.js v20 ([#10802](https://github.com/vercel/vercel/pull/10802))
## 7.2.2
### Patch Changes
- [cli] Update bun detection and add tests for projects with both bunlock binary and yarn.lock text files ([#10583](https://github.com/vercel/vercel/pull/10583))
## 7.2.1
### Patch Changes
- Internal variants ([#10549](https://github.com/vercel/vercel/pull/10549))
## 7.2.0
### Minor Changes
- Add new optional prerender field: experimentalStreamingLambdaPath ([#10476](https://github.com/vercel/vercel/pull/10476))
- [build-utils] Add zero config detection for bun package manager ([#10486](https://github.com/vercel/vercel/pull/10486))
### Patch Changes
- add `experimentalBypassFor` field to Prerender ([#10481](https://github.com/vercel/vercel/pull/10481))
## 7.1.1
### Patch Changes
- add descriptions to NodeVersion properties ([#10403](https://github.com/vercel/vercel/pull/10403))
- Updated semver dependency ([#10411](https://github.com/vercel/vercel/pull/10411))
## 7.1.0
### Minor Changes
- Support serverless function architecture ([#10392](https://github.com/vercel/vercel/pull/10392))
## 7.0.0
### Major Changes
- BREAKING CHANGE: Drop Node.js 14, bump minimum to Node.js 16 ([#10369](https://github.com/vercel/vercel/pull/10369))
## 6.8.3
### Patch Changes
- Fix `getPrefixedEnvVars()` to handle `VERCEL_BRANCH_URL` ([#10315](https://github.com/vercel/vercel/pull/10315))
## 6.8.2
### Patch Changes
- Push back `nodejs16.x` discontinue date to `2024-02-06` ([#10209](https://github.com/vercel/vercel/pull/10209))
## 6.8.1
### Patch Changes
- Revert "[build-utils] Allow file-ref sema to be controlled through env flag" ([#10167](https://github.com/vercel/vercel/pull/10167))
## 6.8.0
### Minor Changes
- Add `getNodeBinPaths()` and `traverseUpDirectories()` functions ([#10150](https://github.com/vercel/vercel/pull/10150))
## 6.7.5
### Patch Changes
- Publish missing build-utils ([`cd35071f6`](https://github.com/vercel/vercel/commit/cd35071f609d615d47bc04634c123b33768436cb))
## 6.7.4
### Patch Changes
- Remove usage of `env` from Edge Functions and Middleware ([#10018](https://github.com/vercel/vercel/pull/10018))
## 6.7.3
### Patch Changes
- Deprecate Node.js 14.x and 16.x with warning ([#9976](https://github.com/vercel/vercel/pull/9976))

202
node_modules/@vercel/build-utils/LICENSE generated vendored Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 Vercel, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

3
node_modules/@vercel/build-utils/build.mjs generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { tsc, esbuild } from '../../utils/build.mjs';
await Promise.all([tsc(), esbuild().then(() => esbuild({ bundle: true }))]);

10
node_modules/@vercel/build-utils/dist/clone-env.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import type { Env } from './types';
/**
* Clones zero or more objects into a single new object while ensuring that the
* `PATH` environment variable is defined when the `PATH` or `Path` environment
* variables are defined.
*
* @param {Object} [...envs] Objects and/or `process.env` to clone and merge
* @returns {Object} The new object
*/
export declare function cloneEnv(...envs: (Env | undefined)[]): Env;

43
node_modules/@vercel/build-utils/dist/clone-env.js generated vendored Normal file
View file

@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var clone_env_exports = {};
__export(clone_env_exports, {
cloneEnv: () => cloneEnv
});
module.exports = __toCommonJS(clone_env_exports);
const { hasOwnProperty } = Object.prototype;
function cloneEnv(...envs) {
return envs.reduce((obj, env) => {
if (env === void 0 || env === null) {
return obj;
}
obj = Object.assign(obj, env);
if (hasOwnProperty.call(env, "Path")) {
if (obj.Path !== void 0) {
obj.PATH = obj.Path;
}
delete obj.Path;
}
return obj;
}, {});
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
cloneEnv
});

1
node_modules/@vercel/build-utils/dist/debug.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export default function debug(message: string, ...additional: any[]): void;

31
node_modules/@vercel/build-utils/dist/debug.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var debug_exports = {};
__export(debug_exports, {
default: () => debug
});
module.exports = __toCommonJS(debug_exports);
var import_get_platform_env = require("./get-platform-env");
function debug(message, ...additional) {
if ((0, import_get_platform_env.getPlatformEnv)("BUILDER_DEBUG")) {
console.log(message, ...additional);
} else if (process.env.VERCEL_DEBUG_PREFIX) {
console.log(`${process.env.VERCEL_DEBUG_PREFIX}${message}`, ...additional);
}
}

View file

@ -0,0 +1 @@
export declare const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";

View file

@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var default_cache_path_glob_exports = {};
__export(default_cache_path_glob_exports, {
defaultCachePathGlob: () => defaultCachePathGlob
});
module.exports = __toCommonJS(default_cache_path_glob_exports);
const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
defaultCachePathGlob
});

View file

@ -0,0 +1,41 @@
import type { Env, Files, FunctionFramework } from './types';
/**
* An Edge Functions output
*/
export declare class EdgeFunction {
type: 'EdgeFunction';
/**
* A display name for the edge function.
* @deprecated This property should no longer be used. The name is inferred from the URL path of the function.
*/
name?: string;
/**
* The deployment target.
* Only `v8-worker` is currently supported.
*/
deploymentTarget: 'v8-worker';
/**
* The entrypoint for the edge function.
*/
entrypoint: string;
/**
* Environment variables for the edge function to use at runtime.
*/
environment?: Env;
/**
* The list of files to be included in the edge function bundle.
*/
files: Files;
/**
* Extra binary files to be included in the edge function
*/
assets?: {
name: string;
path: string;
}[];
/** The regions where the edge function will be executed on */
regions?: string | string[];
/** The framework */
framework?: FunctionFramework;
constructor(params: Omit<EdgeFunction, 'type'>);
}

40
node_modules/@vercel/build-utils/dist/edge-function.js generated vendored Normal file
View file

@ -0,0 +1,40 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var edge_function_exports = {};
__export(edge_function_exports, {
EdgeFunction: () => EdgeFunction
});
module.exports = __toCommonJS(edge_function_exports);
class EdgeFunction {
constructor(params) {
this.type = "EdgeFunction";
this.name = params.name;
this.deploymentTarget = params.deploymentTarget;
this.entrypoint = params.entrypoint;
this.files = params.files;
this.assets = params.assets;
this.regions = params.regions;
this.framework = params.framework;
this.environment = params.environment;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
EdgeFunction
});

39
node_modules/@vercel/build-utils/dist/errors.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
/**
* This error should be thrown from a Builder in
* order to stop the build and print a message.
* This is necessary to avoid printing a stack trace.
*/
export declare class NowBuildError extends Error {
hideStackTrace: boolean;
code: string;
link?: string;
action?: string;
constructor({ message, code, link, action }: Props);
}
interface Props {
/**
* The error message to display to the end-user.
* Should be short yet descriptive of what they did wrong.
*/
message: string;
/**
* A unique error code for this particular error.
* Should start with the builder name such as `NODE_`.
*/
code: string;
/**
* Optional hyperlink starting with https://vercel.com to
* link to more information about this error.
*/
link?: string;
/**
* Optional "action" to display before the `link`, such as "Learn More".
*/
action?: string;
}
export declare function getPrettyError(obj: {
dataPath?: string;
message?: string;
params: any;
}): NowBuildError;
export {};

95
node_modules/@vercel/build-utils/dist/errors.js generated vendored Normal file
View file

@ -0,0 +1,95 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var errors_exports = {};
__export(errors_exports, {
NowBuildError: () => NowBuildError,
getPrettyError: () => getPrettyError
});
module.exports = __toCommonJS(errors_exports);
class NowBuildError extends Error {
constructor({ message, code, link, action }) {
super(message);
this.hideStackTrace = true;
this.code = code;
this.link = link;
this.action = action;
}
}
function getPrettyError(obj) {
const docsUrl = "https://vercel.com/docs/concepts/projects/project-configuration";
try {
const { dataPath, params, message: ajvMessage } = obj;
const prop = getTopLevelPropertyName(dataPath);
let message = dataPath && dataPath.startsWith(".") ? `\`${dataPath.slice(1)}\` ` : "";
if (params && typeof params.additionalProperty === "string") {
const suggestion = getSuggestion(prop, params.additionalProperty);
message += `should NOT have additional property \`${params.additionalProperty}\`. ${suggestion}`;
} else if (params && typeof params.missingProperty === "string") {
message += `missing required property \`${params.missingProperty}\`.`;
} else {
message += `${ajvMessage}.`;
}
return new NowBuildError({
code: "INVALID_VERCEL_CONFIG",
message,
link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
action: "View Documentation"
});
} catch (e) {
return new NowBuildError({
code: "INVALID_VERCEL_CONFIG",
message: `Failed to validate configuration.`,
link: docsUrl,
action: "View Documentation"
});
}
}
function getTopLevelPropertyName(dataPath) {
if (dataPath && dataPath.startsWith(".")) {
const lastIndex = dataPath.indexOf("[");
return lastIndex > -1 ? dataPath.slice(1, lastIndex) : dataPath.slice(1);
}
return "";
}
const mapTypoToSuggestion = {
"": {
builder: "builds",
"build.env": '{ "build": { "env": {"name": "value"} } }',
"builds.env": '{ "build": { "env": {"name": "value"} } }'
},
rewrites: { src: "source", dest: "destination" },
redirects: { src: "source", dest: "destination", status: "statusCode" },
headers: { src: "source", header: "headers" },
routes: {
source: "src",
destination: "dest",
header: "headers",
method: "methods"
}
};
function getSuggestion(topLevelProp, additionalProperty) {
const choices = mapTypoToSuggestion[topLevelProp];
const choice = choices ? choices[additionalProperty] : void 0;
return choice ? `Did you mean \`${choice}\`?` : "Please remove it.";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NowBuildError,
getPrettyError
});

24
node_modules/@vercel/build-utils/dist/file-blob.d.ts generated vendored Normal file
View file

@ -0,0 +1,24 @@
/// <reference types="node" />
/// <reference types="node" />
import { FileBase } from './types';
interface FileBlobOptions {
mode?: number;
contentType?: string;
data: string | Buffer;
}
interface FromStreamOptions {
mode?: number;
contentType?: string;
stream: NodeJS.ReadableStream;
}
export default class FileBlob implements FileBase {
type: 'FileBlob';
mode: number;
data: string | Buffer;
contentType: string | undefined;
constructor({ mode, contentType, data }: FileBlobOptions);
static fromStream({ mode, contentType, stream, }: FromStreamOptions): Promise<FileBlob>;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export {};

67
node_modules/@vercel/build-utils/dist/file-blob.js generated vendored Normal file
View file

@ -0,0 +1,67 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_blob_exports = {};
__export(file_blob_exports, {
default: () => FileBlob
});
module.exports = __toCommonJS(file_blob_exports);
var import_assert = __toESM(require("assert"));
var import_into_stream = __toESM(require("into-stream"));
class FileBlob {
constructor({ mode = 33188, contentType, data }) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof data === "string" || Buffer.isBuffer(data));
this.type = "FileBlob";
this.mode = mode;
this.contentType = contentType;
this.data = data;
}
static async fromStream({
mode = 33188,
contentType,
stream
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof stream.pipe === "function");
const chunks = [];
await new Promise((resolve, reject) => {
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
stream.on("error", (error) => reject(error));
stream.on("end", () => resolve());
});
const data = Buffer.concat(chunks);
return new FileBlob({ mode, contentType, data });
}
async toStreamAsync() {
return this.toStream();
}
toStream() {
return (0, import_into_stream.default)(this.data);
}
}

27
node_modules/@vercel/build-utils/dist/file-fs-ref.d.ts generated vendored Normal file
View file

@ -0,0 +1,27 @@
/// <reference types="node" />
import { FileBase } from './types';
interface FileFsRefOptions {
mode?: number;
contentType?: string;
fsPath: string;
size?: number;
}
interface FromStreamOptions {
mode: number;
contentType?: string;
stream: NodeJS.ReadableStream;
fsPath: string;
}
declare class FileFsRef implements FileBase {
type: 'FileFsRef';
mode: number;
fsPath: string;
size?: number;
contentType: string | undefined;
constructor({ mode, contentType, fsPath, size, }: FileFsRefOptions);
static fromFsPath({ mode, contentType, fsPath, size, }: FileFsRefOptions): Promise<FileFsRef>;
static fromStream({ mode, contentType, stream, fsPath, }: FromStreamOptions): Promise<FileFsRef>;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export default FileFsRef;

113
node_modules/@vercel/build-utils/dist/file-fs-ref.js generated vendored Normal file
View file

@ -0,0 +1,113 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_fs_ref_exports = {};
__export(file_fs_ref_exports, {
default: () => file_fs_ref_default
});
module.exports = __toCommonJS(file_fs_ref_exports);
var import_assert = __toESM(require("assert"));
var import_fs_extra = __toESM(require("fs-extra"));
var import_multistream = __toESM(require("multistream"));
var import_path = __toESM(require("path"));
var import_async_sema = __toESM(require("async-sema"));
const semaToPreventEMFILE = new import_async_sema.default(20);
class FileFsRef {
constructor({
mode = 33188,
contentType,
fsPath,
size
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof fsPath === "string");
this.type = "FileFsRef";
this.mode = mode;
this.contentType = contentType;
this.fsPath = fsPath;
this.size = size;
}
static async fromFsPath({
mode,
contentType,
fsPath,
size
}) {
let m = mode;
let s = size;
if (!m || typeof s === "undefined") {
const stat = await import_fs_extra.default.lstat(fsPath);
m = stat.mode;
s = stat.size;
}
return new FileFsRef({ mode: m, contentType, fsPath, size: s });
}
static async fromStream({
mode = 33188,
contentType,
stream,
fsPath
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof stream.pipe === "function");
(0, import_assert.default)(typeof fsPath === "string");
await import_fs_extra.default.mkdirp(import_path.default.dirname(fsPath));
await new Promise((resolve, reject) => {
const dest = import_fs_extra.default.createWriteStream(fsPath, {
mode: mode & 511
});
stream.pipe(dest);
stream.on("error", reject);
dest.on("finish", resolve);
dest.on("error", reject);
});
return FileFsRef.fromFsPath({ mode, contentType, fsPath });
}
async toStreamAsync() {
await semaToPreventEMFILE.acquire();
const release = () => semaToPreventEMFILE.release();
const stream = import_fs_extra.default.createReadStream(this.fsPath);
stream.on("close", release);
stream.on("error", release);
return stream;
}
toStream() {
let flag = false;
return (0, import_multistream.default)((cb) => {
if (flag)
return cb(null, null);
flag = true;
this.toStreamAsync().then((stream) => {
cb(null, stream);
}).catch((error) => {
cb(error, null);
});
});
}
}
var file_fs_ref_default = FileFsRef;

38
node_modules/@vercel/build-utils/dist/file-ref.d.ts generated vendored Normal file
View file

@ -0,0 +1,38 @@
/// <reference types="node" />
import { FileBase } from './types';
interface FileRefOptions {
mode?: number;
digest: string;
contentType?: string;
mutable?: boolean;
}
export default class FileRef implements FileBase {
type: 'FileRef';
mode: number;
digest: string;
contentType: string | undefined;
private mutable;
constructor({ mode, digest, contentType, mutable, }: FileRefOptions);
/**
* Retrieves the URL of the CloudFront distribution for the S3
* bucket represented by {@link getNowFilesS3Url}.
*
* @returns The URL of the CloudFront distribution
*/
private getNowFilesCloudfrontUrl;
/**
* Retrieves the URL of the S3 bucket for storing ephemeral files.
*
* @returns The URL of the S3 bucket
*/
private getNowEphemeralFilesS3Url;
/**
* Retrieves the URL of the S3 bucket for storing files.
*
* @returns The URL of the S3 bucket
*/
private getNowFilesS3Url;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export {};

147
node_modules/@vercel/build-utils/dist/file-ref.js generated vendored Normal file
View file

@ -0,0 +1,147 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_ref_exports = {};
__export(file_ref_exports, {
default: () => FileRef
});
module.exports = __toCommonJS(file_ref_exports);
var import_assert = __toESM(require("assert"));
var import_node_fetch = __toESM(require("node-fetch"));
var import_multistream = __toESM(require("multistream"));
var import_async_retry = __toESM(require("async-retry"));
var import_async_sema = __toESM(require("async-sema"));
const semaToDownloadFromS3 = new import_async_sema.default(5);
class BailableError extends Error {
constructor(...args) {
super(...args);
this.bail = false;
}
}
class FileRef {
constructor({
mode = 33188,
digest,
contentType,
mutable = false
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof digest === "string");
this.type = "FileRef";
this.mode = mode;
this.digest = digest;
this.contentType = contentType;
this.mutable = mutable;
}
/**
* Retrieves the URL of the CloudFront distribution for the S3
* bucket represented by {@link getNowFilesS3Url}.
*
* @returns The URL of the CloudFront distribution
*/
getNowFilesCloudfrontUrl() {
return getEnvAsUrlOrThrow("NOW_FILES_CLOUDFRONT_URL") || "https://dmmcy0pwk6bqi.cloudfront.net";
}
/**
* Retrieves the URL of the S3 bucket for storing ephemeral files.
*
* @returns The URL of the S3 bucket
*/
getNowEphemeralFilesS3Url() {
return getEnvAsUrlOrThrow("NOW_EPHEMERAL_FILES_S3_URL") || "https://now-ephemeral-files.s3.amazonaws.com";
}
/**
* Retrieves the URL of the S3 bucket for storing files.
*
* @returns The URL of the S3 bucket
*/
getNowFilesS3Url() {
return getEnvAsUrlOrThrow("NOW_FILES_S3_URL") || "https://now-files.s3.amazonaws.com";
}
async toStreamAsync() {
let url = "";
const [digestType, digestHash] = this.digest.split(":");
if (digestType === "sha") {
url = this.mutable ? `${this.getNowFilesS3Url()}/${digestHash}` : `${this.getNowFilesCloudfrontUrl()}/${digestHash}`;
} else if (digestType === "sha+ephemeral") {
url = `${this.getNowEphemeralFilesS3Url()}/${digestHash}`;
} else {
throw new Error("Expected digest to be sha");
}
await semaToDownloadFromS3.acquire();
try {
return await (0, import_async_retry.default)(
async () => {
const resp = await (0, import_node_fetch.default)(url);
if (!resp.ok) {
const error = new BailableError(
`download: ${resp.status} ${resp.statusText} for ${url}`
);
if (resp.status === 403)
error.bail = true;
throw error;
}
return resp.body;
},
{ factor: 1, retries: 3 }
);
} finally {
semaToDownloadFromS3.release();
}
}
toStream() {
let flag = false;
return (0, import_multistream.default)((cb) => {
if (flag)
return cb(null, null);
flag = true;
this.toStreamAsync().then((stream) => {
cb(null, stream);
}).catch((error) => {
cb(error, null);
});
});
}
}
function getEnvAsUrlOrThrow(key) {
const value = process.env[key];
if (value === void 0)
return void 0;
try {
new URL(value);
return value;
} catch (e) {
if (e instanceof TypeError && "code" in e && e.code === "ERR_INVALID_URL") {
throw new Error(
`A non-URL value was supplied to the ${key} environment variable`
);
} else {
throw e;
}
}
}

View file

@ -0,0 +1,22 @@
import { Builder } from '.';
/**
* List of backend frameworks supported by the experimental backends feature
*/
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "python"];
export declare const RUNTIME_FRAMEWORKS: readonly ["python"];
export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/koa", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
export type PythonFramework = (typeof PYTHON_FRAMEWORKS)[number];
/**
* Checks if the given framework is a backend framework
*/
export declare function isBackendFramework(framework: string | null | undefined): framework is BackendFramework;
export declare function isPythonFramework(framework: string | null | undefined): framework is (typeof PYTHON_FRAMEWORKS)[number];
export declare function isExperimentalBackendsWithoutIntrospectionEnabled(): boolean;
export declare function isExperimentalBackendsEnabled(): boolean;
export declare function isBackendBuilder(builder: Builder | null | undefined): boolean;
/**
* Checks if experimental backends are enabled AND the framework is a backend framework
*/
export declare function shouldUseExperimentalBackends(framework: string | null | undefined): boolean;

View file

@ -0,0 +1,96 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var framework_helpers_exports = {};
__export(framework_helpers_exports, {
BACKEND_BUILDERS: () => BACKEND_BUILDERS,
BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
RUNTIME_FRAMEWORKS: () => RUNTIME_FRAMEWORKS,
isBackendBuilder: () => isBackendBuilder,
isBackendFramework: () => isBackendFramework,
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
isPythonFramework: () => isPythonFramework,
shouldUseExperimentalBackends: () => shouldUseExperimentalBackends
});
module.exports = __toCommonJS(framework_helpers_exports);
const BACKEND_FRAMEWORKS = [
"express",
"hono",
"h3",
"koa",
"nestjs",
"fastify",
"elysia"
];
const PYTHON_FRAMEWORKS = [
"fastapi",
"flask",
"python"
// Generic Python framework preset
];
const RUNTIME_FRAMEWORKS = ["python"];
const BACKEND_BUILDERS = [
"@vercel/express",
"@vercel/hono",
"@vercel/h3",
"@vercel/koa",
"@vercel/nestjs",
"@vercel/fastify",
"@vercel/elysia"
];
function isBackendFramework(framework) {
if (!framework)
return false;
return BACKEND_FRAMEWORKS.includes(framework);
}
function isPythonFramework(framework) {
if (!framework)
return false;
return PYTHON_FRAMEWORKS.includes(framework);
}
function isExperimentalBackendsWithoutIntrospectionEnabled() {
return process.env.VERCEL_BACKENDS_BUILDS === "1";
}
function isExperimentalBackendsEnabled() {
return isExperimentalBackendsWithoutIntrospectionEnabled() || process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
}
function isBackendBuilder(builder) {
if (!builder)
return false;
const use = builder.use;
return BACKEND_BUILDERS.includes(use);
}
function shouldUseExperimentalBackends(framework) {
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BACKEND_BUILDERS,
BACKEND_FRAMEWORKS,
PYTHON_FRAMEWORKS,
RUNTIME_FRAMEWORKS,
isBackendBuilder,
isBackendFramework,
isExperimentalBackendsEnabled,
isExperimentalBackendsWithoutIntrospectionEnabled,
isPythonFramework,
shouldUseExperimentalBackends
});

View file

@ -0,0 +1,9 @@
import FileFsRef from '../file-fs-ref';
import { File, Files, Meta } from '../types';
export interface DownloadedFiles {
[filePath: string]: FileFsRef;
}
export declare function isDirectory(mode: number): boolean;
export declare function isSymbolicLink(mode: number): boolean;
export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;

136
node_modules/@vercel/build-utils/dist/fs/download.js generated vendored Normal file
View file

@ -0,0 +1,136 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var download_exports = {};
__export(download_exports, {
default: () => download,
downloadFile: () => downloadFile,
isDirectory: () => isDirectory,
isSymbolicLink: () => isSymbolicLink
});
module.exports = __toCommonJS(download_exports);
var import_path = __toESM(require("path"));
var import_debug = __toESM(require("../debug"));
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
var import_fs_extra = require("fs-extra");
var import_stream_to_buffer = __toESM(require("./stream-to-buffer"));
const S_IFDIR = 16384;
const S_IFLNK = 40960;
const S_IFMT = 61440;
function isDirectory(mode) {
return (mode & S_IFMT) === S_IFDIR;
}
function isSymbolicLink(mode) {
return (mode & S_IFMT) === S_IFLNK;
}
async function prepareSymlinkTarget(file, fsPath) {
const mkdirPromise = (0, import_fs_extra.mkdirp)(import_path.default.dirname(fsPath));
if (file.type === "FileFsRef") {
const [target] = await Promise.all([(0, import_fs_extra.readlink)(file.fsPath), mkdirPromise]);
return target;
}
if (file.type === "FileRef" || file.type === "FileBlob") {
const targetPathBufferPromise = (0, import_stream_to_buffer.default)(await file.toStreamAsync());
const [targetPathBuffer] = await Promise.all([
targetPathBufferPromise,
mkdirPromise
]);
return targetPathBuffer.toString("utf8");
}
throw new Error(
`file.type "${file.type}" not supported for symlink`
);
}
async function downloadFile(file, fsPath) {
const { mode } = file;
if (isDirectory(mode)) {
await (0, import_fs_extra.mkdirp)(fsPath);
await (0, import_fs_extra.chmod)(fsPath, mode);
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
}
if (isSymbolicLink(mode)) {
const target = await prepareSymlinkTarget(file, fsPath);
await (0, import_fs_extra.symlink)(target, fsPath);
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
}
const stream = file.toStream();
return import_file_fs_ref.default.fromStream({ mode, stream, fsPath });
}
async function removeFile(basePath, fileMatched) {
const file = import_path.default.join(basePath, fileMatched);
await (0, import_fs_extra.remove)(file);
}
async function download(files, basePath, meta) {
const {
isDev = false,
skipDownload = false,
filesChanged = null,
filesRemoved = null
} = meta || {};
if (isDev || skipDownload) {
return files;
}
(0, import_debug.default)("Downloading deployment source files...");
const start = Date.now();
const files2 = {};
const filenames = Object.keys(files);
await Promise.all(
filenames.map(async (name) => {
if (Array.isArray(filesRemoved) && filesRemoved.includes(name)) {
await removeFile(basePath, name);
return;
}
if (Array.isArray(filesChanged) && !filesChanged.includes(name)) {
return;
}
const parts = name.split("/");
for (let i = 1; i < parts.length; i++) {
const dir = parts.slice(0, i).join("/");
const parent = files[dir];
if (parent && isSymbolicLink(parent.mode)) {
console.warn(
`Warning: file "${name}" is within a symlinked directory "${dir}" and will be ignored`
);
return;
}
}
const file = files[name];
const fsPath = import_path.default.join(basePath, name);
files2[name] = await downloadFile(file, fsPath);
})
);
const duration = Date.now() - start;
(0, import_debug.default)(`Downloaded ${filenames.length} source files: ${duration}ms`);
return files2;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
downloadFile,
isDirectory,
isSymbolicLink
});

View file

@ -0,0 +1 @@
export default function getWritableDirectory(): Promise<string>;

View file

@ -0,0 +1,32 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_writable_directory_exports = {};
__export(get_writable_directory_exports, {
default: () => getWritableDirectory
});
module.exports = __toCommonJS(get_writable_directory_exports);
var import_path = require("path");
var import_os = require("os");
var import_fs_extra = require("fs-extra");
async function getWritableDirectory() {
const name = Math.floor(Math.random() * 2147483647).toString(16);
const directory = (0, import_path.join)((0, import_os.tmpdir)(), name);
await (0, import_fs_extra.mkdirp)(directory);
return directory;
}

10
node_modules/@vercel/build-utils/dist/fs/glob.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import FileFsRef from '../file-fs-ref';
export interface GlobOptions {
cwd?: string;
dot?: boolean;
follow?: boolean;
ignore?: string | ReadonlyArray<string>;
includeDirectories?: boolean;
nodir?: boolean;
}
export default function glob(pattern: string, opts: GlobOptions | string, mountpoint?: string): Promise<Record<string, FileFsRef>>;

111
node_modules/@vercel/build-utils/dist/fs/glob.js generated vendored Normal file
View file

@ -0,0 +1,111 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var glob_exports = {};
__export(glob_exports, {
default: () => glob
});
module.exports = __toCommonJS(glob_exports);
var import_path = __toESM(require("path"));
var import_assert = __toESM(require("assert"));
var import_glob = __toESM(require("glob"));
var import_util = require("util");
var import_fs_extra = require("fs-extra");
var import_normalize_path = require("./normalize-path");
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
const vanillaGlob = (0, import_util.promisify)(import_glob.default);
async function glob(pattern, opts, mountpoint) {
const options = typeof opts === "string" ? { cwd: opts } : opts;
if (!options.cwd) {
throw new Error(
"Second argument (basePath) must be specified for names of resulting files"
);
}
if (!import_path.default.isAbsolute(options.cwd)) {
throw new Error(`basePath/cwd must be an absolute path (${options.cwd})`);
}
const results = {};
const statCache = {};
const symlinks = {};
const files = await vanillaGlob(pattern, {
...options,
symlinks,
statCache,
stat: true,
dot: true
});
const dirs = /* @__PURE__ */ new Set();
const dirsWithEntries = /* @__PURE__ */ new Set();
for (const relativePath of files) {
const absPath = import_path.default.join(options.cwd, relativePath);
const fsPath = (0, import_normalize_path.normalizePath)(absPath);
let stat = statCache[fsPath];
(0, import_assert.default)(
stat,
`statCache does not contain value for ${relativePath} (resolved to ${fsPath})`
);
const isSymlink = symlinks[fsPath];
if (options.follow && (isSymlink || (await (0, import_fs_extra.lstat)(fsPath)).isSymbolicLink())) {
const target = await (0, import_fs_extra.readlink)(absPath);
const absTarget = import_path.default.resolve(import_path.default.dirname(absPath), target);
if (import_path.default.relative(options.cwd, absTarget).startsWith(`..${import_path.default.sep}`)) {
continue;
}
}
if (isSymlink || stat.isFile() || stat.isDirectory()) {
if (isSymlink) {
stat = await (0, import_fs_extra.lstat)(absPath);
}
const dirname = import_path.default.dirname(relativePath);
dirsWithEntries.add(dirname);
if (stat.isDirectory()) {
dirs.add(relativePath);
continue;
}
let finalPath = relativePath;
if (mountpoint) {
finalPath = import_path.default.join(mountpoint, finalPath);
}
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
}
}
if (options.includeDirectories) {
for (const relativePath of dirs) {
if (dirsWithEntries.has(relativePath))
continue;
let finalPath = relativePath;
if (mountpoint) {
finalPath = import_path.default.join(mountpoint, finalPath);
}
const fsPath = (0, import_normalize_path.normalizePath)(import_path.default.join(options.cwd, relativePath));
const stat = statCache[fsPath];
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
}
}
return results;
}

View file

@ -0,0 +1,13 @@
import { BunVersion, NodeVersion, Version } from '../types';
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
export declare const NODE_VERSIONS: NodeVersion[];
export declare const BUN_VERSIONS: BunVersion[];
export declare function getNodeVersionByMajor(major: number): NodeVersion | undefined;
declare function getOptions(): NodeVersion[];
export declare function getAvailableNodeVersions(): NodeVersionMajor[];
export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
export declare function getDiscontinuedNodeVersions(): NodeVersion[];
export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
export declare function getSupportedBunVersion(engineRange: string): BunVersion;
export declare function isBunVersion(version: Version): boolean;
export {};

View file

@ -0,0 +1,222 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var node_version_exports = {};
__export(node_version_exports, {
BUN_VERSIONS: () => BUN_VERSIONS,
NODE_VERSIONS: () => NODE_VERSIONS,
getAvailableNodeVersions: () => getAvailableNodeVersions,
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
getLatestNodeVersion: () => getLatestNodeVersion,
getNodeVersionByMajor: () => getNodeVersionByMajor,
getSupportedBunVersion: () => getSupportedBunVersion,
getSupportedNodeVersion: () => getSupportedNodeVersion,
isBunVersion: () => isBunVersion
});
module.exports = __toCommonJS(node_version_exports);
var import_fs = require("fs");
var import_semver = require("semver");
var import_types = require("../types");
var import_errors = require("../errors");
var import_debug = __toESM(require("../debug"));
const NODE_VERSIONS = [
new import_types.NodeVersion({
major: 24,
range: "24.x",
runtime: "nodejs24.x"
}),
new import_types.NodeVersion({
major: 22,
range: "22.x",
runtime: "nodejs22.x"
}),
new import_types.NodeVersion({
major: 20,
range: "20.x",
runtime: "nodejs20.x"
}),
new import_types.NodeVersion({
major: 18,
range: "18.x",
runtime: "nodejs18.x",
discontinueDate: /* @__PURE__ */ new Date("2025-09-01")
}),
new import_types.NodeVersion({
major: 16,
range: "16.x",
runtime: "nodejs16.x",
discontinueDate: /* @__PURE__ */ new Date("2025-02-03")
}),
new import_types.NodeVersion({
major: 14,
range: "14.x",
runtime: "nodejs14.x",
discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
}),
new import_types.NodeVersion({
major: 12,
range: "12.x",
runtime: "nodejs12.x",
discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
}),
new import_types.NodeVersion({
major: 10,
range: "10.x",
runtime: "nodejs10.x",
discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
}),
new import_types.NodeVersion({
major: 8,
range: "8.10.x",
runtime: "nodejs8.10",
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
})
];
const BUN_VERSIONS = [
new import_types.BunVersion({
major: 1,
range: "1.x",
runtime: "bun1.x"
})
];
function getNodeVersionByMajor(major) {
return getOptions().find((v) => v.major === major);
}
function getOptions() {
return NODE_VERSIONS;
}
function isNodeVersionAvailable(version) {
const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
return stat?.isDirectory() ?? false;
}
function getAvailableNodeVersions() {
return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
}
function getHint(isAuto = false, availableVersions) {
const { major, range } = getLatestNodeVersion(availableVersions);
return isAuto ? `Please set Node.js Version to ${range} in your Project Settings to use Node.js ${major}.` : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
}
function getLatestNodeVersion(availableVersions) {
const all = getOptions();
if (availableVersions) {
for (const version of all) {
for (const major of availableVersions) {
if (version.major === major) {
return version;
}
}
}
}
return all[0];
}
function getDiscontinuedNodeVersions() {
return getOptions().filter((version) => {
return version.state === "discontinued";
});
}
async function getSupportedNodeVersion(engineRange, isAuto = false, availableVersions) {
let selection;
if (engineRange) {
const found = (0, import_semver.validRange)(engineRange) && getOptions().some((o) => {
selection = o;
return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
});
if (!found) {
throw new import_errors.NowBuildError({
code: "BUILD_UTILS_NODE_VERSION_INVALID",
link: "https://vercel.link/node-version",
message: `Found invalid or discontinued Node.js Version: "${engineRange}". ${getHint(
isAuto,
availableVersions
)}`
});
}
}
if (!selection) {
selection = getLatestNodeVersion(availableVersions);
}
if (selection.state === "discontinued") {
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
throw new import_errors.NowBuildError({
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
link: "https://vercel.link/node-version",
message: `${intro} ${getHint(isAuto)}`
});
}
(0, import_debug.default)(`Selected Node.js ${selection.range}`);
if (selection.state === "deprecated") {
const d = selection.formattedDate;
if (d) {
console.warn(
`Error: Node.js version ${selection.range} is deprecated. Deployments created on or after ${d} will fail to build. ${getHint(
isAuto
)}`
);
} else {
console.warn(
`Error: Node.js version ${selection.range} is deprecated. ${getHint(
isAuto
)}`
);
}
}
return selection;
}
function getSupportedBunVersion(engineRange) {
if ((0, import_semver.validRange)(engineRange)) {
const selected = BUN_VERSIONS.find((version) => {
return (0, import_semver.intersects)(version.range, engineRange);
});
if (selected) {
return new import_types.BunVersion({
major: selected.major,
range: selected.range,
runtime: selected.runtime
});
}
}
throw new import_errors.NowBuildError({
message: `Found invalid Bun Version: "${engineRange}".`,
code: "BUILD_UTILS_BUN_VERSION_INVALID"
});
}
function isBunVersion(version) {
return version.runtime.startsWith("bun");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUN_VERSIONS,
NODE_VERSIONS,
getAvailableNodeVersions,
getDiscontinuedNodeVersions,
getLatestNodeVersion,
getNodeVersionByMajor,
getSupportedBunVersion,
getSupportedNodeVersion,
isBunVersion
});

View file

@ -0,0 +1,4 @@
/**
* Convert Windows separators to Unix separators.
*/
export declare function normalizePath(p: string): string;

View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var normalize_path_exports = {};
__export(normalize_path_exports, {
normalizePath: () => normalizePath
});
module.exports = __toCommonJS(normalize_path_exports);
const isWin = process.platform === "win32";
function normalizePath(p) {
return isWin ? p.replace(/\\/g, "/") : p;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
normalizePath
});

View file

@ -0,0 +1,7 @@
import type { PackageJson } from '../types';
export declare function readConfigFile<T>(files: string | string[]): Promise<T | null>;
/**
* Reads and parses the package.json file from a directory.
* Returns an empty object if the file doesn't exist or can't be parsed.
*/
export declare function getPackageJson(dir: string): Promise<PackageJson>;

View file

@ -0,0 +1,87 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var read_config_file_exports = {};
__export(read_config_file_exports, {
getPackageJson: () => getPackageJson,
readConfigFile: () => readConfigFile
});
module.exports = __toCommonJS(read_config_file_exports);
var import_js_yaml = __toESM(require("js-yaml"));
var import_toml = __toESM(require("@iarna/toml"));
var import_fs_extra = require("fs-extra");
var import_error_utils = require("@vercel/error-utils");
var import_path = require("path");
async function readFileOrNull(file) {
try {
const data = await (0, import_fs_extra.readFile)(file);
return data;
} catch (error) {
if (!(0, import_error_utils.isErrnoException)(error)) {
throw error;
}
if (error.code !== "ENOENT") {
throw error;
}
}
return null;
}
async function readConfigFile(files) {
files = Array.isArray(files) ? files : [files];
for (const name of files) {
const data = await readFileOrNull(name);
if (data) {
const str = data.toString("utf8");
try {
if (name.endsWith(".json")) {
return JSON.parse(str);
} else if (name.endsWith(".toml")) {
return import_toml.default.parse(str);
} else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
return import_js_yaml.default.safeLoad(str, { filename: name });
}
} catch (error) {
console.log(`Error while parsing config file: "${name}"`);
}
}
}
return null;
}
async function getPackageJson(dir) {
const packagePath = (0, import_path.join)(dir, "package.json");
try {
return JSON.parse(await (0, import_fs_extra.readFile)(packagePath, "utf8"));
} catch (err) {
return {};
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPackageJson,
readConfigFile
});

11
node_modules/@vercel/build-utils/dist/fs/rename.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
import { Files } from '../types';
type Delegate = (name: string) => string;
/**
* Renames the keys of a `Files` map.
*
* @param files A map of filenames to `File` instances
* @param delegate A function that returns the new filename
* @returns A new file map with the renamed filenames
*/
export default function rename(files: Files, delegate: Delegate): Files;
export {};

30
node_modules/@vercel/build-utils/dist/fs/rename.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var rename_exports = {};
__export(rename_exports, {
default: () => rename
});
module.exports = __toCommonJS(rename_exports);
function rename(files, delegate) {
const result = {};
for (const [name, file] of Object.entries(files)) {
result[delegate(name)] = file;
}
return result;
}

View file

@ -0,0 +1,230 @@
/// <reference types="node" />
import { SpawnOptions } from 'child_process';
import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
export interface FindPackageJsonResult {
/**
* The file path of found `package.json` file, or `undefined` if not found.
*/
packageJsonPath?: string;
/**
* The contents of found `package.json` file, when the `readPackageJson`
* option is enabled.
*/
packageJson?: PackageJson;
}
export interface ScanParentDirsResult extends FindPackageJsonResult {
/**
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
*/
cliType: CliType;
/**
* The file path of the lockfile (`yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`)
* or `undefined` if not found.
*/
lockfilePath?: string;
/**
* The `lockfileVersion` number from lockfile (`package-lock.json` or `pnpm-lock.yaml`),
* or `undefined` if not found.
*/
lockfileVersion?: number;
/**
* The contents of the `packageManager` field from `package.json` if found.
* The value may come from a different `package.json` file than the one
* specified by `packageJsonPath`, in the case of a monorepo.
*/
packageJsonPackageManager?: string;
/**
* Whether Turborepo supports the `COREPACK_HOME` environment variable.
* `undefined` if not a Turborepo project.
*/
turboSupportsCorepackHome?: boolean;
}
export interface TraverseUpDirectoriesProps {
/**
* The directory to start iterating from, typically the same directory of the entrypoint.
*/
start: string;
/**
* The highest directory, typically the workPath root of the project.
*/
base?: string;
}
export interface WalkParentDirsProps extends Required<TraverseUpDirectoriesProps> {
/**
* The name of the file to search for, typically `package.json` or `Gemfile`.
*/
filename: string;
}
export interface WalkParentDirsMultiProps extends Required<TraverseUpDirectoriesProps> {
/**
* The name of the file to search for, typically `package.json` or `Gemfile`.
*/
filenames: string[];
}
export interface SpawnOptionsExtended extends SpawnOptions {
/**
* Pretty formatted command that is being spawned for logging purposes.
*/
prettyCommand?: string;
/**
* Returns instead of throwing an error when the process exits with a
* non-0 exit code. When relevant, the returned object will include
* the error code, stdout and stderr.
*/
ignoreNon0Exit?: boolean;
}
export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>;
export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess;
export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>;
export declare function traverseUpDirectories({ start, base, }: TraverseUpDirectoriesProps): Generator<string, void, unknown>;
/**
* @deprecated Use `getNodeBinPaths()` instead.
*/
export declare function getNodeBinPath({ cwd, }: {
cwd: string;
}): Promise<string>;
export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesProps): string[];
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
/**
* @deprecated Don't use this function directly.
*
* Use getEnvForPackageManager() instead when within a builder.
*/
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
export declare function getNodeVersion(destPath: string, fallbackVersion?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion | BunVersion>;
/**
* Traverses up directories to find and optionally read package.json.
* This is a lightweight alternative to `scanParentDirs` when only
* package.json information is needed (without lockfile detection).
*/
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
export declare function turboVersionSpecifierSupportsCorepack(turboVersionSpecifier: string): boolean;
export declare function usingCorepack(env: {
[x: string]: string | undefined;
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
/**
* Reset the customInstallCommandSet. This should be called at the start of each build
* to prevent custom install commands from being skipped due to the set persisting
* across multiple builds in the same Node process (e.g., in unit tests).
*/
export declare function resetCustomInstallCommandSet(): void;
export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, projectCreatedAt?: number): Promise<boolean>;
/**
* Prepares the input environment based on the used package manager and lockfile
* versions.
*/
export declare function getEnvForPackageManager({ cliType, lockfileVersion, packageJsonPackageManager, env, packageJsonEngines, turboSupportsCorepackHome, projectCreatedAt, }: {
cliType: CliType;
lockfileVersion: number | undefined;
packageJsonPackageManager?: string | undefined;
env: {
[x: string]: string | undefined;
};
packageJsonEngines?: PackageJson.Engines;
turboSupportsCorepackHome?: boolean | undefined;
projectCreatedAt?: number | undefined;
}): {
[x: string]: string | undefined;
};
export declare const PNPM_10_PREFERRED_AT: Date;
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.
*/
export declare function getPathOverrideForPackageManager({ cliType, lockfileVersion, corepackPackageManager, corepackEnabled, packageJsonEngines, projectCreatedAt, }: {
cliType: CliType;
lockfileVersion: number | undefined;
corepackPackageManager: string | undefined;
corepackEnabled?: boolean;
packageJsonEngines?: PackageJson.Engines;
projectCreatedAt?: number;
}): {
/**
* Which lockfile was detected.
*/
detectedLockfile: string | undefined;
/**
* Detected package manager that generated the found lockfile.
*/
detectedPackageManager: string | undefined;
/**
* Value of $PATH that includes the binaries for the detected package manager.
* Undefined if no $PATH are necessary.
*/
path: string | undefined;
};
export declare function detectPackageManager(cliType: CliType, lockfileVersion: number | undefined, projectCreatedAt?: number): {
path: string;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange: string;
} | {
path: string;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange?: undefined;
} | {
path: undefined;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange?: undefined;
} | undefined;
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.
* @deprecated use `getEnvForPackageManager` instead
*/
export declare function getPathForPackageManager({ cliType, lockfileVersion, env, }: {
cliType: CliType;
lockfileVersion: number | undefined;
env: {
[x: string]: string | undefined;
};
}): {
/**
* Which lockfile was detected.
*/
detectedLockfile: string | undefined;
/**
* Detected package manager that generated the found lockfile.
*/
detectedPackageManager: string | undefined;
/**
* Value of $PATH that includes the binaries for the detected package manager.
* Undefined if no $PATH are necessary.
*/
path: string | undefined;
/**
* Set if yarn was identified as package manager and `YARN_NODE_LINKER`
* environment variable was not found on the input environment.
*/
yarnNodeLinker: string | undefined;
};
export declare function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt, }: {
destPath: string;
installCommand: string;
spawnOpts?: SpawnOptions;
projectCreatedAt?: number;
}): Promise<boolean>;
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions, projectCreatedAt?: number): Promise<boolean>;
export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
export type PipInstallResult = {
installed: false;
} | {
installed: true;
/**
* The directory where packages were installed.
* Add this to PYTHONPATH when running Python commands.
*/
targetDir: string;
};
export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<PipInstallResult>;
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | undefined;
/**
* @deprecate installDependencies() is deprecated.
* Please use runNpmInstall() instead.
*/
export declare const installDependencies: typeof runNpmInstall;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
/// <reference types="node" />
/// <reference types="node" />
export default function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>;
export declare function streamToBufferChunks(stream: NodeJS.ReadableStream, chunkSize?: number): Promise<Buffer[]>;

View file

@ -0,0 +1,87 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stream_to_buffer_exports = {};
__export(stream_to_buffer_exports, {
default: () => streamToBuffer,
streamToBufferChunks: () => streamToBufferChunks
});
module.exports = __toCommonJS(stream_to_buffer_exports);
var import_end_of_stream = __toESM(require("end-of-stream"));
function streamToBuffer(stream) {
return new Promise((resolve, reject) => {
const buffers = [];
stream.on("data", buffers.push.bind(buffers));
(0, import_end_of_stream.default)(stream, (err) => {
if (err) {
reject(err);
return;
}
switch (buffers.length) {
case 0:
resolve(Buffer.allocUnsafe(0));
break;
case 1:
resolve(buffers[0]);
break;
default:
resolve(Buffer.concat(buffers));
}
});
});
}
const MB = 1024 * 1024;
async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
const chunks = [];
let currentChunk = [];
let currentSize = 0;
for await (const chunk of stream) {
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
let offset = 0;
while (offset < buffer.length) {
const remainingSpace = chunkSize - currentSize;
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
currentChunk.push(buffer.slice(offset, offset + sliceSize));
currentSize += sliceSize;
offset += sliceSize;
if (currentSize >= chunkSize) {
chunks.push(Buffer.concat(currentChunk));
currentChunk = [];
currentSize = 0;
}
}
}
if (currentChunk.length > 0) {
chunks.push(Buffer.concat(currentChunk));
}
return chunks;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
streamToBufferChunks
});

View file

@ -0,0 +1,17 @@
import { BuildV3, Config } from './types';
import type FileFsRef from './file-fs-ref';
export declare function generateNodeBuilderFunctions(frameworkName: string, regex: RegExp, validFilenames: string[], validExtensions: string[], nodeBuild: any, // necessary to avoid circular dependency
opts?: {
checks?: (info: {
config: Config;
isBun: boolean;
}) => void;
}): {
require_: NodeRequire;
findEntrypoint: (files: Record<string, FileFsRef>) => {
entrypoint: string;
entrypointsNotMatchingRegex: string[];
};
build: BuildV3;
entrypointCallback: (args: Parameters<BuildV3>[0]) => Promise<string>;
};

View file

@ -0,0 +1,198 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var generate_node_builder_functions_exports = {};
__export(generate_node_builder_functions_exports, {
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions
});
module.exports = __toCommonJS(generate_node_builder_functions_exports);
var import_glob = __toESM(require("./fs/glob"));
var import_node_path = require("node:path");
var import_node_fs = __toESM(require("node:fs"));
var import_node_module = require("node:module");
function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild, opts) {
const entrypointsForMessage = validFilenames.map((filename) => `- ${filename}.{${validExtensions.join(",")}}`).join("\n");
const require_ = (0, import_node_module.createRequire)(__filename);
const build = async (args) => {
process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS = "1";
const includeFiles = ["views/**/*"];
const includeFilesFromConfig = args.config.includeFiles;
if (includeFilesFromConfig) {
includeFiles.push(...includeFilesFromConfig);
}
const res = await nodeBuild({
...args,
config: {
...args.config,
includeFiles
},
// this is package.json, but we'll replace it with the return value of the entrypointCallback
// after install and build scripts have had a chance to run
entrypoint: "package.json",
considerBuildCommand: true,
entrypointCallback: async () => {
return entrypointCallback(args);
},
checks: opts?.checks ?? (() => {
})
});
let version = void 0;
try {
const resolved = require_.resolve(`${frameworkName}/package.json`, {
paths: [args.workPath]
});
const frameworkVersion = require_(resolved).version;
if (frameworkVersion) {
version = frameworkVersion;
}
} catch (e) {
}
res.output.framework = {
slug: frameworkName,
version
};
return res;
};
const entrypointCallback = async (args) => {
const mainPackageEntrypoint = findMainPackageEntrypoint(args.files);
const entrypointGlob = `{${validFilenames.map((entrypoint) => `${entrypoint}`).join(",")}}.{${validExtensions.join(",")}}`;
const dir = args.config.projectSettings?.outputDirectory?.replace(
/^\/+|\/+$/g,
""
);
if (dir) {
const {
entrypoint: entrypointFromOutputDir,
entrypointsNotMatchingRegex: entrypointsNotMatchingRegex2
} = findEntrypoint(await (0, import_glob.default)(entrypointGlob, (0, import_node_path.join)(args.workPath, dir)));
if (entrypointFromOutputDir) {
return (0, import_node_path.join)(dir, entrypointFromOutputDir);
}
if (entrypointsNotMatchingRegex2.length > 0) {
throw new Error(
`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex2.length)}: ${entrypointsNotMatchingRegex2.join(", ")}`
);
}
throw new Error(
`No entrypoint found in output directory: "${dir}". Searched for:
${entrypointsForMessage}`
);
}
const files = await (0, import_glob.default)(entrypointGlob, args.workPath);
const { entrypoint: entrypointFromRoot, entrypointsNotMatchingRegex } = findEntrypoint(files);
if (entrypointFromRoot) {
return entrypointFromRoot;
}
if (mainPackageEntrypoint) {
const entrypointFromPackageJson = await (0, import_glob.default)(
mainPackageEntrypoint,
args.workPath
);
if (entrypointFromPackageJson[mainPackageEntrypoint]) {
if (checkMatchesRegex(entrypointFromPackageJson[mainPackageEntrypoint])) {
return mainPackageEntrypoint;
}
}
}
if (entrypointsNotMatchingRegex.length > 0) {
throw new Error(
`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex.length)}: ${entrypointsNotMatchingRegex.join(", ")}`
);
}
throw new Error(
`No entrypoint found. Searched for:
${entrypointsForMessage}`
);
};
function pluralize(word, count) {
return count === 1 ? word : `${word}s`;
}
const findEntrypoint = (files) => {
const allEntrypoints = validFilenames.flatMap(
(filename) => validExtensions.map((extension) => `${filename}.${extension}`)
);
const possibleEntrypointsInFiles = allEntrypoints.filter((entrypoint2) => {
return files[entrypoint2] !== void 0;
});
const entrypointsMatchingRegex = possibleEntrypointsInFiles.filter(
(entrypoint2) => {
const file = files[entrypoint2];
return checkMatchesRegex(file);
}
);
const entrypointsNotMatchingRegex = possibleEntrypointsInFiles.filter(
(entrypoint2) => {
const file = files[entrypoint2];
return !checkMatchesRegex(file);
}
);
const entrypoint = entrypointsMatchingRegex[0];
if (entrypointsMatchingRegex.length > 1) {
console.warn(
`Multiple entrypoints found: ${entrypointsMatchingRegex.join(", ")}. Using ${entrypoint}.`
);
}
return {
entrypoint,
entrypointsNotMatchingRegex
};
};
const checkMatchesRegex = (file) => {
const content = import_node_fs.default.readFileSync(file.fsPath, "utf-8");
const matchesContent = content.match(regex);
return matchesContent !== null;
};
const findMainPackageEntrypoint = (files) => {
const packageJson = files["package.json"];
if (packageJson) {
if (packageJson.type === "FileFsRef") {
const packageJsonContent = import_node_fs.default.readFileSync(packageJson.fsPath, "utf-8");
let packageJsonJson;
try {
packageJsonJson = JSON.parse(packageJsonContent);
} catch (_e) {
packageJsonJson = {};
}
if ("main" in packageJsonJson && typeof packageJsonJson.main === "string") {
return packageJsonJson.main;
}
}
}
return null;
};
return {
require_,
findEntrypoint,
build,
entrypointCallback
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
generateNodeBuilderFunctions
});

View file

@ -0,0 +1 @@
export default function (downloadPath: string, rootDirectory?: string | undefined): Promise<(p: string) => any>;

View file

@ -0,0 +1,90 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_ignore_filter_exports = {};
__export(get_ignore_filter_exports, {
default: () => get_ignore_filter_default
});
module.exports = __toCommonJS(get_ignore_filter_exports);
var import_path = __toESM(require("path"));
var import_fs_extra = __toESM(require("fs-extra"));
var import_ignore = __toESM(require("ignore"));
function isCodedError(error) {
return error !== null && error !== void 0 && error.code !== void 0;
}
function clearRelative(s) {
return s.replace(/(\n|^)\.\//g, "$1");
}
async function get_ignore_filter_default(downloadPath, rootDirectory) {
const readFile = async (p) => {
try {
return await import_fs_extra.default.readFile(p, "utf8");
} catch (error) {
if (error.code === "ENOENT" || error instanceof Error && error.message.includes("ENOENT")) {
return void 0;
}
throw error;
}
};
const vercelIgnorePath = import_path.default.join(
downloadPath,
rootDirectory || "",
".vercelignore"
);
const nowIgnorePath = import_path.default.join(
downloadPath,
rootDirectory || "",
".nowignore"
);
const ignoreContents = [];
try {
ignoreContents.push(
...(await Promise.all([readFile(vercelIgnorePath), readFile(nowIgnorePath)])).filter(Boolean)
);
} catch (error) {
if (isCodedError(error) && error.code === "ENOTDIR") {
console.log(`Warning: Cannot read ignore file from ${vercelIgnorePath}`);
} else {
throw error;
}
}
if (ignoreContents.length === 2) {
throw new Error(
"Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file."
);
}
if (ignoreContents.length === 0) {
return () => false;
}
const ignoreFilter = (0, import_ignore.default)().add(clearRelative(ignoreContents[0]));
return function(p) {
if (p === "now.json" || p === "vercel.json")
return false;
return ignoreFilter.test(p).ignored;
};
}

View file

@ -0,0 +1 @@
export declare function getInstalledPackageVersion(packageName: string, path?: string | string[]): Promise<string | undefined>;

View file

@ -0,0 +1,53 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_installed_package_version_exports = {};
__export(get_installed_package_version_exports, {
getInstalledPackageVersion: () => getInstalledPackageVersion
});
module.exports = __toCommonJS(get_installed_package_version_exports);
var import_debug = __toESM(require("./debug"));
async function getInstalledPackageVersion(packageName, path) {
try {
const resolved = require.resolve(`${packageName}/package.json`, {
paths: path ? Array.isArray(path) ? path : [path] : [process.cwd()]
});
const version = require(resolved).version;
return version;
} catch (err) {
(0, import_debug.default)(
`Could not resolve package "${packageName}". Package is not installed.`,
err
);
return void 0;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getInstalledPackageVersion
});

View file

@ -0,0 +1,5 @@
/**
* Helper function to support both `VERCEL_` and legacy `NOW_` env vars.
* Throws an error if *both* env vars are defined.
*/
export declare const getPlatformEnv: (name: string) => string | undefined;

View file

@ -0,0 +1,45 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_platform_env_exports = {};
__export(get_platform_env_exports, {
getPlatformEnv: () => getPlatformEnv
});
module.exports = __toCommonJS(get_platform_env_exports);
var import_errors = require("./errors");
const getPlatformEnv = (name) => {
const vName = `VERCEL_${name}`;
const nName = `NOW_${name}`;
const v = process.env[vName];
const n = process.env[nName];
if (typeof v === "string") {
if (typeof n === "string") {
throw new import_errors.NowBuildError({
code: "CONFLICTING_ENV_VAR_NAMES",
message: `Both "${vName}" and "${nName}" env vars are defined. Please only define the "${vName}" env var.`,
link: "https://vercel.link/combining-old-and-new-config"
});
}
return v;
}
return n;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPlatformEnv
});

View file

@ -0,0 +1,14 @@
type Envs = {
[key: string]: string | undefined;
};
/**
* Get the framework-specific prefixed System Environment Variables.
* See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
* @param envPrefix - Prefix, typically from `@vercel/frameworks`
* @param envs - Environment Variables, typically from `process.env`
*/
export declare function getPrefixedEnvVars({ envPrefix, envs, }: {
envPrefix: string | undefined;
envs: Envs;
}): Envs;
export {};

View file

@ -0,0 +1,54 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_prefixed_env_vars_exports = {};
__export(get_prefixed_env_vars_exports, {
getPrefixedEnvVars: () => getPrefixedEnvVars
});
module.exports = __toCommonJS(get_prefixed_env_vars_exports);
function getPrefixedEnvVars({
envPrefix,
envs
}) {
const vercelSystemEnvPrefix = "VERCEL_";
const allowed = [
"VERCEL_URL",
"VERCEL_ENV",
"VERCEL_TARGET_ENV",
"VERCEL_REGION",
"VERCEL_BRANCH_URL",
"VERCEL_PROJECT_PRODUCTION_URL",
"VERCEL_DEPLOYMENT_ID",
"VERCEL_PROJECT_ID"
];
const newEnvs = {};
if (envPrefix && envs.VERCEL_URL) {
Object.keys(envs).filter((key) => allowed.includes(key) || key.startsWith("VERCEL_GIT_")).forEach((key) => {
const newKey = `${envPrefix}${key}`;
if (!(newKey in envs)) {
newEnvs[newKey] = envs[key];
}
});
newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
}
return newEnvs;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPrefixedEnvVars
});

View file

@ -0,0 +1 @@
export declare function hardLinkDir(src: string, destDirs: string[]): Promise<void>;

104
node_modules/@vercel/build-utils/dist/hard-link-dir.js generated vendored Normal file
View file

@ -0,0 +1,104 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var hard_link_dir_exports = {};
__export(hard_link_dir_exports, {
hardLinkDir: () => hardLinkDir
});
module.exports = __toCommonJS(hard_link_dir_exports);
var import_path = __toESM(require("path"));
var import_fs = require("fs");
async function hardLinkDir(src, destDirs) {
if (destDirs.length === 0)
return;
destDirs = destDirs.filter((destDir) => import_path.default.relative(destDir, src) !== "");
const files = await import_fs.promises.readdir(src);
await Promise.all(
files.map(async (file) => {
if (file === "node_modules")
return;
const srcFile = import_path.default.join(src, file);
if ((await import_fs.promises.lstat(srcFile)).isDirectory()) {
const destSubdirs = await Promise.all(
destDirs.map(async (destDir) => {
const destSubdir = import_path.default.join(destDir, file);
try {
await import_fs.promises.mkdir(destSubdir, { recursive: true });
} catch (err) {
if (err.code !== "EEXIST")
throw err;
}
return destSubdir;
})
);
await hardLinkDir(srcFile, destSubdirs);
return;
}
await Promise.all(
destDirs.map(async (destDir) => {
const destFile = import_path.default.join(destDir, file);
try {
await linkOrCopyFile(srcFile, destFile);
} catch (err) {
if (err.code === "ENOENT") {
return;
}
throw err;
}
})
);
})
);
}
async function linkOrCopyFile(srcFile, destFile) {
try {
await linkOrCopy(srcFile, destFile);
} catch (err) {
if (err.code === "ENOENT") {
await import_fs.promises.mkdir(import_path.default.dirname(destFile), { recursive: true });
await linkOrCopy(srcFile, destFile);
return;
}
if (err.code !== "EEXIST") {
throw err;
}
}
}
async function linkOrCopy(srcFile, destFile) {
try {
await import_fs.promises.link(srcFile, destFile);
} catch (err) {
if (err.code !== "EXDEV")
throw err;
await import_fs.promises.copyFile(srcFile, destFile);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hardLinkDir
});

36
node_modules/@vercel/build-utils/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,36 @@
import FileBlob from './file-blob';
import FileFsRef from './file-fs-ref';
import FileRef from './file-ref';
import { Lambda, createLambda, getLambdaOptionsFromFunction } from './lambda';
import { NodejsLambda } from './nodejs-lambda';
import { Prerender } from './prerender';
import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory } from './fs/download';
import getWriteableDirectory from './fs/get-writable-directory';
import glob, { GlobOptions } from './fs/glob';
import rename from './fs/rename';
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, findPackageJson, traverseUpDirectories, PipInstallResult } from './fs/run-user-scripts';
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion } from './fs/node-version';
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
import debug from './debug';
import getIgnoreFilter from './get-ignore-filter';
import { getPlatformEnv } from './get-platform-env';
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
import { cloneEnv } from './clone-env';
import { hardLinkDir } from './hard-link-dir';
import { validateNpmrc } from './validate-npmrc';
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
export { EdgeFunction } from './edge-function';
export { readConfigFile, getPackageJson } from './fs/read-config-file';
export { normalizePath } from './fs/normalize-path';
export { getOsRelease, getProvidedRuntime } from './os';
export * from './should-serve';
export * from './schemas';
export * from './types';
export * from './errors';
export * from './trace';
export { NODE_VERSIONS } from './fs/node-version';
export { getInstalledPackageVersion } from './get-installed-package-version';
export { defaultCachePathGlob } from './default-cache-path-glob';
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
export * from './python';

26940
node_modules/@vercel/build-utils/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

138
node_modules/@vercel/build-utils/dist/lambda.d.ts generated vendored Normal file
View file

@ -0,0 +1,138 @@
/// <reference types="node" />
import type { Config, Env, Files, FunctionFramework, TriggerEvent } from './types';
export type { TriggerEvent };
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
export type LambdaExecutableRuntimeLanguages = 'rust' | 'go';
export type LambdaArchitecture = 'x86_64' | 'arm64';
export interface LambdaOptionsBase {
handler: string;
runtime: string;
runtimeLanguage?: LambdaExecutableRuntimeLanguages;
architecture?: LambdaArchitecture;
memory?: number;
maxDuration?: number;
environment?: Env;
allowQuery?: string[];
regions?: string[];
supportsMultiPayloads?: boolean;
supportsWrapper?: boolean;
supportsResponseStreaming?: boolean;
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
experimentalResponseStreaming?: boolean;
operationType?: string;
framework?: FunctionFramework;
/**
* Experimental trigger event definitions that this Lambda can receive.
* Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
* Currently supports queue triggers for Vercel's queue system.
*
* The delivery configuration provides HINTS to the system about preferred
* execution behavior (concurrency, retries) but these are NOT guarantees.
* The system may disregard these hints based on resource constraints.
*
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
* of delivery configuration. Callers receive immediate responses.
*
* @experimental This feature is experimental and may change.
*/
experimentalTriggers?: TriggerEvent[];
/**
* Whether this Lambda supports cancellation.
* When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
*/
supportsCancellation?: boolean;
/**
* Whether to disable automatic fetch instrumentation.
* When true, the Function runtime will not automatically instrument fetch calls.
*/
shouldDisableAutomaticFetchInstrumentation?: boolean;
}
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
files: Files;
experimentalAllowBundling?: boolean;
}
/**
* @deprecated Use `LambdaOptionsWithFiles` instead.
*/
export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
/**
* @deprecated Use `files` property instead.
*/
zipBuffer: Buffer;
}
interface GetLambdaOptionsFromFunctionOptions {
sourceFile: string;
config?: Pick<Config, 'functions'>;
}
export declare class Lambda {
type: 'Lambda';
/**
* This is a label for the type of Lambda a framework is producing.
* The value can be any string that makes sense for a given framework.
* Examples: "API", "ISR", "SSR", "SSG", "Render", "Resource"
*/
operationType?: string;
files?: Files;
handler: string;
runtime: string;
/**
* When using a generic runtime such as "executable" or "provided" (custom runtimes),
* this field can be used to specify the language the executable was compiled with.
*/
runtimeLanguage?: LambdaExecutableRuntimeLanguages;
architecture: LambdaArchitecture;
memory?: number;
maxDuration?: number;
environment: Env;
allowQuery?: string[];
regions?: string[];
/**
* @deprecated Use `await lambda.createZip()` instead.
*/
zipBuffer?: Buffer;
supportsMultiPayloads?: boolean;
supportsWrapper?: boolean;
supportsResponseStreaming?: boolean;
framework?: FunctionFramework;
experimentalAllowBundling?: boolean;
/**
* Experimental trigger event definitions that this Lambda can receive.
* Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
* Currently supports queue triggers for Vercel's queue system.
*
* The delivery configuration provides HINTS to the system about preferred
* execution behavior (concurrency, retries) but these are NOT guarantees.
* The system may disregard these hints based on resource constraints.
*
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
* of delivery configuration. Callers receive immediate responses.
*
* @experimental This feature is experimental and may change.
*/
experimentalTriggers?: TriggerEvent[];
/**
* Whether this Lambda supports cancellation.
* When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
*/
supportsCancellation?: boolean;
/**
* Whether to disable automatic fetch instrumentation.
* When true, the Function runtime will not automatically instrument fetch calls.
*/
shouldDisableAutomaticFetchInstrumentation?: boolean;
constructor(opts: LambdaOptions);
createZip(): Promise<Buffer>;
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
get experimentalResponseStreaming(): boolean | undefined;
set experimentalResponseStreaming(v: boolean | undefined);
}
/**
* @deprecated Use `new Lambda()` instead.
*/
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
export declare function createZip(files: Files): Promise<Buffer>;
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'experimentalTriggers' | 'supportsCancellation'>>;

339
node_modules/@vercel/build-utils/dist/lambda.js generated vendored Normal file
View file

@ -0,0 +1,339 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var lambda_exports = {};
__export(lambda_exports, {
Lambda: () => Lambda,
createLambda: () => createLambda,
createZip: () => createZip,
getLambdaOptionsFromFunction: () => getLambdaOptionsFromFunction
});
module.exports = __toCommonJS(lambda_exports);
var import_assert = __toESM(require("assert"));
var import_async_sema = __toESM(require("async-sema"));
var import_yazl = require("yazl");
var import_minimatch = __toESM(require("minimatch"));
var import_fs_extra = require("fs-extra");
var import_download = require("./fs/download");
var import_stream_to_buffer = __toESM(require("./fs/stream-to-buffer"));
function getDefaultLambdaArchitecture(architecture) {
if (architecture) {
return architecture;
}
switch (process.arch) {
case "arm":
case "arm64": {
return "arm64";
}
default: {
return "x86_64";
}
}
}
class Lambda {
constructor(opts) {
const {
handler,
runtime,
runtimeLanguage,
maxDuration,
architecture,
memory,
environment = {},
allowQuery,
regions,
supportsMultiPayloads,
supportsWrapper,
supportsResponseStreaming,
experimentalResponseStreaming,
operationType,
framework,
experimentalTriggers,
supportsCancellation,
shouldDisableAutomaticFetchInstrumentation
} = opts;
if ("files" in opts) {
(0, import_assert.default)(typeof opts.files === "object", '"files" must be an object');
}
if ("zipBuffer" in opts) {
(0, import_assert.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
}
(0, import_assert.default)(typeof handler === "string", '"handler" is not a string');
(0, import_assert.default)(typeof runtime === "string", '"runtime" is not a string');
(0, import_assert.default)(typeof environment === "object", '"environment" is not an object');
if (architecture !== void 0) {
(0, import_assert.default)(
architecture === "x86_64" || architecture === "arm64",
'"architecture" must be either "x86_64" or "arm64"'
);
}
if (runtimeLanguage !== void 0) {
(0, import_assert.default)(
runtimeLanguage === "rust" || runtimeLanguage === "go",
'"runtimeLanguage" is invalid. Valid options: "rust", "go"'
);
}
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) {
(0, import_assert.default)(
typeof opts.experimentalAllowBundling === "boolean",
'"experimentalAllowBundling" is not a boolean'
);
}
if (memory !== void 0) {
(0, import_assert.default)(typeof memory === "number", '"memory" is not a number');
}
if (maxDuration !== void 0) {
(0, import_assert.default)(typeof maxDuration === "number", '"maxDuration" is not a number');
}
if (allowQuery !== void 0) {
(0, import_assert.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
(0, import_assert.default)(
allowQuery.every((q) => typeof q === "string"),
'"allowQuery" is not a string Array'
);
}
if (supportsMultiPayloads !== void 0) {
(0, import_assert.default)(
typeof supportsMultiPayloads === "boolean",
'"supportsMultiPayloads" is not a boolean'
);
}
if (supportsWrapper !== void 0) {
(0, import_assert.default)(
typeof supportsWrapper === "boolean",
'"supportsWrapper" is not a boolean'
);
}
if (regions !== void 0) {
(0, import_assert.default)(Array.isArray(regions), '"regions" is not an Array');
(0, import_assert.default)(
regions.every((r) => typeof r === "string"),
'"regions" is not a string Array'
);
}
if (framework !== void 0) {
(0, import_assert.default)(typeof framework === "object", '"framework" is not an object');
(0, import_assert.default)(
typeof framework.slug === "string",
'"framework.slug" is not a string'
);
if (framework.version !== void 0) {
(0, import_assert.default)(
typeof framework.version === "string",
'"framework.version" is not a string'
);
}
}
if (experimentalTriggers !== void 0) {
(0, import_assert.default)(
Array.isArray(experimentalTriggers),
'"experimentalTriggers" is not an Array'
);
for (let i = 0; i < experimentalTriggers.length; i++) {
const trigger = experimentalTriggers[i];
const prefix = `"experimentalTriggers[${i}]"`;
(0, import_assert.default)(
typeof trigger === "object" && trigger !== null,
`${prefix} is not an object`
);
(0, import_assert.default)(
trigger.type === "queue/v1beta",
`${prefix}.type must be "queue/v1beta"`
);
(0, import_assert.default)(
typeof trigger.topic === "string",
`${prefix}.topic is required and must be a string`
);
(0, import_assert.default)(trigger.topic.length > 0, `${prefix}.topic cannot be empty`);
(0, import_assert.default)(
typeof trigger.consumer === "string",
`${prefix}.consumer is required and must be a string`
);
(0, import_assert.default)(
trigger.consumer.length > 0,
`${prefix}.consumer cannot be empty`
);
if (trigger.maxDeliveries !== void 0) {
(0, import_assert.default)(
typeof trigger.maxDeliveries === "number",
`${prefix}.maxDeliveries must be a number`
);
(0, import_assert.default)(
Number.isInteger(trigger.maxDeliveries) && trigger.maxDeliveries >= 1,
`${prefix}.maxDeliveries must be at least 1`
);
}
if (trigger.retryAfterSeconds !== void 0) {
(0, import_assert.default)(
typeof trigger.retryAfterSeconds === "number",
`${prefix}.retryAfterSeconds must be a number`
);
(0, import_assert.default)(
trigger.retryAfterSeconds > 0,
`${prefix}.retryAfterSeconds must be a positive number`
);
}
if (trigger.initialDelaySeconds !== void 0) {
(0, import_assert.default)(
typeof trigger.initialDelaySeconds === "number",
`${prefix}.initialDelaySeconds must be a number`
);
(0, import_assert.default)(
trigger.initialDelaySeconds >= 0,
`${prefix}.initialDelaySeconds must be a non-negative number`
);
}
if (trigger.maxConcurrency !== void 0) {
(0, import_assert.default)(
typeof trigger.maxConcurrency === "number",
`${prefix}.maxConcurrency must be a number`
);
(0, import_assert.default)(
Number.isInteger(trigger.maxConcurrency) && trigger.maxConcurrency >= 1,
`${prefix}.maxConcurrency must be at least 1`
);
}
}
}
if (supportsCancellation !== void 0) {
(0, import_assert.default)(
typeof supportsCancellation === "boolean",
'"supportsCancellation" is not a boolean'
);
}
this.type = "Lambda";
this.operationType = operationType;
this.files = "files" in opts ? opts.files : void 0;
this.handler = handler;
this.runtime = runtime;
this.runtimeLanguage = runtimeLanguage;
this.architecture = getDefaultLambdaArchitecture(architecture);
this.memory = memory;
this.maxDuration = maxDuration;
this.environment = environment;
this.allowQuery = allowQuery;
this.regions = regions;
this.zipBuffer = "zipBuffer" in opts ? opts.zipBuffer : void 0;
this.supportsMultiPayloads = supportsMultiPayloads;
this.supportsWrapper = supportsWrapper;
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
this.framework = framework;
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
this.experimentalTriggers = experimentalTriggers;
this.supportsCancellation = supportsCancellation;
this.shouldDisableAutomaticFetchInstrumentation = shouldDisableAutomaticFetchInstrumentation;
}
async createZip() {
let { zipBuffer } = this;
if (!zipBuffer) {
if (!this.files) {
throw new Error("`files` is not defined");
}
await sema.acquire();
try {
zipBuffer = await createZip(this.files);
} finally {
sema.release();
}
}
return zipBuffer;
}
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
get experimentalResponseStreaming() {
return this.supportsResponseStreaming;
}
set experimentalResponseStreaming(v) {
this.supportsResponseStreaming = v;
}
}
const sema = new import_async_sema.default(10);
const mtime = /* @__PURE__ */ new Date(154e10);
async function createLambda(opts) {
const lambda = new Lambda(opts);
lambda.zipBuffer = await lambda.createZip();
return lambda;
}
async function createZip(files) {
const names = Object.keys(files).sort();
const symlinkTargets = /* @__PURE__ */ new Map();
for (const name of names) {
const file = files[name];
if (file.mode && (0, import_download.isSymbolicLink)(file.mode) && file.type === "FileFsRef") {
const symlinkTarget = await (0, import_fs_extra.readlink)(file.fsPath);
symlinkTargets.set(name, symlinkTarget);
}
}
const zipFile = new import_yazl.ZipFile();
const zipBuffer = await new Promise((resolve, reject) => {
for (const name of names) {
const file = files[name];
const opts = { mode: file.mode, mtime };
const symlinkTarget = symlinkTargets.get(name);
if (typeof symlinkTarget === "string") {
zipFile.addBuffer(Buffer.from(symlinkTarget, "utf8"), name, opts);
} else if (file.mode && (0, import_download.isDirectory)(file.mode)) {
zipFile.addEmptyDirectory(name, opts);
} else {
const stream = file.toStream();
stream.on("error", reject);
zipFile.addReadStream(stream, name, opts);
}
}
zipFile.end();
(0, import_stream_to_buffer.default)(zipFile.outputStream).then(resolve).catch(reject);
});
return zipBuffer;
}
async function getLambdaOptionsFromFunction({
sourceFile,
config
}) {
if (config?.functions) {
for (const [pattern, fn] of Object.entries(config.functions)) {
if (sourceFile === pattern || (0, import_minimatch.default)(sourceFile, pattern)) {
return {
architecture: fn.architecture,
memory: fn.memory,
maxDuration: fn.maxDuration,
experimentalTriggers: fn.experimentalTriggers,
supportsCancellation: fn.supportsCancellation
};
}
}
}
return {};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Lambda,
createLambda,
createZip,
getLambdaOptionsFromFunction
});

View file

@ -0,0 +1,16 @@
import { Lambda, LambdaOptionsWithFiles } from './lambda';
interface NodejsLambdaOptions extends LambdaOptionsWithFiles {
shouldAddHelpers: boolean;
shouldAddSourcemapSupport: boolean;
awsLambdaHandler?: string;
useWebApi?: boolean;
}
export declare class NodejsLambda extends Lambda {
launcherType: 'Nodejs';
shouldAddHelpers: boolean;
shouldAddSourcemapSupport: boolean;
awsLambdaHandler?: string;
useWebApi?: boolean;
constructor({ shouldAddHelpers, shouldAddSourcemapSupport, awsLambdaHandler, useWebApi, ...opts }: NodejsLambdaOptions);
}
export {};

44
node_modules/@vercel/build-utils/dist/nodejs-lambda.js generated vendored Normal file
View file

@ -0,0 +1,44 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var nodejs_lambda_exports = {};
__export(nodejs_lambda_exports, {
NodejsLambda: () => NodejsLambda
});
module.exports = __toCommonJS(nodejs_lambda_exports);
var import_lambda = require("./lambda");
class NodejsLambda extends import_lambda.Lambda {
constructor({
shouldAddHelpers,
shouldAddSourcemapSupport,
awsLambdaHandler,
useWebApi,
...opts
}) {
super(opts);
this.launcherType = "Nodejs";
this.shouldAddHelpers = shouldAddHelpers;
this.shouldAddSourcemapSupport = shouldAddSourcemapSupport;
this.awsLambdaHandler = awsLambdaHandler;
this.useWebApi = useWebApi;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NodejsLambda
});

3
node_modules/@vercel/build-utils/dist/os.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
export declare function getOsRelease(): Promise<Record<string, string> | null>;
export declare function parseOsRelease(data: string): Promise<Record<string, string>>;
export declare function getProvidedRuntime(): Promise<"provided.al2023" | "provided.al2">;

62
node_modules/@vercel/build-utils/dist/os.js generated vendored Normal file
View file

@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var os_exports = {};
__export(os_exports, {
getOsRelease: () => getOsRelease,
getProvidedRuntime: () => getProvidedRuntime,
parseOsRelease: () => parseOsRelease
});
module.exports = __toCommonJS(os_exports);
var import_fs_extra = require("fs-extra");
var import_error_utils = require("@vercel/error-utils");
async function getOsRelease() {
try {
const data = await (0, import_fs_extra.readFile)("/etc/os-release", "utf8");
return await parseOsRelease(data);
} catch (err) {
if ((0, import_error_utils.isErrnoException)(err) && err.code === "ENOENT") {
return null;
}
throw err;
}
}
async function parseOsRelease(data) {
const obj = {};
for (const line of data.trim().split("\n")) {
const m = /(?<key>.*)="(?<value>.*)"/.exec(line);
if (!m?.groups) {
continue;
}
obj[m.groups.key] = m.groups.value;
}
return obj;
}
async function getProvidedRuntime() {
const os = await getOsRelease();
if (!os) {
return "provided.al2023";
}
return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getOsRelease,
getProvidedRuntime,
parseOsRelease
});

48
node_modules/@vercel/build-utils/dist/prerender.d.ts generated vendored Normal file
View file

@ -0,0 +1,48 @@
import type { File, HasField, Chain } from './types';
import { Lambda } from './lambda';
interface PrerenderOptions {
expiration: number | false;
staleExpiration?: number;
lambda?: Lambda;
fallback: File | null;
group?: number;
bypassToken?: string | null;
allowQuery?: string[];
allowHeader?: string[];
initialHeaders?: Record<string, string>;
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
experimentalBypassFor?: HasField;
experimentalStreamingLambdaPath?: string;
chain?: Chain;
}
export declare class Prerender {
type: 'Prerender';
/**
* `expiration` is `revalidate` in Next.js terms, and `s-maxage` in
* `cache-control` terms.
*/
expiration: number | false;
/**
* `staleExpiration` is `expire` in Next.js terms, and
* `stale-while-revalidate` + `s-maxage` in `cache-control` terms. It's
* expected to be undefined if `expiration` is `false`.
*/
staleExpiration?: number;
lambda?: Lambda;
fallback: File | null;
group?: number;
bypassToken: string | null;
allowQuery?: string[];
allowHeader?: string[];
initialHeaders?: Record<string, string>;
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
experimentalBypassFor?: HasField;
experimentalStreamingLambdaPath?: string;
chain?: Chain;
constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
}
export {};

170
node_modules/@vercel/build-utils/dist/prerender.js generated vendored Normal file
View file

@ -0,0 +1,170 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var prerender_exports = {};
__export(prerender_exports, {
Prerender: () => Prerender
});
module.exports = __toCommonJS(prerender_exports);
class Prerender {
constructor({
expiration,
staleExpiration,
lambda,
fallback,
group,
bypassToken,
allowQuery,
allowHeader,
initialHeaders,
initialStatus,
passQuery,
sourcePath,
experimentalBypassFor,
experimentalStreamingLambdaPath,
chain
}) {
this.type = "Prerender";
this.expiration = expiration;
this.staleExpiration = staleExpiration;
this.sourcePath = sourcePath;
this.lambda = lambda;
if (this.lambda) {
this.lambda.operationType = this.lambda.operationType || "ISR";
}
if (typeof group !== "undefined" && (group <= 0 || !Number.isInteger(group))) {
throw new Error(
"The `group` argument for `Prerender` needs to be a natural number."
);
}
this.group = group;
if (passQuery === true) {
this.passQuery = true;
} else if (typeof passQuery !== "boolean" && typeof passQuery !== "undefined") {
throw new Error(
`The \`passQuery\` argument for \`Prerender\` must be a boolean.`
);
}
if (bypassToken == null) {
this.bypassToken = null;
} else if (typeof bypassToken === "string") {
if (bypassToken.length < 32) {
throw new Error(
"The `bypassToken` argument for `Prerender` must be 32 characters or more."
);
}
this.bypassToken = bypassToken;
} else {
throw new Error(
"The `bypassToken` argument for `Prerender` must be a `string`."
);
}
if (experimentalBypassFor !== void 0) {
if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
(field) => typeof field !== "object" || typeof field.type !== "string" || field.type === "host" && "key" in field || field.type !== "host" && typeof field.key !== "string" || field.value !== void 0 && typeof field.value !== "string" && (typeof field.value !== "object" || field.value === null || Array.isArray(field.value))
)) {
throw new Error(
"The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
);
}
this.experimentalBypassFor = experimentalBypassFor;
}
if (typeof fallback === "undefined") {
throw new Error(
"The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null."
);
}
this.fallback = fallback;
if (initialHeaders !== void 0) {
if (!initialHeaders || typeof initialHeaders !== "object" || Object.entries(initialHeaders).some(
([key, value]) => typeof key !== "string" || typeof value !== "string"
)) {
throw new Error(
`The \`initialHeaders\` argument for \`Prerender\` must be an object with string key/values`
);
}
this.initialHeaders = initialHeaders;
}
if (initialStatus !== void 0) {
if (initialStatus <= 0 || !Number.isInteger(initialStatus)) {
throw new Error(
`The \`initialStatus\` argument for \`Prerender\` must be a natural number.`
);
}
this.initialStatus = initialStatus;
}
if (allowQuery !== void 0) {
if (!Array.isArray(allowQuery)) {
throw new Error(
"The `allowQuery` argument for `Prerender` must be Array."
);
}
if (!allowQuery.every((q) => typeof q === "string")) {
throw new Error(
"The `allowQuery` argument for `Prerender` must be Array of strings."
);
}
this.allowQuery = allowQuery;
}
if (allowHeader !== void 0) {
if (!Array.isArray(allowHeader)) {
throw new Error(
"The `allowHeader` argument for `Prerender` must be Array."
);
}
if (!allowHeader.every((q) => typeof q === "string")) {
throw new Error(
"The `allowHeader` argument for `Prerender` must be Array of strings."
);
}
this.allowHeader = allowHeader;
}
if (experimentalStreamingLambdaPath !== void 0) {
if (typeof experimentalStreamingLambdaPath !== "string") {
throw new Error(
"The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string."
);
}
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
}
if (chain !== void 0) {
if (typeof chain !== "object") {
throw new Error(
"The `chain` argument for `Prerender` must be an object."
);
}
if (!chain.headers || typeof chain.headers !== "object" || Object.entries(chain.headers).some(
([key, value]) => typeof key !== "string" || typeof value !== "string"
)) {
throw new Error(
`The \`chain.headers\` argument for \`Prerender\` must be an object with string key/values`
);
}
if (!chain.outputPath || typeof chain.outputPath !== "string") {
throw new Error(
"The `chain.outputPath` argument for `Prerender` must be a string."
);
}
this.chain = chain;
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Prerender
});

22
node_modules/@vercel/build-utils/dist/python.d.ts generated vendored Normal file
View file

@ -0,0 +1,22 @@
import FileFsRef from './file-fs-ref';
/**
* Run a Python script that only uses the standard library.
*/
export declare function runStdlibPyScript(options: {
scriptName: string;
pythonPath?: string;
args?: string[];
cwd?: string;
}): Promise<{
exitCode: number;
stdout: string;
stderr: string;
}>;
/**
* Check if a Python file is a valid entrypoint by detecting:
* - A top-level 'app' callable (Flask, FastAPI, Sanic, WSGI/ASGI, etc.)
* - A top-level 'handler' class (BaseHTTPRequestHandler subclass)
*/
export declare function isPythonEntrypoint(file: FileFsRef | {
fsPath?: string;
}): Promise<boolean>;

85
node_modules/@vercel/build-utils/dist/python.js generated vendored Normal file
View file

@ -0,0 +1,85 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var python_exports = {};
__export(python_exports, {
isPythonEntrypoint: () => isPythonEntrypoint,
runStdlibPyScript: () => runStdlibPyScript
});
module.exports = __toCommonJS(python_exports);
var import_fs = __toESM(require("fs"));
var import_path = require("path");
var import_execa = __toESM(require("execa"));
var import_debug = __toESM(require("./debug"));
const isWin = process.platform === "win32";
async function runStdlibPyScript(options) {
const { scriptName, pythonPath, args = [], cwd } = options;
const scriptPath = (0, import_path.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
if (!import_fs.default.existsSync(scriptPath)) {
throw new Error(`Python script not found: ${scriptPath}`);
}
const pythonCmd = pythonPath ?? (isWin ? "python" : "python3");
(0, import_debug.default)(
`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`
);
try {
const result = await (0, import_execa.default)(pythonCmd, [scriptPath, ...args], { cwd });
return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
} catch (err) {
const execaErr = err;
return {
exitCode: execaErr.exitCode ?? 1,
stdout: execaErr.stdout ?? "",
stderr: execaErr.stderr ?? ""
};
}
}
async function isPythonEntrypoint(file) {
try {
const fsPath = file.fsPath;
if (!fsPath)
return false;
const content = await import_fs.default.promises.readFile(fsPath, "utf-8");
if (!content.includes("app") && !content.includes("handler") && !content.includes("Handler")) {
return false;
}
const result = await runStdlibPyScript({
scriptName: "ast_parser",
args: [fsPath]
});
return result.exitCode === 0;
} catch (err) {
(0, import_debug.default)(`Failed to check Python entrypoint: ${err}`);
return false;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
isPythonEntrypoint,
runStdlibPyScript
});

105
node_modules/@vercel/build-utils/dist/schemas.d.ts generated vendored Normal file
View file

@ -0,0 +1,105 @@
export declare const functionsSchema: {
type: string;
minProperties: number;
maxProperties: number;
additionalProperties: boolean;
patternProperties: {
'^.{1,256}$': {
type: string;
additionalProperties: boolean;
properties: {
architecture: {
type: string;
enum: string[];
};
runtime: {
type: string;
maxLength: number;
};
memory: {
minimum: number;
maximum: number;
};
maxDuration: {
type: string;
minimum: number;
maximum: number;
};
includeFiles: {
type: string;
maxLength: number;
};
excludeFiles: {
type: string;
maxLength: number;
};
experimentalTriggers: {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
const: string;
};
topic: {
type: string;
minLength: number;
};
consumer: {
type: string;
minLength: number;
};
maxDeliveries: {
type: string;
minimum: number;
};
retryAfterSeconds: {
type: string;
exclusiveMinimum: number;
};
initialDelaySeconds: {
type: string;
minimum: number;
};
maxConcurrency: {
type: string;
minimum: number;
};
};
required: string[];
additionalProperties: boolean;
};
};
supportsCancellation: {
type: string;
};
};
};
};
};
export declare const buildsSchema: {
type: string;
minItems: number;
maxItems: number;
items: {
type: string;
additionalProperties: boolean;
required: string[];
properties: {
src: {
type: string;
minLength: number;
maxLength: number;
};
use: {
type: string;
minLength: number;
maxLength: number;
};
config: {
type: string;
};
};
};
};

133
node_modules/@vercel/build-utils/dist/schemas.js generated vendored Normal file
View file

@ -0,0 +1,133 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var schemas_exports = {};
__export(schemas_exports, {
buildsSchema: () => buildsSchema,
functionsSchema: () => functionsSchema
});
module.exports = __toCommonJS(schemas_exports);
const triggerEventSchema = {
type: "object",
properties: {
type: {
type: "string",
const: "queue/v1beta"
},
topic: {
type: "string",
minLength: 1
},
consumer: {
type: "string",
minLength: 1
},
maxDeliveries: {
type: "number",
minimum: 1
},
retryAfterSeconds: {
type: "number",
exclusiveMinimum: 0
},
initialDelaySeconds: {
type: "number",
minimum: 0
},
maxConcurrency: {
type: "number",
minimum: 1
}
},
required: ["type", "topic", "consumer"],
additionalProperties: false
};
const functionsSchema = {
type: "object",
minProperties: 1,
maxProperties: 50,
additionalProperties: false,
patternProperties: {
"^.{1,256}$": {
type: "object",
additionalProperties: false,
properties: {
architecture: {
type: "string",
enum: ["x86_64", "arm64"]
},
runtime: {
type: "string",
maxLength: 256
},
memory: {
minimum: 128,
maximum: 10240
},
maxDuration: {
type: "number",
minimum: 1,
maximum: 900
},
includeFiles: {
type: "string",
maxLength: 256
},
excludeFiles: {
type: "string",
maxLength: 256
},
experimentalTriggers: {
type: "array",
items: triggerEventSchema
},
supportsCancellation: {
type: "boolean"
}
}
}
}
};
const buildsSchema = {
type: "array",
minItems: 0,
maxItems: 128,
items: {
type: "object",
additionalProperties: false,
required: ["use"],
properties: {
src: {
type: "string",
minLength: 1,
maxLength: 4096
},
use: {
type: "string",
minLength: 3,
maxLength: 256
},
config: { type: "object" }
}
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buildsSchema,
functionsSchema
});

View file

@ -0,0 +1,2 @@
import type { ShouldServe } from './types';
export declare const shouldServe: ShouldServe;

47
node_modules/@vercel/build-utils/dist/should-serve.js generated vendored Normal file
View file

@ -0,0 +1,47 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var should_serve_exports = {};
__export(should_serve_exports, {
shouldServe: () => shouldServe
});
module.exports = __toCommonJS(should_serve_exports);
var import_path = require("path");
const shouldServe = ({
entrypoint,
files,
requestPath
}) => {
requestPath = requestPath.replace(/\/$/, "");
entrypoint = entrypoint.replace(/\\/, "/");
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
return true;
}
const { dir, name } = (0, import_path.parse)(entrypoint);
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
return true;
}
return false;
};
function hasProp(obj, key) {
return Object.hasOwnProperty.call(obj, key);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
shouldServe
});

View file

@ -0,0 +1,2 @@
export declare const BUILDER_INSTALLER_STEP = "vc.builder.install";
export declare const BUILDER_COMPILE_STEP = "vc.builder.build";

View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var constants_exports = {};
__export(constants_exports, {
BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP
});
module.exports = __toCommonJS(constants_exports);
const BUILDER_INSTALLER_STEP = "vc.builder.install";
const BUILDER_COMPILE_STEP = "vc.builder.build";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP
});

View file

@ -0,0 +1,3 @@
export { Span } from './trace';
export { BUILDER_COMPILE_STEP, BUILDER_INSTALLER_STEP } from './constants';
export type { SpanId, TraceEvent, Reporter } from './trace';

33
node_modules/@vercel/build-utils/dist/trace/index.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var trace_exports = {};
__export(trace_exports, {
BUILDER_COMPILE_STEP: () => import_constants.BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP: () => import_constants.BUILDER_INSTALLER_STEP,
Span: () => import_trace.Span
});
module.exports = __toCommonJS(trace_exports);
var import_trace = require("./trace");
var import_constants = require("./constants");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP,
Span
});

37
node_modules/@vercel/build-utils/dist/trace/trace.d.ts generated vendored Normal file
View file

@ -0,0 +1,37 @@
export type SpanId = string;
export type TraceEvent = {
parentId?: SpanId;
name: string;
id: SpanId;
timestamp: number;
duration: number;
tags: Record<string, string>;
startTime: number;
};
export type Reporter = {
report: (event: TraceEvent) => void;
};
interface Attributes {
[key: string]: string | undefined;
}
export declare class Span {
private name;
private id;
private parentId?;
private attrs;
private status;
private _start;
private now;
private _reporter;
constructor({ name, parentId, attrs, reporter, }: {
name: string;
parentId?: SpanId;
attrs?: Attributes;
reporter?: Reporter;
});
stop(): void;
setAttributes(attrs: Attributes): void;
child(name: string, attrs?: Attributes): Span;
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
}
export {};

Some files were not shown because too many files have changed in this diff Show more