@vercel/python 3.1.2 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +102 -106
- package/package.json +4 -4
- package/dist/vc_init.py +0 -299
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
module.exports =
|
|
1
2
|
/******/ (() => { // webpackBootstrap
|
|
2
3
|
/******/ var __webpack_modules__ = ({
|
|
3
4
|
|
|
4
5
|
/***/ 498:
|
|
5
|
-
/***/ ((module, __unused_webpack_exports,
|
|
6
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6
7
|
|
|
7
|
-
var once =
|
|
8
|
+
var once = __webpack_require__(197);
|
|
8
9
|
|
|
9
10
|
var noop = function() {};
|
|
10
11
|
|
|
@@ -103,21 +104,21 @@ module.exports = eos;
|
|
|
103
104
|
/***/ }),
|
|
104
105
|
|
|
105
106
|
/***/ 580:
|
|
106
|
-
/***/ ((module, __unused_webpack_exports,
|
|
107
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
107
108
|
|
|
108
109
|
"use strict";
|
|
109
110
|
|
|
110
|
-
const path =
|
|
111
|
-
const childProcess =
|
|
112
|
-
const crossSpawn =
|
|
113
|
-
const stripEof =
|
|
114
|
-
const npmRunPath =
|
|
115
|
-
const isStream =
|
|
116
|
-
const _getStream =
|
|
117
|
-
const pFinally =
|
|
118
|
-
const onExit =
|
|
119
|
-
const errname =
|
|
120
|
-
const stdio =
|
|
111
|
+
const path = __webpack_require__(622);
|
|
112
|
+
const childProcess = __webpack_require__(129);
|
|
113
|
+
const crossSpawn = __webpack_require__(146);
|
|
114
|
+
const stripEof = __webpack_require__(605);
|
|
115
|
+
const npmRunPath = __webpack_require__(783);
|
|
116
|
+
const isStream = __webpack_require__(381);
|
|
117
|
+
const _getStream = __webpack_require__(136);
|
|
118
|
+
const pFinally = __webpack_require__(324);
|
|
119
|
+
const onExit = __webpack_require__(28);
|
|
120
|
+
const errname = __webpack_require__(529);
|
|
121
|
+
const stdio = __webpack_require__(205);
|
|
121
122
|
|
|
122
123
|
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
|
123
124
|
|
|
@@ -472,13 +473,13 @@ module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd,
|
|
|
472
473
|
/***/ }),
|
|
473
474
|
|
|
474
475
|
/***/ 529:
|
|
475
|
-
/***/ ((module, __unused_webpack_exports,
|
|
476
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
476
477
|
|
|
477
478
|
"use strict";
|
|
478
479
|
|
|
479
480
|
// Older verions of Node.js might not have `util.getSystemErrorName()`.
|
|
480
481
|
// In that case, fall back to a deprecated internal.
|
|
481
|
-
const util =
|
|
482
|
+
const util = __webpack_require__(669);
|
|
482
483
|
|
|
483
484
|
let uv;
|
|
484
485
|
|
|
@@ -568,14 +569,14 @@ module.exports = opts => {
|
|
|
568
569
|
/***/ }),
|
|
569
570
|
|
|
570
571
|
/***/ 146:
|
|
571
|
-
/***/ ((module, __unused_webpack_exports,
|
|
572
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
572
573
|
|
|
573
574
|
"use strict";
|
|
574
575
|
|
|
575
576
|
|
|
576
|
-
const cp =
|
|
577
|
-
const parse =
|
|
578
|
-
const enoent =
|
|
577
|
+
const cp = __webpack_require__(129);
|
|
578
|
+
const parse = __webpack_require__(892);
|
|
579
|
+
const enoent = __webpack_require__(603);
|
|
579
580
|
|
|
580
581
|
function spawn(command, args, options) {
|
|
581
582
|
// Parse the arguments
|
|
@@ -682,17 +683,17 @@ module.exports = {
|
|
|
682
683
|
/***/ }),
|
|
683
684
|
|
|
684
685
|
/***/ 892:
|
|
685
|
-
/***/ ((module, __unused_webpack_exports,
|
|
686
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
686
687
|
|
|
687
688
|
"use strict";
|
|
688
689
|
|
|
689
690
|
|
|
690
|
-
const path =
|
|
691
|
-
const niceTry =
|
|
692
|
-
const resolveCommand =
|
|
693
|
-
const escape =
|
|
694
|
-
const readShebang =
|
|
695
|
-
const semver =
|
|
691
|
+
const path = __webpack_require__(622);
|
|
692
|
+
const niceTry = __webpack_require__(369);
|
|
693
|
+
const resolveCommand = __webpack_require__(653);
|
|
694
|
+
const escape = __webpack_require__(849);
|
|
695
|
+
const readShebang = __webpack_require__(601);
|
|
696
|
+
const semver = __webpack_require__(905);
|
|
696
697
|
|
|
697
698
|
const isWin = process.platform === 'win32';
|
|
698
699
|
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
@@ -868,13 +869,13 @@ module.exports.argument = escapeArgument;
|
|
|
868
869
|
/***/ }),
|
|
869
870
|
|
|
870
871
|
/***/ 601:
|
|
871
|
-
/***/ ((module, __unused_webpack_exports,
|
|
872
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
872
873
|
|
|
873
874
|
"use strict";
|
|
874
875
|
|
|
875
876
|
|
|
876
|
-
const fs =
|
|
877
|
-
const shebangCommand =
|
|
877
|
+
const fs = __webpack_require__(747);
|
|
878
|
+
const shebangCommand = __webpack_require__(970);
|
|
878
879
|
|
|
879
880
|
function readShebang(command) {
|
|
880
881
|
// Read the first 150 bytes from the file
|
|
@@ -908,14 +909,14 @@ module.exports = readShebang;
|
|
|
908
909
|
/***/ }),
|
|
909
910
|
|
|
910
911
|
/***/ 653:
|
|
911
|
-
/***/ ((module, __unused_webpack_exports,
|
|
912
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
912
913
|
|
|
913
914
|
"use strict";
|
|
914
915
|
|
|
915
916
|
|
|
916
|
-
const path =
|
|
917
|
-
const which =
|
|
918
|
-
const pathKey =
|
|
917
|
+
const path = __webpack_require__(622);
|
|
918
|
+
const which = __webpack_require__(201);
|
|
919
|
+
const pathKey = __webpack_require__(258)();
|
|
919
920
|
|
|
920
921
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
921
922
|
const cwd = process.cwd();
|
|
@@ -2474,11 +2475,11 @@ function coerce (version) {
|
|
|
2474
2475
|
/***/ }),
|
|
2475
2476
|
|
|
2476
2477
|
/***/ 114:
|
|
2477
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2478
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2478
2479
|
|
|
2479
2480
|
"use strict";
|
|
2480
2481
|
|
|
2481
|
-
const {PassThrough} =
|
|
2482
|
+
const {PassThrough} = __webpack_require__(413);
|
|
2482
2483
|
|
|
2483
2484
|
module.exports = options => {
|
|
2484
2485
|
options = Object.assign({}, options);
|
|
@@ -2533,12 +2534,12 @@ module.exports = options => {
|
|
|
2533
2534
|
/***/ }),
|
|
2534
2535
|
|
|
2535
2536
|
/***/ 136:
|
|
2536
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2537
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2537
2538
|
|
|
2538
2539
|
"use strict";
|
|
2539
2540
|
|
|
2540
|
-
const pump =
|
|
2541
|
-
const bufferStream =
|
|
2541
|
+
const pump = __webpack_require__(595);
|
|
2542
|
+
const bufferStream = __webpack_require__(114);
|
|
2542
2543
|
|
|
2543
2544
|
class MaxBufferError extends Error {
|
|
2544
2545
|
constructor() {
|
|
@@ -2620,14 +2621,14 @@ isStream.transform = function (stream) {
|
|
|
2620
2621
|
/***/ }),
|
|
2621
2622
|
|
|
2622
2623
|
/***/ 228:
|
|
2623
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2624
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2624
2625
|
|
|
2625
|
-
var fs =
|
|
2626
|
+
var fs = __webpack_require__(747)
|
|
2626
2627
|
var core
|
|
2627
2628
|
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
|
2628
|
-
core =
|
|
2629
|
+
core = __webpack_require__(214)
|
|
2629
2630
|
} else {
|
|
2630
|
-
core =
|
|
2631
|
+
core = __webpack_require__(211)
|
|
2631
2632
|
}
|
|
2632
2633
|
|
|
2633
2634
|
module.exports = isexe
|
|
@@ -2684,12 +2685,12 @@ function sync (path, options) {
|
|
|
2684
2685
|
/***/ }),
|
|
2685
2686
|
|
|
2686
2687
|
/***/ 211:
|
|
2687
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2688
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2688
2689
|
|
|
2689
2690
|
module.exports = isexe
|
|
2690
2691
|
isexe.sync = sync
|
|
2691
2692
|
|
|
2692
|
-
var fs =
|
|
2693
|
+
var fs = __webpack_require__(747)
|
|
2693
2694
|
|
|
2694
2695
|
function isexe (path, options, cb) {
|
|
2695
2696
|
fs.stat(path, function (er, stat) {
|
|
@@ -2732,12 +2733,12 @@ function checkMode (stat, options) {
|
|
|
2732
2733
|
/***/ }),
|
|
2733
2734
|
|
|
2734
2735
|
/***/ 214:
|
|
2735
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2736
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2736
2737
|
|
|
2737
2738
|
module.exports = isexe
|
|
2738
2739
|
isexe.sync = sync
|
|
2739
2740
|
|
|
2740
|
-
var fs =
|
|
2741
|
+
var fs = __webpack_require__(747)
|
|
2741
2742
|
|
|
2742
2743
|
function checkPathExt (path, options) {
|
|
2743
2744
|
var pathext = options.pathExt !== undefined ?
|
|
@@ -2800,12 +2801,12 @@ module.exports = function(fn) {
|
|
|
2800
2801
|
/***/ }),
|
|
2801
2802
|
|
|
2802
2803
|
/***/ 783:
|
|
2803
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2804
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2804
2805
|
|
|
2805
2806
|
"use strict";
|
|
2806
2807
|
|
|
2807
|
-
const path =
|
|
2808
|
-
const pathKey =
|
|
2808
|
+
const path = __webpack_require__(622);
|
|
2809
|
+
const pathKey = __webpack_require__(948);
|
|
2809
2810
|
|
|
2810
2811
|
module.exports = opts => {
|
|
2811
2812
|
opts = Object.assign({
|
|
@@ -2868,9 +2869,9 @@ module.exports = opts => {
|
|
|
2868
2869
|
/***/ }),
|
|
2869
2870
|
|
|
2870
2871
|
/***/ 197:
|
|
2871
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2872
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2872
2873
|
|
|
2873
|
-
var wrappy =
|
|
2874
|
+
var wrappy = __webpack_require__(586)
|
|
2874
2875
|
module.exports = wrappy(once)
|
|
2875
2876
|
module.exports.strict = wrappy(onceStrict)
|
|
2876
2877
|
|
|
@@ -2940,11 +2941,11 @@ module.exports = (promise, onFinally) => {
|
|
|
2940
2941
|
/***/ }),
|
|
2941
2942
|
|
|
2942
2943
|
/***/ 595:
|
|
2943
|
-
/***/ ((module, __unused_webpack_exports,
|
|
2944
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2944
2945
|
|
|
2945
|
-
var once =
|
|
2946
|
-
var eos =
|
|
2947
|
-
var fs =
|
|
2946
|
+
var once = __webpack_require__(197)
|
|
2947
|
+
var eos = __webpack_require__(498)
|
|
2948
|
+
var fs = __webpack_require__(747) // we only need fs to get the ReadStream and WriteStream prototypes
|
|
2948
2949
|
|
|
2949
2950
|
var noop = function () {}
|
|
2950
2951
|
var ancient = /^v?\.0/.test(process.version)
|
|
@@ -3029,11 +3030,11 @@ module.exports = pump
|
|
|
3029
3030
|
/***/ }),
|
|
3030
3031
|
|
|
3031
3032
|
/***/ 970:
|
|
3032
|
-
/***/ ((module, __unused_webpack_exports,
|
|
3033
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3033
3034
|
|
|
3034
3035
|
"use strict";
|
|
3035
3036
|
|
|
3036
|
-
var shebangRegex =
|
|
3037
|
+
var shebangRegex = __webpack_require__(504);
|
|
3037
3038
|
|
|
3038
3039
|
module.exports = function (str) {
|
|
3039
3040
|
var match = str.match(shebangRegex);
|
|
@@ -3066,16 +3067,16 @@ module.exports = /^#!.*/;
|
|
|
3066
3067
|
/***/ }),
|
|
3067
3068
|
|
|
3068
3069
|
/***/ 28:
|
|
3069
|
-
/***/ ((module, __unused_webpack_exports,
|
|
3070
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3070
3071
|
|
|
3071
3072
|
// Note: since nyc uses this module to output coverage, any lines
|
|
3072
3073
|
// that are in the direct sync flow of nyc's outputCoverage are
|
|
3073
3074
|
// ignored, since we can never get coverage for them.
|
|
3074
|
-
var assert =
|
|
3075
|
-
var signals =
|
|
3075
|
+
var assert = __webpack_require__(357)
|
|
3076
|
+
var signals = __webpack_require__(19)
|
|
3076
3077
|
var isWin = /^win/i.test(process.platform)
|
|
3077
3078
|
|
|
3078
|
-
var EE =
|
|
3079
|
+
var EE = __webpack_require__(614)
|
|
3079
3080
|
/* istanbul ignore if */
|
|
3080
3081
|
if (typeof EE !== 'function') {
|
|
3081
3082
|
EE = EE.EventEmitter
|
|
@@ -3319,7 +3320,7 @@ module.exports = function (x) {
|
|
|
3319
3320
|
/***/ }),
|
|
3320
3321
|
|
|
3321
3322
|
/***/ 201:
|
|
3322
|
-
/***/ ((module, __unused_webpack_exports,
|
|
3323
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3323
3324
|
|
|
3324
3325
|
module.exports = which
|
|
3325
3326
|
which.sync = whichSync
|
|
@@ -3328,9 +3329,9 @@ var isWindows = process.platform === 'win32' ||
|
|
|
3328
3329
|
process.env.OSTYPE === 'cygwin' ||
|
|
3329
3330
|
process.env.OSTYPE === 'msys'
|
|
3330
3331
|
|
|
3331
|
-
var path =
|
|
3332
|
+
var path = __webpack_require__(622)
|
|
3332
3333
|
var COLON = isWindows ? ';' : ':'
|
|
3333
|
-
var isexe =
|
|
3334
|
+
var isexe = __webpack_require__(228)
|
|
3334
3335
|
|
|
3335
3336
|
function getNotFoundError (cmd) {
|
|
3336
3337
|
var er = new Error('not found: ' + cmd)
|
|
@@ -3501,7 +3502,7 @@ function wrappy (fn, cb) {
|
|
|
3501
3502
|
/***/ }),
|
|
3502
3503
|
|
|
3503
3504
|
/***/ 855:
|
|
3504
|
-
/***/ (function(__unused_webpack_module, exports,
|
|
3505
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3505
3506
|
|
|
3506
3507
|
"use strict";
|
|
3507
3508
|
|
|
@@ -3510,18 +3511,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3510
3511
|
};
|
|
3511
3512
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3512
3513
|
exports.installRequirementsFile = exports.installRequirement = exports.shouldServe = exports.build = exports.downloadFilesInWorkPath = exports.version = void 0;
|
|
3513
|
-
const path_1 =
|
|
3514
|
-
const execa_1 = __importDefault(
|
|
3515
|
-
const fs_1 = __importDefault(
|
|
3516
|
-
const util_1 =
|
|
3514
|
+
const path_1 = __webpack_require__(622);
|
|
3515
|
+
const execa_1 = __importDefault(__webpack_require__(580));
|
|
3516
|
+
const fs_1 = __importDefault(__webpack_require__(747));
|
|
3517
|
+
const util_1 = __webpack_require__(669);
|
|
3517
3518
|
const readFile = util_1.promisify(fs_1.default.readFile);
|
|
3518
3519
|
const writeFile = util_1.promisify(fs_1.default.writeFile);
|
|
3519
|
-
const build_utils_1 =
|
|
3520
|
+
const build_utils_1 = __webpack_require__(445);
|
|
3520
3521
|
Object.defineProperty(exports, "shouldServe", ({ enumerable: true, get: function () { return build_utils_1.shouldServe; } }));
|
|
3521
|
-
const install_1 =
|
|
3522
|
+
const install_1 = __webpack_require__(95);
|
|
3522
3523
|
Object.defineProperty(exports, "installRequirement", ({ enumerable: true, get: function () { return install_1.installRequirement; } }));
|
|
3523
3524
|
Object.defineProperty(exports, "installRequirementsFile", ({ enumerable: true, get: function () { return install_1.installRequirementsFile; } }));
|
|
3524
|
-
const version_1 =
|
|
3525
|
+
const version_1 = __webpack_require__(255);
|
|
3525
3526
|
async function pipenvConvert(cmd, srcDir) {
|
|
3526
3527
|
build_utils_1.debug('Running pipfile2req...');
|
|
3527
3528
|
try {
|
|
@@ -3594,13 +3595,10 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3594
3595
|
: null;
|
|
3595
3596
|
if (pipfileLockDir) {
|
|
3596
3597
|
build_utils_1.debug('Found "Pipfile.lock"');
|
|
3598
|
+
let lock = {};
|
|
3597
3599
|
try {
|
|
3598
3600
|
const json = await readFile(path_1.join(pipfileLockDir, 'Pipfile.lock'), 'utf8');
|
|
3599
|
-
|
|
3600
|
-
pythonVersion = version_1.getSupportedPythonVersion({
|
|
3601
|
-
isDev: meta.isDev,
|
|
3602
|
-
pipLockPythonVersion: obj?._meta?.requires?.python_version,
|
|
3603
|
-
});
|
|
3601
|
+
lock = JSON.parse(json);
|
|
3604
3602
|
}
|
|
3605
3603
|
catch (err) {
|
|
3606
3604
|
throw new build_utils_1.NowBuildError({
|
|
@@ -3608,6 +3606,10 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3608
3606
|
message: 'Unable to parse Pipfile.lock',
|
|
3609
3607
|
});
|
|
3610
3608
|
}
|
|
3609
|
+
pythonVersion = version_1.getSupportedPythonVersion({
|
|
3610
|
+
isDev: meta.isDev,
|
|
3611
|
+
pipLockPythonVersion: lock?._meta?.requires?.python_version,
|
|
3612
|
+
});
|
|
3611
3613
|
// Convert Pipenv.Lock to requirements.txt.
|
|
3612
3614
|
// We use a different`workPath` here because we want `pipfile-requirements` and it's dependencies
|
|
3613
3615
|
// to not be part of the lambda environment. By using pip's `--target` directive we can isolate
|
|
@@ -3652,8 +3654,8 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3652
3654
|
meta,
|
|
3653
3655
|
});
|
|
3654
3656
|
}
|
|
3655
|
-
const originalPyPath =
|
|
3656
|
-
const originalHandlerPyContents = await readFile(
|
|
3657
|
+
const originalPyPath = path_1.join(__dirname, '..', 'vc_init.py');
|
|
3658
|
+
const originalHandlerPyContents = await readFile(originalPyPath, 'utf8');
|
|
3657
3659
|
build_utils_1.debug('Entrypoint is', entrypoint);
|
|
3658
3660
|
const moduleName = entrypoint.replace(/\//g, '.').replace(/\.py$/, '');
|
|
3659
3661
|
// Since `vercel dev` renames source files, we must reference the original
|
|
@@ -3687,7 +3689,7 @@ exports.build = build;
|
|
|
3687
3689
|
/***/ }),
|
|
3688
3690
|
|
|
3689
3691
|
/***/ 95:
|
|
3690
|
-
/***/ (function(__unused_webpack_module, exports,
|
|
3692
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3691
3693
|
|
|
3692
3694
|
"use strict";
|
|
3693
3695
|
|
|
@@ -3696,8 +3698,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3696
3698
|
};
|
|
3697
3699
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3698
3700
|
exports.installRequirementsFile = exports.installRequirement = void 0;
|
|
3699
|
-
const execa_1 = __importDefault(
|
|
3700
|
-
const build_utils_1 =
|
|
3701
|
+
const execa_1 = __importDefault(__webpack_require__(580));
|
|
3702
|
+
const build_utils_1 = __webpack_require__(445);
|
|
3701
3703
|
const makeDependencyCheckCode = (dependency) => `
|
|
3702
3704
|
from importlib import util
|
|
3703
3705
|
dep = '${dependency}'.replace('-', '_')
|
|
@@ -3795,13 +3797,13 @@ exports.installRequirementsFile = installRequirementsFile;
|
|
|
3795
3797
|
/***/ }),
|
|
3796
3798
|
|
|
3797
3799
|
/***/ 255:
|
|
3798
|
-
/***/ ((__unused_webpack_module, exports,
|
|
3800
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3799
3801
|
|
|
3800
3802
|
"use strict";
|
|
3801
3803
|
|
|
3802
3804
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3803
3805
|
exports.getSupportedPythonVersion = exports.getLatestPythonVersion = void 0;
|
|
3804
|
-
const build_utils_1 =
|
|
3806
|
+
const build_utils_1 = __webpack_require__(445);
|
|
3805
3807
|
// The order must be most recent first
|
|
3806
3808
|
const allOptions = [
|
|
3807
3809
|
{
|
|
@@ -3870,7 +3872,7 @@ function isDiscontinued({ discontinueDate }) {
|
|
|
3870
3872
|
|
|
3871
3873
|
/***/ }),
|
|
3872
3874
|
|
|
3873
|
-
/***/
|
|
3875
|
+
/***/ 445:
|
|
3874
3876
|
/***/ ((module) => {
|
|
3875
3877
|
|
|
3876
3878
|
"use strict";
|
|
@@ -3878,7 +3880,7 @@ module.exports = require("@vercel/build-utils");
|
|
|
3878
3880
|
|
|
3879
3881
|
/***/ }),
|
|
3880
3882
|
|
|
3881
|
-
/***/
|
|
3883
|
+
/***/ 357:
|
|
3882
3884
|
/***/ ((module) => {
|
|
3883
3885
|
|
|
3884
3886
|
"use strict";
|
|
@@ -3886,7 +3888,7 @@ module.exports = require("assert");
|
|
|
3886
3888
|
|
|
3887
3889
|
/***/ }),
|
|
3888
3890
|
|
|
3889
|
-
/***/
|
|
3891
|
+
/***/ 129:
|
|
3890
3892
|
/***/ ((module) => {
|
|
3891
3893
|
|
|
3892
3894
|
"use strict";
|
|
@@ -3894,7 +3896,7 @@ module.exports = require("child_process");
|
|
|
3894
3896
|
|
|
3895
3897
|
/***/ }),
|
|
3896
3898
|
|
|
3897
|
-
/***/
|
|
3899
|
+
/***/ 614:
|
|
3898
3900
|
/***/ ((module) => {
|
|
3899
3901
|
|
|
3900
3902
|
"use strict";
|
|
@@ -3902,7 +3904,7 @@ module.exports = require("events");
|
|
|
3902
3904
|
|
|
3903
3905
|
/***/ }),
|
|
3904
3906
|
|
|
3905
|
-
/***/
|
|
3907
|
+
/***/ 747:
|
|
3906
3908
|
/***/ ((module) => {
|
|
3907
3909
|
|
|
3908
3910
|
"use strict";
|
|
@@ -3910,7 +3912,7 @@ module.exports = require("fs");
|
|
|
3910
3912
|
|
|
3911
3913
|
/***/ }),
|
|
3912
3914
|
|
|
3913
|
-
/***/
|
|
3915
|
+
/***/ 622:
|
|
3914
3916
|
/***/ ((module) => {
|
|
3915
3917
|
|
|
3916
3918
|
"use strict";
|
|
@@ -3918,7 +3920,7 @@ module.exports = require("path");
|
|
|
3918
3920
|
|
|
3919
3921
|
/***/ }),
|
|
3920
3922
|
|
|
3921
|
-
/***/
|
|
3923
|
+
/***/ 413:
|
|
3922
3924
|
/***/ ((module) => {
|
|
3923
3925
|
|
|
3924
3926
|
"use strict";
|
|
@@ -3926,7 +3928,7 @@ module.exports = require("stream");
|
|
|
3926
3928
|
|
|
3927
3929
|
/***/ }),
|
|
3928
3930
|
|
|
3929
|
-
/***/
|
|
3931
|
+
/***/ 669:
|
|
3930
3932
|
/***/ ((module) => {
|
|
3931
3933
|
|
|
3932
3934
|
"use strict";
|
|
@@ -3940,11 +3942,10 @@ module.exports = require("util");
|
|
|
3940
3942
|
/******/ var __webpack_module_cache__ = {};
|
|
3941
3943
|
/******/
|
|
3942
3944
|
/******/ // The require function
|
|
3943
|
-
/******/ function
|
|
3945
|
+
/******/ function __webpack_require__(moduleId) {
|
|
3944
3946
|
/******/ // Check if module is in cache
|
|
3945
|
-
/******/
|
|
3946
|
-
/******/
|
|
3947
|
-
/******/ return cachedModule.exports;
|
|
3947
|
+
/******/ if(__webpack_module_cache__[moduleId]) {
|
|
3948
|
+
/******/ return __webpack_module_cache__[moduleId].exports;
|
|
3948
3949
|
/******/ }
|
|
3949
3950
|
/******/ // Create a new module (and put it into the cache)
|
|
3950
3951
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
@@ -3956,7 +3957,7 @@ module.exports = require("util");
|
|
|
3956
3957
|
/******/ // Execute the module function
|
|
3957
3958
|
/******/ var threw = true;
|
|
3958
3959
|
/******/ try {
|
|
3959
|
-
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports,
|
|
3960
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
3960
3961
|
/******/ threw = false;
|
|
3961
3962
|
/******/ } finally {
|
|
3962
3963
|
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
@@ -3969,15 +3970,10 @@ module.exports = require("util");
|
|
|
3969
3970
|
/************************************************************************/
|
|
3970
3971
|
/******/ /* webpack/runtime/compat */
|
|
3971
3972
|
/******/
|
|
3972
|
-
/******/
|
|
3973
|
-
/******/
|
|
3974
|
-
/************************************************************************/
|
|
3975
|
-
/******/
|
|
3973
|
+
/******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
|
|
3974
|
+
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
|
3976
3975
|
/******/ // startup
|
|
3977
3976
|
/******/ // Load entry module and return exports
|
|
3978
|
-
/******/
|
|
3979
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(855);
|
|
3980
|
-
/******/ module.exports = __webpack_exports__;
|
|
3981
|
-
/******/
|
|
3977
|
+
/******/ return __webpack_require__(855);
|
|
3982
3978
|
/******/ })()
|
|
3983
3979
|
;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/execa": "^0.9.0",
|
|
25
25
|
"@types/jest": "27.4.1",
|
|
26
|
-
"@vercel/build-utils": "5.0
|
|
27
|
-
"@vercel/ncc": "0.
|
|
26
|
+
"@vercel/build-utils": "5.1.0",
|
|
27
|
+
"@vercel/ncc": "0.24.0",
|
|
28
28
|
"execa": "^1.0.0",
|
|
29
29
|
"typescript": "4.3.4"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "7db6436797d0b4131113f0b8dccc3b66bc9b1981"
|
|
32
32
|
}
|
package/dist/vc_init.py
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import base64
|
|
3
|
-
import json
|
|
4
|
-
import inspect
|
|
5
|
-
from importlib import util
|
|
6
|
-
from http.server import BaseHTTPRequestHandler
|
|
7
|
-
|
|
8
|
-
# Import relative path https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
|
|
9
|
-
__vc_spec = util.spec_from_file_location("__VC_HANDLER_MODULE_NAME", "./__VC_HANDLER_ENTRYPOINT")
|
|
10
|
-
__vc_module = util.module_from_spec(__vc_spec)
|
|
11
|
-
sys.modules["__VC_HANDLER_MODULE_NAME"] = __vc_module
|
|
12
|
-
__vc_spec.loader.exec_module(__vc_module)
|
|
13
|
-
__vc_variables = dir(__vc_module)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def format_headers(headers, decode=False):
|
|
17
|
-
keyToList = {}
|
|
18
|
-
for key, value in headers.items():
|
|
19
|
-
if decode and 'decode' in dir(key) and 'decode' in dir(value):
|
|
20
|
-
key = key.decode()
|
|
21
|
-
value = value.decode()
|
|
22
|
-
if key not in keyToList:
|
|
23
|
-
keyToList[key] = []
|
|
24
|
-
keyToList[key].append(value)
|
|
25
|
-
return keyToList
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if 'handler' in __vc_variables or 'Handler' in __vc_variables:
|
|
29
|
-
base = __vc_module.handler if ('handler' in __vc_variables) else __vc_module.Handler
|
|
30
|
-
if not issubclass(base, BaseHTTPRequestHandler):
|
|
31
|
-
print('Handler must inherit from BaseHTTPRequestHandler')
|
|
32
|
-
print('See the docs https://vercel.com/docs/runtimes#advanced-usage/advanced-python-usage')
|
|
33
|
-
exit(1)
|
|
34
|
-
|
|
35
|
-
print('using HTTP Handler')
|
|
36
|
-
from http.server import HTTPServer
|
|
37
|
-
import http
|
|
38
|
-
import _thread
|
|
39
|
-
|
|
40
|
-
server = HTTPServer(('', 0), base)
|
|
41
|
-
port = server.server_address[1]
|
|
42
|
-
|
|
43
|
-
def vc_handler(event, context):
|
|
44
|
-
_thread.start_new_thread(server.handle_request, ())
|
|
45
|
-
|
|
46
|
-
payload = json.loads(event['body'])
|
|
47
|
-
path = payload['path']
|
|
48
|
-
headers = payload['headers']
|
|
49
|
-
method = payload['method']
|
|
50
|
-
encoding = payload.get('encoding')
|
|
51
|
-
body = payload.get('body')
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
(body is not None and len(body) > 0) and
|
|
55
|
-
(encoding is not None and encoding == 'base64')
|
|
56
|
-
):
|
|
57
|
-
body = base64.b64decode(body)
|
|
58
|
-
|
|
59
|
-
request_body = body.encode('utf-8') if isinstance(body, str) else body
|
|
60
|
-
conn = http.client.HTTPConnection('0.0.0.0', port)
|
|
61
|
-
conn.request(method, path, headers=headers, body=request_body)
|
|
62
|
-
res = conn.getresponse()
|
|
63
|
-
|
|
64
|
-
return_dict = {
|
|
65
|
-
'statusCode': res.status,
|
|
66
|
-
'headers': format_headers(res.headers),
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
data = res.read()
|
|
70
|
-
|
|
71
|
-
try:
|
|
72
|
-
return_dict['body'] = data.decode('utf-8')
|
|
73
|
-
except UnicodeDecodeError:
|
|
74
|
-
return_dict['body'] = base64.b64encode(data).decode('utf-8')
|
|
75
|
-
return_dict['encoding'] = 'base64'
|
|
76
|
-
|
|
77
|
-
return return_dict
|
|
78
|
-
|
|
79
|
-
elif 'app' in __vc_variables:
|
|
80
|
-
if (
|
|
81
|
-
not inspect.iscoroutinefunction(__vc_module.app) and
|
|
82
|
-
not inspect.iscoroutinefunction(__vc_module.app.__call__)
|
|
83
|
-
):
|
|
84
|
-
print('using Web Server Gateway Interface (WSGI)')
|
|
85
|
-
from io import BytesIO
|
|
86
|
-
from urllib.parse import urlparse
|
|
87
|
-
from werkzeug.datastructures import Headers
|
|
88
|
-
from werkzeug.wrappers import Response
|
|
89
|
-
|
|
90
|
-
string_types = (str,)
|
|
91
|
-
|
|
92
|
-
def to_bytes(x, charset=sys.getdefaultencoding(), errors="strict"):
|
|
93
|
-
if x is None:
|
|
94
|
-
return None
|
|
95
|
-
if isinstance(x, (bytes, bytearray, memoryview)):
|
|
96
|
-
return bytes(x)
|
|
97
|
-
if isinstance(x, str):
|
|
98
|
-
return x.encode(charset, errors)
|
|
99
|
-
raise TypeError("Expected bytes")
|
|
100
|
-
|
|
101
|
-
def wsgi_encoding_dance(s, charset="utf-8", errors="replace"):
|
|
102
|
-
if isinstance(s, str):
|
|
103
|
-
s = s.encode(charset)
|
|
104
|
-
return s.decode("latin1", errors)
|
|
105
|
-
|
|
106
|
-
def vc_handler(event, context):
|
|
107
|
-
payload = json.loads(event['body'])
|
|
108
|
-
|
|
109
|
-
headers = Headers(payload.get('headers', {}))
|
|
110
|
-
|
|
111
|
-
body = payload.get('body', '')
|
|
112
|
-
if body != '':
|
|
113
|
-
if payload.get('encoding') == 'base64':
|
|
114
|
-
body = base64.b64decode(body)
|
|
115
|
-
if isinstance(body, string_types):
|
|
116
|
-
body = to_bytes(body, charset='utf-8')
|
|
117
|
-
|
|
118
|
-
url = urlparse(payload['path'])
|
|
119
|
-
query = url.query
|
|
120
|
-
path = url.path
|
|
121
|
-
|
|
122
|
-
environ = {
|
|
123
|
-
'CONTENT_LENGTH': str(len(body)),
|
|
124
|
-
'CONTENT_TYPE': headers.get('content-type', ''),
|
|
125
|
-
'PATH_INFO': path,
|
|
126
|
-
'QUERY_STRING': query,
|
|
127
|
-
'REMOTE_ADDR': headers.get(
|
|
128
|
-
'x-forwarded-for', headers.get(
|
|
129
|
-
'x-real-ip', payload.get(
|
|
130
|
-
'true-client-ip', ''))),
|
|
131
|
-
'REQUEST_METHOD': payload['method'],
|
|
132
|
-
'SERVER_NAME': headers.get('host', 'lambda'),
|
|
133
|
-
'SERVER_PORT': headers.get('x-forwarded-port', '80'),
|
|
134
|
-
'SERVER_PROTOCOL': 'HTTP/1.1',
|
|
135
|
-
'event': event,
|
|
136
|
-
'context': context,
|
|
137
|
-
'wsgi.errors': sys.stderr,
|
|
138
|
-
'wsgi.input': BytesIO(body),
|
|
139
|
-
'wsgi.multiprocess': False,
|
|
140
|
-
'wsgi.multithread': False,
|
|
141
|
-
'wsgi.run_once': False,
|
|
142
|
-
'wsgi.url_scheme': headers.get('x-forwarded-proto', 'http'),
|
|
143
|
-
'wsgi.version': (1, 0),
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
for key, value in environ.items():
|
|
147
|
-
if isinstance(value, string_types):
|
|
148
|
-
environ[key] = wsgi_encoding_dance(value)
|
|
149
|
-
|
|
150
|
-
for key, value in headers.items():
|
|
151
|
-
key = 'HTTP_' + key.upper().replace('-', '_')
|
|
152
|
-
if key not in ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH'):
|
|
153
|
-
environ[key] = value
|
|
154
|
-
|
|
155
|
-
response = Response.from_app(__vc_module.app, environ)
|
|
156
|
-
|
|
157
|
-
return_dict = {
|
|
158
|
-
'statusCode': response.status_code,
|
|
159
|
-
'headers': format_headers(response.headers)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if response.data:
|
|
163
|
-
return_dict['body'] = base64.b64encode(response.data).decode('utf-8')
|
|
164
|
-
return_dict['encoding'] = 'base64'
|
|
165
|
-
|
|
166
|
-
return return_dict
|
|
167
|
-
else:
|
|
168
|
-
print('using Asynchronous Server Gateway Interface (ASGI)')
|
|
169
|
-
# Originally authored by Jordan Eremieff and included under MIT license:
|
|
170
|
-
# https://github.com/erm/mangum/blob/b4d21c8f5e304a3e17b88bc9fa345106acc50ad7/mangum/__init__.py
|
|
171
|
-
# https://github.com/erm/mangum/blob/b4d21c8f5e304a3e17b88bc9fa345106acc50ad7/LICENSE
|
|
172
|
-
import asyncio
|
|
173
|
-
import enum
|
|
174
|
-
from urllib.parse import urlparse
|
|
175
|
-
from werkzeug.datastructures import Headers
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
class ASGICycleState(enum.Enum):
|
|
179
|
-
REQUEST = enum.auto()
|
|
180
|
-
RESPONSE = enum.auto()
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
class ASGICycle:
|
|
184
|
-
def __init__(self, scope):
|
|
185
|
-
self.scope = scope
|
|
186
|
-
self.body = b''
|
|
187
|
-
self.state = ASGICycleState.REQUEST
|
|
188
|
-
self.app_queue = None
|
|
189
|
-
self.response = {}
|
|
190
|
-
|
|
191
|
-
def __call__(self, app, body):
|
|
192
|
-
"""
|
|
193
|
-
Receives the application and any body included in the request, then builds the
|
|
194
|
-
ASGI instance using the connection scope.
|
|
195
|
-
Runs until the response is completely read from the application.
|
|
196
|
-
"""
|
|
197
|
-
loop = asyncio.new_event_loop()
|
|
198
|
-
self.app_queue = asyncio.Queue(loop=loop)
|
|
199
|
-
self.put_message({'type': 'http.request', 'body': body, 'more_body': False})
|
|
200
|
-
|
|
201
|
-
asgi_instance = app(self.scope, self.receive, self.send)
|
|
202
|
-
|
|
203
|
-
asgi_task = loop.create_task(asgi_instance)
|
|
204
|
-
loop.run_until_complete(asgi_task)
|
|
205
|
-
return self.response
|
|
206
|
-
|
|
207
|
-
def put_message(self, message):
|
|
208
|
-
self.app_queue.put_nowait(message)
|
|
209
|
-
|
|
210
|
-
async def receive(self):
|
|
211
|
-
"""
|
|
212
|
-
Awaited by the application to receive messages in the queue.
|
|
213
|
-
"""
|
|
214
|
-
message = await self.app_queue.get()
|
|
215
|
-
return message
|
|
216
|
-
|
|
217
|
-
async def send(self, message):
|
|
218
|
-
"""
|
|
219
|
-
Awaited by the application to send messages to the current cycle instance.
|
|
220
|
-
"""
|
|
221
|
-
message_type = message['type']
|
|
222
|
-
|
|
223
|
-
if self.state is ASGICycleState.REQUEST:
|
|
224
|
-
if message_type != 'http.response.start':
|
|
225
|
-
raise RuntimeError(
|
|
226
|
-
f"Expected 'http.response.start', received: {message_type}"
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
status_code = message['status']
|
|
230
|
-
headers = Headers(message.get('headers', []))
|
|
231
|
-
|
|
232
|
-
self.on_request(headers, status_code)
|
|
233
|
-
self.state = ASGICycleState.RESPONSE
|
|
234
|
-
|
|
235
|
-
elif self.state is ASGICycleState.RESPONSE:
|
|
236
|
-
if message_type != 'http.response.body':
|
|
237
|
-
raise RuntimeError(
|
|
238
|
-
f"Expected 'http.response.body', received: {message_type}"
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
body = message.get('body', b'')
|
|
242
|
-
more_body = message.get('more_body', False)
|
|
243
|
-
|
|
244
|
-
# The body must be completely read before returning the response.
|
|
245
|
-
self.body += body
|
|
246
|
-
|
|
247
|
-
if not more_body:
|
|
248
|
-
self.on_response()
|
|
249
|
-
self.put_message({'type': 'http.disconnect'})
|
|
250
|
-
|
|
251
|
-
def on_request(self, headers, status_code):
|
|
252
|
-
self.response['statusCode'] = status_code
|
|
253
|
-
self.response['headers'] = format_headers(headers, decode=True)
|
|
254
|
-
|
|
255
|
-
def on_response(self):
|
|
256
|
-
if self.body:
|
|
257
|
-
self.response['body'] = base64.b64encode(self.body).decode('utf-8')
|
|
258
|
-
self.response['encoding'] = 'base64'
|
|
259
|
-
|
|
260
|
-
def vc_handler(event, context):
|
|
261
|
-
payload = json.loads(event['body'])
|
|
262
|
-
|
|
263
|
-
headers = payload.get('headers', {})
|
|
264
|
-
|
|
265
|
-
body = payload.get('body', b'')
|
|
266
|
-
if payload.get('encoding') == 'base64':
|
|
267
|
-
body = base64.b64decode(body)
|
|
268
|
-
elif not isinstance(body, bytes):
|
|
269
|
-
body = body.encode()
|
|
270
|
-
|
|
271
|
-
url = urlparse(payload['path'])
|
|
272
|
-
query = url.query.encode()
|
|
273
|
-
path = url.path
|
|
274
|
-
|
|
275
|
-
scope = {
|
|
276
|
-
'server': (headers.get('host', 'lambda'), headers.get('x-forwarded-port', 80)),
|
|
277
|
-
'client': (headers.get(
|
|
278
|
-
'x-forwarded-for', headers.get(
|
|
279
|
-
'x-real-ip', payload.get(
|
|
280
|
-
'true-client-ip', ''))), 0),
|
|
281
|
-
'scheme': headers.get('x-forwarded-proto', 'http'),
|
|
282
|
-
'root_path': '',
|
|
283
|
-
'query_string': query,
|
|
284
|
-
'headers': [[k.lower().encode(), v.encode()] for k, v in headers.items()],
|
|
285
|
-
'type': 'http',
|
|
286
|
-
'http_version': '1.1',
|
|
287
|
-
'method': payload['method'],
|
|
288
|
-
'path': path,
|
|
289
|
-
'raw_path': path.encode(),
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
asgi_cycle = ASGICycle(scope)
|
|
293
|
-
response = asgi_cycle(__vc_module.app, body)
|
|
294
|
-
return response
|
|
295
|
-
|
|
296
|
-
else:
|
|
297
|
-
print('Missing variable `handler` or `app` in file "__VC_HANDLER_ENTRYPOINT".')
|
|
298
|
-
print('See the docs https://vercel.com/docs/runtimes#advanced-usage/advanced-python-usage')
|
|
299
|
-
exit(1)
|