vercel-cli 41.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vercel-cli might be problematic. Click here for more details.
- vercel_cli/vendor/LICENSE +202 -0
- vercel_cli/vendor/README.md +63 -0
- vercel_cli/vendor/dist/VERCEL_DIR_README.txt +11 -0
- vercel_cli/vendor/dist/builder-worker.js +62 -0
- vercel_cli/vendor/dist/get-latest-worker.js +272 -0
- vercel_cli/vendor/dist/index.js +172693 -0
- vercel_cli/vendor/dist/vc.js +11 -0
- vercel_cli/vendor/node_modules/.package-lock.json +18 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/CHANGELOG.md +488 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/LICENSE +202 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/build.mjs +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/clone-env.d.ts +10 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/clone-env.js +43 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/debug.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/debug.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/default-cache-path-glob.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/default-cache-path-glob.js +28 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/edge-function.d.ts +41 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/edge-function.js +40 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/errors.d.ts +39 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/errors.js +95 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-blob.d.ts +23 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-blob.js +67 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-fs-ref.d.ts +27 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-fs-ref.js +113 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-ref.d.ts +38 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-ref.js +147 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/download.d.ts +9 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/download.js +136 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/get-writable-directory.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/get-writable-directory.js +32 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/glob.d.ts +10 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/glob.js +111 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.d.ts +9 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.js +180 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/normalize-path.d.ts +4 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/normalize-path.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.js +76 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/rename.d.ts +11 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/rename.js +30 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts +206 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js +944 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.js +87 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-ignore-filter.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-ignore-filter.js +90 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-installed-package-version.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-installed-package-version.js +53 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-platform-env.d.ts +5 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-platform-env.js +45 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-prefixed-env-vars.d.ts +14 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-prefixed-env-vars.js +51 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/hard-link-dir.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/hard-link-dir.js +104 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.d.ts +33 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.js +24390 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.d.ts +81 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.js +231 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/nodejs-lambda.d.ts +16 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/nodejs-lambda.js +44 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/os.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/os.js +62 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/prerender.d.ts +37 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/prerender.js +169 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/schemas.d.ts +60 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/schemas.js +87 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/should-serve.d.ts +2 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/should-serve.js +47 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/constants.d.ts +2 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/constants.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/index.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/index.js +33 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/trace.d.ts +37 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/trace.js +92 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.d.ts +503 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.js +51 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/validate-npmrc.d.ts +12 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/validate-npmrc.js +41 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-blob.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-fs-ref.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-ref.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/download.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/get-writable-directory.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/glob.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/rename.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/run-user-scripts.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/stream-to-buffer.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/lambda.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/package.json +60 -0
- vercel_cli/vendor/node_modules/@vercel/python/LICENSE +202 -0
- vercel_cli/vendor/node_modules/@vercel/python/dist/index.js +3132 -0
- vercel_cli/vendor/node_modules/@vercel/python/package.json +36 -0
- vercel_cli/vendor/node_modules/@vercel/python/vc_init.py +681 -0
- vercel_cli/vendor/package.json +40 -0
- vercel_cli-41.1.0.dist-info/METADATA +188 -0
- vercel_cli-41.1.0.dist-info/RECORD +99 -0
- vercel_cli-41.1.0.dist-info/WHEEL +4 -0
- vercel_cli-41.1.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Config, Env, Files, FunctionFramework } from './types';
|
|
3
|
+
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
|
4
|
+
export type LambdaArchitecture = 'x86_64' | 'arm64';
|
|
5
|
+
export interface LambdaOptionsBase {
|
|
6
|
+
handler: string;
|
|
7
|
+
runtime: string;
|
|
8
|
+
architecture?: LambdaArchitecture;
|
|
9
|
+
memory?: number;
|
|
10
|
+
maxDuration?: number;
|
|
11
|
+
environment?: Env;
|
|
12
|
+
allowQuery?: string[];
|
|
13
|
+
regions?: string[];
|
|
14
|
+
supportsMultiPayloads?: boolean;
|
|
15
|
+
supportsWrapper?: boolean;
|
|
16
|
+
supportsResponseStreaming?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use the `supportsResponseStreaming` property instead.
|
|
19
|
+
*/
|
|
20
|
+
experimentalResponseStreaming?: boolean;
|
|
21
|
+
operationType?: string;
|
|
22
|
+
framework?: FunctionFramework;
|
|
23
|
+
}
|
|
24
|
+
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
|
|
25
|
+
files: Files;
|
|
26
|
+
experimentalAllowBundling?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `LambdaOptionsWithFiles` instead.
|
|
30
|
+
*/
|
|
31
|
+
export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `files` property instead.
|
|
34
|
+
*/
|
|
35
|
+
zipBuffer: Buffer;
|
|
36
|
+
}
|
|
37
|
+
interface GetLambdaOptionsFromFunctionOptions {
|
|
38
|
+
sourceFile: string;
|
|
39
|
+
config?: Pick<Config, 'functions'>;
|
|
40
|
+
}
|
|
41
|
+
export declare class Lambda {
|
|
42
|
+
type: 'Lambda';
|
|
43
|
+
/**
|
|
44
|
+
* This is a label for the type of Lambda a framework is producing.
|
|
45
|
+
* The value can be any string that makes sense for a given framework.
|
|
46
|
+
* Examples: "API", "ISR", "SSR", "SSG", "Render", "Resource"
|
|
47
|
+
*/
|
|
48
|
+
operationType?: string;
|
|
49
|
+
files?: Files;
|
|
50
|
+
handler: string;
|
|
51
|
+
runtime: string;
|
|
52
|
+
architecture?: LambdaArchitecture;
|
|
53
|
+
memory?: number;
|
|
54
|
+
maxDuration?: number;
|
|
55
|
+
environment: Env;
|
|
56
|
+
allowQuery?: string[];
|
|
57
|
+
regions?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use `await lambda.createZip()` instead.
|
|
60
|
+
*/
|
|
61
|
+
zipBuffer?: Buffer;
|
|
62
|
+
supportsMultiPayloads?: boolean;
|
|
63
|
+
supportsWrapper?: boolean;
|
|
64
|
+
supportsResponseStreaming?: boolean;
|
|
65
|
+
framework?: FunctionFramework;
|
|
66
|
+
experimentalAllowBundling?: boolean;
|
|
67
|
+
constructor(opts: LambdaOptions);
|
|
68
|
+
createZip(): Promise<Buffer>;
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Use the `supportsResponseStreaming` property instead.
|
|
71
|
+
*/
|
|
72
|
+
get experimentalResponseStreaming(): boolean | undefined;
|
|
73
|
+
set experimentalResponseStreaming(v: boolean | undefined);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Use `new Lambda()` instead.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
|
79
|
+
export declare function createZip(files: Files): Promise<Buffer>;
|
|
80
|
+
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var lambda_exports = {};
|
|
30
|
+
__export(lambda_exports, {
|
|
31
|
+
Lambda: () => Lambda,
|
|
32
|
+
createLambda: () => createLambda,
|
|
33
|
+
createZip: () => createZip,
|
|
34
|
+
getLambdaOptionsFromFunction: () => getLambdaOptionsFromFunction
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(lambda_exports);
|
|
37
|
+
var import_assert = __toESM(require("assert"));
|
|
38
|
+
var import_async_sema = __toESM(require("async-sema"));
|
|
39
|
+
var import_yazl = require("yazl");
|
|
40
|
+
var import_minimatch = __toESM(require("minimatch"));
|
|
41
|
+
var import_fs_extra = require("fs-extra");
|
|
42
|
+
var import_download = require("./fs/download");
|
|
43
|
+
var import_stream_to_buffer = __toESM(require("./fs/stream-to-buffer"));
|
|
44
|
+
class Lambda {
|
|
45
|
+
constructor(opts) {
|
|
46
|
+
const {
|
|
47
|
+
handler,
|
|
48
|
+
runtime,
|
|
49
|
+
maxDuration,
|
|
50
|
+
architecture,
|
|
51
|
+
memory,
|
|
52
|
+
environment = {},
|
|
53
|
+
allowQuery,
|
|
54
|
+
regions,
|
|
55
|
+
supportsMultiPayloads,
|
|
56
|
+
supportsWrapper,
|
|
57
|
+
supportsResponseStreaming,
|
|
58
|
+
experimentalResponseStreaming,
|
|
59
|
+
operationType,
|
|
60
|
+
framework
|
|
61
|
+
} = opts;
|
|
62
|
+
if ("files" in opts) {
|
|
63
|
+
(0, import_assert.default)(typeof opts.files === "object", '"files" must be an object');
|
|
64
|
+
}
|
|
65
|
+
if ("zipBuffer" in opts) {
|
|
66
|
+
(0, import_assert.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
|
|
67
|
+
}
|
|
68
|
+
(0, import_assert.default)(typeof handler === "string", '"handler" is not a string');
|
|
69
|
+
(0, import_assert.default)(typeof runtime === "string", '"runtime" is not a string');
|
|
70
|
+
(0, import_assert.default)(typeof environment === "object", '"environment" is not an object');
|
|
71
|
+
if (architecture !== void 0) {
|
|
72
|
+
(0, import_assert.default)(
|
|
73
|
+
architecture === "x86_64" || architecture === "arm64",
|
|
74
|
+
'"architecture" must be either "x86_64" or "arm64"'
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) {
|
|
78
|
+
(0, import_assert.default)(
|
|
79
|
+
typeof opts.experimentalAllowBundling === "boolean",
|
|
80
|
+
'"experimentalAllowBundling" is not a boolean'
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
if (memory !== void 0) {
|
|
84
|
+
(0, import_assert.default)(typeof memory === "number", '"memory" is not a number');
|
|
85
|
+
}
|
|
86
|
+
if (maxDuration !== void 0) {
|
|
87
|
+
(0, import_assert.default)(typeof maxDuration === "number", '"maxDuration" is not a number');
|
|
88
|
+
}
|
|
89
|
+
if (allowQuery !== void 0) {
|
|
90
|
+
(0, import_assert.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
|
91
|
+
(0, import_assert.default)(
|
|
92
|
+
allowQuery.every((q) => typeof q === "string"),
|
|
93
|
+
'"allowQuery" is not a string Array'
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (supportsMultiPayloads !== void 0) {
|
|
97
|
+
(0, import_assert.default)(
|
|
98
|
+
typeof supportsMultiPayloads === "boolean",
|
|
99
|
+
'"supportsMultiPayloads" is not a boolean'
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (supportsWrapper !== void 0) {
|
|
103
|
+
(0, import_assert.default)(
|
|
104
|
+
typeof supportsWrapper === "boolean",
|
|
105
|
+
'"supportsWrapper" is not a boolean'
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
if (regions !== void 0) {
|
|
109
|
+
(0, import_assert.default)(Array.isArray(regions), '"regions" is not an Array');
|
|
110
|
+
(0, import_assert.default)(
|
|
111
|
+
regions.every((r) => typeof r === "string"),
|
|
112
|
+
'"regions" is not a string Array'
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (framework !== void 0) {
|
|
116
|
+
(0, import_assert.default)(typeof framework === "object", '"framework" is not an object');
|
|
117
|
+
(0, import_assert.default)(
|
|
118
|
+
typeof framework.slug === "string",
|
|
119
|
+
'"framework.slug" is not a string'
|
|
120
|
+
);
|
|
121
|
+
if (framework.version !== void 0) {
|
|
122
|
+
(0, import_assert.default)(
|
|
123
|
+
typeof framework.version === "string",
|
|
124
|
+
'"framework.version" is not a string'
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
this.type = "Lambda";
|
|
129
|
+
this.operationType = operationType;
|
|
130
|
+
this.files = "files" in opts ? opts.files : void 0;
|
|
131
|
+
this.handler = handler;
|
|
132
|
+
this.runtime = runtime;
|
|
133
|
+
this.architecture = architecture;
|
|
134
|
+
this.memory = memory;
|
|
135
|
+
this.maxDuration = maxDuration;
|
|
136
|
+
this.environment = environment;
|
|
137
|
+
this.allowQuery = allowQuery;
|
|
138
|
+
this.regions = regions;
|
|
139
|
+
this.zipBuffer = "zipBuffer" in opts ? opts.zipBuffer : void 0;
|
|
140
|
+
this.supportsMultiPayloads = supportsMultiPayloads;
|
|
141
|
+
this.supportsWrapper = supportsWrapper;
|
|
142
|
+
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
|
|
143
|
+
this.framework = framework;
|
|
144
|
+
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
|
|
145
|
+
}
|
|
146
|
+
async createZip() {
|
|
147
|
+
let { zipBuffer } = this;
|
|
148
|
+
if (!zipBuffer) {
|
|
149
|
+
if (!this.files) {
|
|
150
|
+
throw new Error("`files` is not defined");
|
|
151
|
+
}
|
|
152
|
+
await sema.acquire();
|
|
153
|
+
try {
|
|
154
|
+
zipBuffer = await createZip(this.files);
|
|
155
|
+
} finally {
|
|
156
|
+
sema.release();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return zipBuffer;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Use the `supportsResponseStreaming` property instead.
|
|
163
|
+
*/
|
|
164
|
+
get experimentalResponseStreaming() {
|
|
165
|
+
return this.supportsResponseStreaming;
|
|
166
|
+
}
|
|
167
|
+
set experimentalResponseStreaming(v) {
|
|
168
|
+
this.supportsResponseStreaming = v;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const sema = new import_async_sema.default(10);
|
|
172
|
+
const mtime = /* @__PURE__ */ new Date(154e10);
|
|
173
|
+
async function createLambda(opts) {
|
|
174
|
+
const lambda = new Lambda(opts);
|
|
175
|
+
lambda.zipBuffer = await lambda.createZip();
|
|
176
|
+
return lambda;
|
|
177
|
+
}
|
|
178
|
+
async function createZip(files) {
|
|
179
|
+
const names = Object.keys(files).sort();
|
|
180
|
+
const symlinkTargets = /* @__PURE__ */ new Map();
|
|
181
|
+
for (const name of names) {
|
|
182
|
+
const file = files[name];
|
|
183
|
+
if (file.mode && (0, import_download.isSymbolicLink)(file.mode) && file.type === "FileFsRef") {
|
|
184
|
+
const symlinkTarget = await (0, import_fs_extra.readlink)(file.fsPath);
|
|
185
|
+
symlinkTargets.set(name, symlinkTarget);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const zipFile = new import_yazl.ZipFile();
|
|
189
|
+
const zipBuffer = await new Promise((resolve, reject) => {
|
|
190
|
+
for (const name of names) {
|
|
191
|
+
const file = files[name];
|
|
192
|
+
const opts = { mode: file.mode, mtime };
|
|
193
|
+
const symlinkTarget = symlinkTargets.get(name);
|
|
194
|
+
if (typeof symlinkTarget === "string") {
|
|
195
|
+
zipFile.addBuffer(Buffer.from(symlinkTarget, "utf8"), name, opts);
|
|
196
|
+
} else if (file.mode && (0, import_download.isDirectory)(file.mode)) {
|
|
197
|
+
zipFile.addEmptyDirectory(name, opts);
|
|
198
|
+
} else {
|
|
199
|
+
const stream = file.toStream();
|
|
200
|
+
stream.on("error", reject);
|
|
201
|
+
zipFile.addReadStream(stream, name, opts);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
zipFile.end();
|
|
205
|
+
(0, import_stream_to_buffer.default)(zipFile.outputStream).then(resolve).catch(reject);
|
|
206
|
+
});
|
|
207
|
+
return zipBuffer;
|
|
208
|
+
}
|
|
209
|
+
async function getLambdaOptionsFromFunction({
|
|
210
|
+
sourceFile,
|
|
211
|
+
config
|
|
212
|
+
}) {
|
|
213
|
+
if (config?.functions) {
|
|
214
|
+
for (const [pattern, fn] of Object.entries(config.functions)) {
|
|
215
|
+
if (sourceFile === pattern || (0, import_minimatch.default)(sourceFile, pattern)) {
|
|
216
|
+
return {
|
|
217
|
+
memory: fn.memory,
|
|
218
|
+
maxDuration: fn.maxDuration
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return {};
|
|
224
|
+
}
|
|
225
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
226
|
+
0 && (module.exports = {
|
|
227
|
+
Lambda,
|
|
228
|
+
createLambda,
|
|
229
|
+
createZip,
|
|
230
|
+
getLambdaOptionsFromFunction
|
|
231
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Lambda, LambdaOptionsWithFiles } from './lambda';
|
|
2
|
+
interface NodejsLambdaOptions extends LambdaOptionsWithFiles {
|
|
3
|
+
shouldAddHelpers: boolean;
|
|
4
|
+
shouldAddSourcemapSupport: boolean;
|
|
5
|
+
awsLambdaHandler?: string;
|
|
6
|
+
useWebApi?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class NodejsLambda extends Lambda {
|
|
9
|
+
launcherType: 'Nodejs';
|
|
10
|
+
shouldAddHelpers: boolean;
|
|
11
|
+
shouldAddSourcemapSupport: boolean;
|
|
12
|
+
awsLambdaHandler?: string;
|
|
13
|
+
useWebApi?: boolean;
|
|
14
|
+
constructor({ shouldAddHelpers, shouldAddSourcemapSupport, awsLambdaHandler, useWebApi, ...opts }: NodejsLambdaOptions);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var nodejs_lambda_exports = {};
|
|
20
|
+
__export(nodejs_lambda_exports, {
|
|
21
|
+
NodejsLambda: () => NodejsLambda
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(nodejs_lambda_exports);
|
|
24
|
+
var import_lambda = require("./lambda");
|
|
25
|
+
class NodejsLambda extends import_lambda.Lambda {
|
|
26
|
+
constructor({
|
|
27
|
+
shouldAddHelpers,
|
|
28
|
+
shouldAddSourcemapSupport,
|
|
29
|
+
awsLambdaHandler,
|
|
30
|
+
useWebApi,
|
|
31
|
+
...opts
|
|
32
|
+
}) {
|
|
33
|
+
super(opts);
|
|
34
|
+
this.launcherType = "Nodejs";
|
|
35
|
+
this.shouldAddHelpers = shouldAddHelpers;
|
|
36
|
+
this.shouldAddSourcemapSupport = shouldAddSourcemapSupport;
|
|
37
|
+
this.awsLambdaHandler = awsLambdaHandler;
|
|
38
|
+
this.useWebApi = useWebApi;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
NodejsLambda
|
|
44
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var os_exports = {};
|
|
20
|
+
__export(os_exports, {
|
|
21
|
+
getOsRelease: () => getOsRelease,
|
|
22
|
+
getProvidedRuntime: () => getProvidedRuntime,
|
|
23
|
+
parseOsRelease: () => parseOsRelease
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(os_exports);
|
|
26
|
+
var import_fs_extra = require("fs-extra");
|
|
27
|
+
var import_error_utils = require("@vercel/error-utils");
|
|
28
|
+
async function getOsRelease() {
|
|
29
|
+
try {
|
|
30
|
+
const data = await (0, import_fs_extra.readFile)("/etc/os-release", "utf8");
|
|
31
|
+
return await parseOsRelease(data);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
if ((0, import_error_utils.isErrnoException)(err) && err.code === "ENOENT") {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function parseOsRelease(data) {
|
|
40
|
+
const obj = {};
|
|
41
|
+
for (const line of data.trim().split("\n")) {
|
|
42
|
+
const m = /(?<key>.*)="(?<value>.*)"/.exec(line);
|
|
43
|
+
if (!m?.groups) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
obj[m.groups.key] = m.groups.value;
|
|
47
|
+
}
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
async function getProvidedRuntime() {
|
|
51
|
+
const os = await getOsRelease();
|
|
52
|
+
if (!os) {
|
|
53
|
+
return "provided.al2023";
|
|
54
|
+
}
|
|
55
|
+
return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
getOsRelease,
|
|
60
|
+
getProvidedRuntime,
|
|
61
|
+
parseOsRelease
|
|
62
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { File, HasField, Chain } from './types';
|
|
2
|
+
import { Lambda } from './lambda';
|
|
3
|
+
interface PrerenderOptions {
|
|
4
|
+
expiration: number | false;
|
|
5
|
+
lambda?: Lambda;
|
|
6
|
+
fallback: File | null;
|
|
7
|
+
group?: number;
|
|
8
|
+
bypassToken?: string | null;
|
|
9
|
+
allowQuery?: string[];
|
|
10
|
+
allowHeader?: string[];
|
|
11
|
+
initialHeaders?: Record<string, string>;
|
|
12
|
+
initialStatus?: number;
|
|
13
|
+
passQuery?: boolean;
|
|
14
|
+
sourcePath?: string;
|
|
15
|
+
experimentalBypassFor?: HasField;
|
|
16
|
+
experimentalStreamingLambdaPath?: string;
|
|
17
|
+
chain?: Chain;
|
|
18
|
+
}
|
|
19
|
+
export declare class Prerender {
|
|
20
|
+
type: 'Prerender';
|
|
21
|
+
expiration: number | false;
|
|
22
|
+
lambda?: Lambda;
|
|
23
|
+
fallback: File | null;
|
|
24
|
+
group?: number;
|
|
25
|
+
bypassToken: string | null;
|
|
26
|
+
allowQuery?: string[];
|
|
27
|
+
allowHeader?: string[];
|
|
28
|
+
initialHeaders?: Record<string, string>;
|
|
29
|
+
initialStatus?: number;
|
|
30
|
+
passQuery?: boolean;
|
|
31
|
+
sourcePath?: string;
|
|
32
|
+
experimentalBypassFor?: HasField;
|
|
33
|
+
experimentalStreamingLambdaPath?: string;
|
|
34
|
+
chain?: Chain;
|
|
35
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var prerender_exports = {};
|
|
20
|
+
__export(prerender_exports, {
|
|
21
|
+
Prerender: () => Prerender
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(prerender_exports);
|
|
24
|
+
class Prerender {
|
|
25
|
+
constructor({
|
|
26
|
+
expiration,
|
|
27
|
+
lambda,
|
|
28
|
+
fallback,
|
|
29
|
+
group,
|
|
30
|
+
bypassToken,
|
|
31
|
+
allowQuery,
|
|
32
|
+
allowHeader,
|
|
33
|
+
initialHeaders,
|
|
34
|
+
initialStatus,
|
|
35
|
+
passQuery,
|
|
36
|
+
sourcePath,
|
|
37
|
+
experimentalBypassFor,
|
|
38
|
+
experimentalStreamingLambdaPath,
|
|
39
|
+
chain
|
|
40
|
+
}) {
|
|
41
|
+
this.type = "Prerender";
|
|
42
|
+
this.expiration = expiration;
|
|
43
|
+
this.sourcePath = sourcePath;
|
|
44
|
+
this.lambda = lambda;
|
|
45
|
+
if (this.lambda) {
|
|
46
|
+
this.lambda.operationType = this.lambda.operationType || "ISR";
|
|
47
|
+
}
|
|
48
|
+
if (typeof group !== "undefined" && (group <= 0 || !Number.isInteger(group))) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
"The `group` argument for `Prerender` needs to be a natural number."
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
this.group = group;
|
|
54
|
+
if (passQuery === true) {
|
|
55
|
+
this.passQuery = true;
|
|
56
|
+
} else if (typeof passQuery !== "boolean" && typeof passQuery !== "undefined") {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`The \`passQuery\` argument for \`Prerender\` must be a boolean.`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
if (bypassToken == null) {
|
|
62
|
+
this.bypassToken = null;
|
|
63
|
+
} else if (typeof bypassToken === "string") {
|
|
64
|
+
if (bypassToken.length < 32) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"The `bypassToken` argument for `Prerender` must be 32 characters or more."
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
this.bypassToken = bypassToken;
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"The `bypassToken` argument for `Prerender` must be a `string`."
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (experimentalBypassFor !== void 0) {
|
|
76
|
+
if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
|
|
77
|
+
(field) => typeof field !== "object" || // host doesn't need a key
|
|
78
|
+
field.type !== "host" && typeof field.key !== "string" || typeof field.type !== "string" || field.value !== void 0 && typeof field.value !== "string"
|
|
79
|
+
)) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
"The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
this.experimentalBypassFor = experimentalBypassFor;
|
|
85
|
+
}
|
|
86
|
+
if (typeof fallback === "undefined") {
|
|
87
|
+
throw new Error(
|
|
88
|
+
"The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null."
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
this.fallback = fallback;
|
|
92
|
+
if (initialHeaders !== void 0) {
|
|
93
|
+
if (!initialHeaders || typeof initialHeaders !== "object" || Object.entries(initialHeaders).some(
|
|
94
|
+
([key, value]) => typeof key !== "string" || typeof value !== "string"
|
|
95
|
+
)) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
`The \`initialHeaders\` argument for \`Prerender\` must be an object with string key/values`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
this.initialHeaders = initialHeaders;
|
|
101
|
+
}
|
|
102
|
+
if (initialStatus !== void 0) {
|
|
103
|
+
if (initialStatus <= 0 || !Number.isInteger(initialStatus)) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
`The \`initialStatus\` argument for \`Prerender\` must be a natural number.`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
this.initialStatus = initialStatus;
|
|
109
|
+
}
|
|
110
|
+
if (allowQuery !== void 0) {
|
|
111
|
+
if (!Array.isArray(allowQuery)) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
"The `allowQuery` argument for `Prerender` must be Array."
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (!allowQuery.every((q) => typeof q === "string")) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
"The `allowQuery` argument for `Prerender` must be Array of strings."
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
this.allowQuery = allowQuery;
|
|
122
|
+
}
|
|
123
|
+
if (allowHeader !== void 0) {
|
|
124
|
+
if (!Array.isArray(allowHeader)) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
"The `allowHeader` argument for `Prerender` must be Array."
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
if (!allowHeader.every((q) => typeof q === "string")) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
"The `allowHeader` argument for `Prerender` must be Array of strings."
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
this.allowHeader = allowHeader;
|
|
135
|
+
}
|
|
136
|
+
if (experimentalStreamingLambdaPath !== void 0) {
|
|
137
|
+
if (typeof experimentalStreamingLambdaPath !== "string") {
|
|
138
|
+
throw new Error(
|
|
139
|
+
"The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string."
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
|
|
143
|
+
}
|
|
144
|
+
if (chain !== void 0) {
|
|
145
|
+
if (typeof chain !== "object") {
|
|
146
|
+
throw new Error(
|
|
147
|
+
"The `chain` argument for `Prerender` must be an object."
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
if (!chain.headers || typeof chain.headers !== "object" || Object.entries(chain.headers).some(
|
|
151
|
+
([key, value]) => typeof key !== "string" || typeof value !== "string"
|
|
152
|
+
)) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`The \`chain.headers\` argument for \`Prerender\` must be an object with string key/values`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
if (!chain.outputPath || typeof chain.outputPath !== "string") {
|
|
158
|
+
throw new Error(
|
|
159
|
+
"The `chain.outputPath` argument for `Prerender` must be a string."
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
this.chain = chain;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
Prerender
|
|
169
|
+
});
|