@vercel/python 2.0.6-canary.2 → 2.0.6-canary.6
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.d.ts +9 -0
- package/dist/index.js +355 -361
- package/dist/install.d.ts +21 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuildOptions, shouldServe } from '@vercel/build-utils';
|
|
2
|
+
import { installRequirement, installRequirementsFile } from './install';
|
|
3
|
+
export declare const version = 3;
|
|
4
|
+
export declare function downloadFilesInWorkPath({ entrypoint, workPath, files, meta, }: BuildOptions): Promise<string>;
|
|
5
|
+
export declare const build: ({ workPath, files: originalFiles, entrypoint, meta, config, }: BuildOptions) => Promise<{
|
|
6
|
+
output: import("@vercel/build-utils").Lambda;
|
|
7
|
+
}>;
|
|
8
|
+
export { shouldServe };
|
|
9
|
+
export { installRequirement, installRequirementsFile };
|
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)
|
|
@@ -3500,296 +3501,61 @@ function wrappy (fn, cb) {
|
|
|
3500
3501
|
|
|
3501
3502
|
/***/ }),
|
|
3502
3503
|
|
|
3503
|
-
/***/
|
|
3504
|
-
/***/ ((
|
|
3505
|
-
|
|
3506
|
-
"use strict";
|
|
3507
|
-
module.exports = require("assert");
|
|
3508
|
-
|
|
3509
|
-
/***/ }),
|
|
3510
|
-
|
|
3511
|
-
/***/ 129:
|
|
3512
|
-
/***/ ((module) => {
|
|
3513
|
-
|
|
3514
|
-
"use strict";
|
|
3515
|
-
module.exports = require("child_process");
|
|
3516
|
-
|
|
3517
|
-
/***/ }),
|
|
3518
|
-
|
|
3519
|
-
/***/ 614:
|
|
3520
|
-
/***/ ((module) => {
|
|
3521
|
-
|
|
3522
|
-
"use strict";
|
|
3523
|
-
module.exports = require("events");
|
|
3524
|
-
|
|
3525
|
-
/***/ }),
|
|
3526
|
-
|
|
3527
|
-
/***/ 747:
|
|
3528
|
-
/***/ ((module) => {
|
|
3529
|
-
|
|
3530
|
-
"use strict";
|
|
3531
|
-
module.exports = require("fs");
|
|
3532
|
-
|
|
3533
|
-
/***/ }),
|
|
3534
|
-
|
|
3535
|
-
/***/ 622:
|
|
3536
|
-
/***/ ((module) => {
|
|
3537
|
-
|
|
3538
|
-
"use strict";
|
|
3539
|
-
module.exports = require("path");
|
|
3540
|
-
|
|
3541
|
-
/***/ }),
|
|
3542
|
-
|
|
3543
|
-
/***/ 413:
|
|
3544
|
-
/***/ ((module) => {
|
|
3545
|
-
|
|
3546
|
-
"use strict";
|
|
3547
|
-
module.exports = require("stream");
|
|
3548
|
-
|
|
3549
|
-
/***/ }),
|
|
3550
|
-
|
|
3551
|
-
/***/ 669:
|
|
3552
|
-
/***/ ((module) => {
|
|
3504
|
+
/***/ 855:
|
|
3505
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3553
3506
|
|
|
3554
3507
|
"use strict";
|
|
3555
|
-
module.exports = require("util");
|
|
3556
|
-
|
|
3557
|
-
/***/ })
|
|
3558
|
-
|
|
3559
|
-
/******/ });
|
|
3560
|
-
/************************************************************************/
|
|
3561
|
-
/******/ // The module cache
|
|
3562
|
-
/******/ var __webpack_module_cache__ = {};
|
|
3563
|
-
/******/
|
|
3564
|
-
/******/ // The require function
|
|
3565
|
-
/******/ function __nccwpck_require__(moduleId) {
|
|
3566
|
-
/******/ // Check if module is in cache
|
|
3567
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
3568
|
-
/******/ if (cachedModule !== undefined) {
|
|
3569
|
-
/******/ return cachedModule.exports;
|
|
3570
|
-
/******/ }
|
|
3571
|
-
/******/ // Create a new module (and put it into the cache)
|
|
3572
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3573
|
-
/******/ // no module.id needed
|
|
3574
|
-
/******/ // no module.loaded needed
|
|
3575
|
-
/******/ exports: {}
|
|
3576
|
-
/******/ };
|
|
3577
|
-
/******/
|
|
3578
|
-
/******/ // Execute the module function
|
|
3579
|
-
/******/ var threw = true;
|
|
3580
|
-
/******/ try {
|
|
3581
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
3582
|
-
/******/ threw = false;
|
|
3583
|
-
/******/ } finally {
|
|
3584
|
-
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
3585
|
-
/******/ }
|
|
3586
|
-
/******/
|
|
3587
|
-
/******/ // Return the exports of the module
|
|
3588
|
-
/******/ return module.exports;
|
|
3589
|
-
/******/ }
|
|
3590
|
-
/******/
|
|
3591
|
-
/************************************************************************/
|
|
3592
|
-
/******/ /* webpack/runtime/compat get default export */
|
|
3593
|
-
/******/ (() => {
|
|
3594
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
3595
|
-
/******/ __nccwpck_require__.n = (module) => {
|
|
3596
|
-
/******/ var getter = module && module.__esModule ?
|
|
3597
|
-
/******/ () => (module['default']) :
|
|
3598
|
-
/******/ () => (module);
|
|
3599
|
-
/******/ __nccwpck_require__.d(getter, { a: getter });
|
|
3600
|
-
/******/ return getter;
|
|
3601
|
-
/******/ };
|
|
3602
|
-
/******/ })();
|
|
3603
|
-
/******/
|
|
3604
|
-
/******/ /* webpack/runtime/define property getters */
|
|
3605
|
-
/******/ (() => {
|
|
3606
|
-
/******/ // define getter functions for harmony exports
|
|
3607
|
-
/******/ __nccwpck_require__.d = (exports, definition) => {
|
|
3608
|
-
/******/ for(var key in definition) {
|
|
3609
|
-
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
|
|
3610
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3611
|
-
/******/ }
|
|
3612
|
-
/******/ }
|
|
3613
|
-
/******/ };
|
|
3614
|
-
/******/ })();
|
|
3615
|
-
/******/
|
|
3616
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3617
|
-
/******/ (() => {
|
|
3618
|
-
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
3619
|
-
/******/ })();
|
|
3620
|
-
/******/
|
|
3621
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
3622
|
-
/******/ (() => {
|
|
3623
|
-
/******/ // define __esModule on exports
|
|
3624
|
-
/******/ __nccwpck_require__.r = (exports) => {
|
|
3625
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
3626
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3627
|
-
/******/ }
|
|
3628
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3629
|
-
/******/ };
|
|
3630
|
-
/******/ })();
|
|
3631
|
-
/******/
|
|
3632
|
-
/******/ /* webpack/runtime/compat */
|
|
3633
|
-
/******/
|
|
3634
|
-
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
3635
|
-
/******/
|
|
3636
|
-
/************************************************************************/
|
|
3637
|
-
var __webpack_exports__ = {};
|
|
3638
|
-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
3639
|
-
(() => {
|
|
3640
|
-
"use strict";
|
|
3641
|
-
// ESM COMPAT FLAG
|
|
3642
|
-
__nccwpck_require__.r(__webpack_exports__);
|
|
3643
|
-
|
|
3644
|
-
// EXPORTS
|
|
3645
|
-
__nccwpck_require__.d(__webpack_exports__, {
|
|
3646
|
-
"build": () => (/* binding */ build),
|
|
3647
|
-
"downloadFilesInWorkPath": () => (/* binding */ downloadFilesInWorkPath),
|
|
3648
|
-
"installRequirement": () => (/* reexport */ installRequirement),
|
|
3649
|
-
"installRequirementsFile": () => (/* reexport */ installRequirementsFile),
|
|
3650
|
-
"shouldServe": () => (/* reexport */ build_utils_namespaceObject.shouldServe),
|
|
3651
|
-
"version": () => (/* binding */ version)
|
|
3652
|
-
});
|
|
3653
|
-
|
|
3654
|
-
// EXTERNAL MODULE: external "path"
|
|
3655
|
-
var external_path_ = __nccwpck_require__(622);
|
|
3656
|
-
// EXTERNAL MODULE: ../../node_modules/execa/index.js
|
|
3657
|
-
var execa = __nccwpck_require__(580);
|
|
3658
|
-
var execa_default = /*#__PURE__*/__nccwpck_require__.n(execa);
|
|
3659
|
-
// EXTERNAL MODULE: external "fs"
|
|
3660
|
-
var external_fs_ = __nccwpck_require__(747);
|
|
3661
|
-
var external_fs_default = /*#__PURE__*/__nccwpck_require__.n(external_fs_);
|
|
3662
|
-
// EXTERNAL MODULE: external "util"
|
|
3663
|
-
var external_util_ = __nccwpck_require__(669);
|
|
3664
|
-
;// CONCATENATED MODULE: external "@vercel/build-utils"
|
|
3665
|
-
const build_utils_namespaceObject = require("@vercel/build-utils");
|
|
3666
|
-
;// CONCATENATED MODULE: ./src/install.ts
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
const pipPath = 'pip3';
|
|
3670
|
-
const makeDependencyCheckCode = (dependency) => `
|
|
3671
|
-
from importlib import util
|
|
3672
|
-
dep = '${dependency}'.replace('-', '_')
|
|
3673
|
-
spec = util.find_spec(dep)
|
|
3674
|
-
print(spec.origin)
|
|
3675
|
-
`;
|
|
3676
|
-
async function isInstalled(dependency, cwd) {
|
|
3677
|
-
try {
|
|
3678
|
-
const { stdout } = await execa_default()('python3', ['-c', makeDependencyCheckCode(dependency)], {
|
|
3679
|
-
stdio: 'pipe',
|
|
3680
|
-
cwd,
|
|
3681
|
-
});
|
|
3682
|
-
return stdout.startsWith(cwd);
|
|
3683
|
-
}
|
|
3684
|
-
catch (err) {
|
|
3685
|
-
return false;
|
|
3686
|
-
}
|
|
3687
|
-
}
|
|
3688
|
-
const makeRequirementsCheckCode = (requirementsPath) => `
|
|
3689
|
-
import distutils.text_file
|
|
3690
|
-
import pkg_resources
|
|
3691
|
-
from pkg_resources import DistributionNotFound, VersionConflict
|
|
3692
|
-
dependencies = distutils.text_file.TextFile(filename='${requirementsPath}').readlines()
|
|
3693
|
-
pkg_resources.require(dependencies)
|
|
3694
|
-
`;
|
|
3695
|
-
async function areRequirementsInstalled(requirementsPath, cwd) {
|
|
3696
|
-
try {
|
|
3697
|
-
await execa_default()('python3', ['-c', makeRequirementsCheckCode(requirementsPath)], {
|
|
3698
|
-
stdio: 'pipe',
|
|
3699
|
-
cwd,
|
|
3700
|
-
});
|
|
3701
|
-
return true;
|
|
3702
|
-
}
|
|
3703
|
-
catch (err) {
|
|
3704
|
-
return false;
|
|
3705
|
-
}
|
|
3706
|
-
}
|
|
3707
|
-
async function pipInstall(workPath, args) {
|
|
3708
|
-
const target = '.';
|
|
3709
|
-
// See: https://github.com/pypa/pip/issues/4222#issuecomment-417646535
|
|
3710
|
-
//
|
|
3711
|
-
// Disable installing to the Python user install directory, which is
|
|
3712
|
-
// the default behavior on Debian systems and causes error:
|
|
3713
|
-
//
|
|
3714
|
-
// distutils.errors.DistutilsOptionError: can't combine user with
|
|
3715
|
-
// prefix, exec_prefix/home, or install_(plat)base
|
|
3716
|
-
process.env.PIP_USER = '0';
|
|
3717
|
-
const cmdArgs = [
|
|
3718
|
-
'install',
|
|
3719
|
-
'--disable-pip-version-check',
|
|
3720
|
-
'--target',
|
|
3721
|
-
target,
|
|
3722
|
-
...args,
|
|
3723
|
-
];
|
|
3724
|
-
(0,build_utils_namespaceObject.debug)(`Running "pip3 ${cmdArgs.join(' ')}"...`);
|
|
3725
|
-
try {
|
|
3726
|
-
await execa_default()(pipPath, cmdArgs, {
|
|
3727
|
-
cwd: workPath,
|
|
3728
|
-
stdio: 'pipe',
|
|
3729
|
-
});
|
|
3730
|
-
}
|
|
3731
|
-
catch (err) {
|
|
3732
|
-
console.log(`Failed to run "pip3 ${cmdArgs.join(' ')}"`);
|
|
3733
|
-
throw err;
|
|
3734
|
-
}
|
|
3735
|
-
}
|
|
3736
|
-
// note that any internal dependency that vc_init.py requires that's installed
|
|
3737
|
-
// with this function can get overriden by a newer version from requirements.txt,
|
|
3738
|
-
// so vc_init should do runtime version checks to be compatible with any recent
|
|
3739
|
-
// version of its dependencies
|
|
3740
|
-
async function installRequirement({ dependency, version, workPath, meta, args = [], }) {
|
|
3741
|
-
if (meta.isDev && (await isInstalled(dependency, workPath))) {
|
|
3742
|
-
(0,build_utils_namespaceObject.debug)(`Skipping ${dependency} dependency installation, already installed in ${workPath}`);
|
|
3743
|
-
return;
|
|
3744
|
-
}
|
|
3745
|
-
const exact = `${dependency}==${version}`;
|
|
3746
|
-
await pipInstall(workPath, [exact, ...args]);
|
|
3747
|
-
}
|
|
3748
|
-
async function installRequirementsFile({ filePath, workPath, meta, args = [], }) {
|
|
3749
|
-
if (meta.isDev && (await areRequirementsInstalled(filePath, workPath))) {
|
|
3750
|
-
(0,build_utils_namespaceObject.debug)(`Skipping requirements file installation, already installed`);
|
|
3751
|
-
return;
|
|
3752
|
-
}
|
|
3753
|
-
await pipInstall(workPath, ['--upgrade', '-r', filePath, ...args]);
|
|
3754
|
-
}
|
|
3755
|
-
|
|
3756
|
-
;// CONCATENATED MODULE: ./src/index.ts
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
const readFile = (0,external_util_.promisify)((external_fs_default()).readFile);
|
|
3762
|
-
const writeFile = (0,external_util_.promisify)((external_fs_default()).writeFile);
|
|
3763
|
-
|
|
3764
3508
|
|
|
3509
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3510
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3511
|
+
};
|
|
3512
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3513
|
+
exports.installRequirementsFile = exports.installRequirement = exports.shouldServe = exports.build = exports.downloadFilesInWorkPath = exports.version = void 0;
|
|
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);
|
|
3518
|
+
const readFile = util_1.promisify(fs_1.default.readFile);
|
|
3519
|
+
const writeFile = util_1.promisify(fs_1.default.writeFile);
|
|
3520
|
+
const build_utils_1 = __webpack_require__(445);
|
|
3521
|
+
Object.defineProperty(exports, "shouldServe", ({ enumerable: true, get: function () { return build_utils_1.shouldServe; } }));
|
|
3522
|
+
const install_1 = __webpack_require__(95);
|
|
3523
|
+
Object.defineProperty(exports, "installRequirement", ({ enumerable: true, get: function () { return install_1.installRequirement; } }));
|
|
3524
|
+
Object.defineProperty(exports, "installRequirementsFile", ({ enumerable: true, get: function () { return install_1.installRequirementsFile; } }));
|
|
3765
3525
|
async function pipenvConvert(cmd, srcDir) {
|
|
3766
|
-
|
|
3526
|
+
build_utils_1.debug('Running pipfile2req...');
|
|
3767
3527
|
try {
|
|
3768
|
-
const out = await
|
|
3528
|
+
const out = await execa_1.default.stdout(cmd, [], {
|
|
3769
3529
|
cwd: srcDir,
|
|
3770
3530
|
});
|
|
3771
|
-
|
|
3531
|
+
build_utils_1.debug('Contents of requirements.txt is: ' + out);
|
|
3532
|
+
fs_1.default.writeFileSync(path_1.join(srcDir, 'requirements.txt'), out);
|
|
3772
3533
|
}
|
|
3773
3534
|
catch (err) {
|
|
3774
3535
|
console.log('Failed to run "pipfile2req"');
|
|
3775
3536
|
throw err;
|
|
3776
3537
|
}
|
|
3777
3538
|
}
|
|
3778
|
-
|
|
3539
|
+
exports.version = 3;
|
|
3779
3540
|
async function downloadFilesInWorkPath({ entrypoint, workPath, files, meta = {}, }) {
|
|
3780
|
-
|
|
3781
|
-
let downloadedFiles = await
|
|
3541
|
+
build_utils_1.debug('Downloading user files...');
|
|
3542
|
+
let downloadedFiles = await build_utils_1.download(files, workPath, meta);
|
|
3782
3543
|
if (meta.isDev) {
|
|
3783
3544
|
// Old versions of the CLI don't assign this property
|
|
3784
|
-
const { devCacheDir =
|
|
3785
|
-
const destCache =
|
|
3786
|
-
await
|
|
3787
|
-
downloadedFiles = await
|
|
3545
|
+
const { devCacheDir = path_1.join(workPath, '.now', 'cache') } = meta;
|
|
3546
|
+
const destCache = path_1.join(devCacheDir, path_1.basename(entrypoint, '.py'));
|
|
3547
|
+
await build_utils_1.download(downloadedFiles, destCache);
|
|
3548
|
+
downloadedFiles = await build_utils_1.glob('**', destCache);
|
|
3788
3549
|
workPath = destCache;
|
|
3789
3550
|
}
|
|
3790
3551
|
return workPath;
|
|
3791
3552
|
}
|
|
3553
|
+
exports.downloadFilesInWorkPath = downloadFilesInWorkPath;
|
|
3792
3554
|
const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, config, }) => {
|
|
3555
|
+
var _a, _b;
|
|
3556
|
+
let pipPath = meta.isDev ? 'pip3' : 'pip3.9';
|
|
3557
|
+
let pythonPath = meta.isDev ? 'python3' : 'python3.9';
|
|
3558
|
+
let pythonRuntime = meta.isDev ? 'python3' : 'python3.9';
|
|
3793
3559
|
workPath = await downloadFilesInWorkPath({
|
|
3794
3560
|
workPath,
|
|
3795
3561
|
files: originalFiles,
|
|
@@ -3806,7 +3572,7 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3806
3572
|
// distutils.errors.DistutilsOptionError: must supply either home
|
|
3807
3573
|
// or prefix/exec-prefix -- not both
|
|
3808
3574
|
if (meta.isDev) {
|
|
3809
|
-
const setupCfg =
|
|
3575
|
+
const setupCfg = path_1.join(workPath, 'setup.cfg');
|
|
3810
3576
|
await writeFile(setupCfg, '[install]\nprefix=\n');
|
|
3811
3577
|
}
|
|
3812
3578
|
}
|
|
@@ -3815,27 +3581,46 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3815
3581
|
throw err;
|
|
3816
3582
|
}
|
|
3817
3583
|
console.log('Installing required dependencies...');
|
|
3818
|
-
await installRequirement({
|
|
3584
|
+
await install_1.installRequirement({
|
|
3585
|
+
pythonPath,
|
|
3586
|
+
pipPath,
|
|
3819
3587
|
dependency: 'werkzeug',
|
|
3820
3588
|
version: '1.0.1',
|
|
3821
3589
|
workPath,
|
|
3822
3590
|
meta,
|
|
3823
3591
|
});
|
|
3824
|
-
let fsFiles = await
|
|
3825
|
-
const entryDirectory =
|
|
3826
|
-
const pipfileLockDir = fsFiles[
|
|
3827
|
-
?
|
|
3592
|
+
let fsFiles = await build_utils_1.glob('**', workPath);
|
|
3593
|
+
const entryDirectory = path_1.dirname(entrypoint);
|
|
3594
|
+
const pipfileLockDir = fsFiles[path_1.join(entryDirectory, 'Pipfile.lock')]
|
|
3595
|
+
? path_1.join(workPath, entryDirectory)
|
|
3828
3596
|
: fsFiles['Pipfile.lock']
|
|
3829
3597
|
? workPath
|
|
3830
3598
|
: null;
|
|
3831
3599
|
if (pipfileLockDir) {
|
|
3832
|
-
|
|
3600
|
+
build_utils_1.debug('Found "Pipfile.lock"');
|
|
3601
|
+
try {
|
|
3602
|
+
const json = await readFile(path_1.join(pipfileLockDir, 'Pipfile.lock'), 'utf8');
|
|
3603
|
+
const obj = JSON.parse(json);
|
|
3604
|
+
if (!meta.isDev && ((_b = (_a = obj === null || obj === void 0 ? void 0 : obj._meta) === null || _a === void 0 ? void 0 : _a.requires) === null || _b === void 0 ? void 0 : _b.python_version) === '3.6') {
|
|
3605
|
+
pipPath = 'pip3.6';
|
|
3606
|
+
pythonPath = 'python3.6';
|
|
3607
|
+
pythonRuntime = 'python3.6';
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
catch (err) {
|
|
3611
|
+
throw new build_utils_1.NowBuildError({
|
|
3612
|
+
code: 'INVALID_PIPFILE_LOCK',
|
|
3613
|
+
message: 'Unable to parse Pipfile.lock',
|
|
3614
|
+
});
|
|
3615
|
+
}
|
|
3833
3616
|
// Convert Pipenv.Lock to requirements.txt.
|
|
3834
3617
|
// We use a different`workPath` here because we want `pipfile-requirements` and it's dependencies
|
|
3835
3618
|
// to not be part of the lambda environment. By using pip's `--target` directive we can isolate
|
|
3836
3619
|
// it into a separate folder.
|
|
3837
|
-
const tempDir = await
|
|
3838
|
-
await installRequirement({
|
|
3620
|
+
const tempDir = await build_utils_1.getWriteableDirectory();
|
|
3621
|
+
await install_1.installRequirement({
|
|
3622
|
+
pythonPath,
|
|
3623
|
+
pipPath,
|
|
3839
3624
|
dependency: 'pipfile-requirements',
|
|
3840
3625
|
version: '0.3.0',
|
|
3841
3626
|
workPath: tempDir,
|
|
@@ -3845,66 +3630,275 @@ const build = async ({ workPath, files: originalFiles, entrypoint, meta = {}, co
|
|
|
3845
3630
|
// Python needs to know where to look up all the packages we just installed.
|
|
3846
3631
|
// We tell it to use the same location as used with `--target`
|
|
3847
3632
|
process.env.PYTHONPATH = tempDir;
|
|
3848
|
-
const convertCmd =
|
|
3633
|
+
const convertCmd = path_1.join(tempDir, 'bin', 'pipfile2req');
|
|
3849
3634
|
await pipenvConvert(convertCmd, pipfileLockDir);
|
|
3850
3635
|
}
|
|
3851
|
-
fsFiles = await
|
|
3852
|
-
const requirementsTxt =
|
|
3636
|
+
fsFiles = await build_utils_1.glob('**', workPath);
|
|
3637
|
+
const requirementsTxt = path_1.join(entryDirectory, 'requirements.txt');
|
|
3853
3638
|
if (fsFiles[requirementsTxt]) {
|
|
3854
|
-
|
|
3639
|
+
build_utils_1.debug('Found local "requirements.txt"');
|
|
3855
3640
|
const requirementsTxtPath = fsFiles[requirementsTxt].fsPath;
|
|
3856
|
-
await installRequirementsFile({
|
|
3641
|
+
await install_1.installRequirementsFile({
|
|
3642
|
+
pythonPath,
|
|
3643
|
+
pipPath,
|
|
3857
3644
|
filePath: requirementsTxtPath,
|
|
3858
3645
|
workPath,
|
|
3859
3646
|
meta,
|
|
3860
3647
|
});
|
|
3861
3648
|
}
|
|
3862
3649
|
else if (fsFiles['requirements.txt']) {
|
|
3863
|
-
|
|
3650
|
+
build_utils_1.debug('Found global "requirements.txt"');
|
|
3864
3651
|
const requirementsTxtPath = fsFiles['requirements.txt'].fsPath;
|
|
3865
|
-
await installRequirementsFile({
|
|
3652
|
+
await install_1.installRequirementsFile({
|
|
3653
|
+
pythonPath,
|
|
3654
|
+
pipPath,
|
|
3866
3655
|
filePath: requirementsTxtPath,
|
|
3867
3656
|
workPath,
|
|
3868
3657
|
meta,
|
|
3869
3658
|
});
|
|
3870
3659
|
}
|
|
3871
|
-
const originalPyPath =
|
|
3872
|
-
const originalHandlerPyContents = await readFile(
|
|
3873
|
-
|
|
3660
|
+
const originalPyPath = __webpack_require__.ab + "vc_init.py";
|
|
3661
|
+
const originalHandlerPyContents = await readFile(__webpack_require__.ab + "vc_init.py", 'utf8');
|
|
3662
|
+
build_utils_1.debug('Entrypoint is', entrypoint);
|
|
3874
3663
|
const moduleName = entrypoint.replace(/\//g, '.').replace(/\.py$/, '');
|
|
3875
3664
|
// Since `vercel dev` renames source files, we must reference the original
|
|
3876
3665
|
const suffix = meta.isDev && !entrypoint.endsWith('.py') ? '.py' : '';
|
|
3877
3666
|
const entrypointWithSuffix = `${entrypoint}${suffix}`;
|
|
3878
|
-
|
|
3667
|
+
build_utils_1.debug('Entrypoint with suffix is', entrypointWithSuffix);
|
|
3879
3668
|
const handlerPyContents = originalHandlerPyContents
|
|
3880
3669
|
.replace(/__VC_HANDLER_MODULE_NAME/g, moduleName)
|
|
3881
3670
|
.replace(/__VC_HANDLER_ENTRYPOINT/g, entrypointWithSuffix);
|
|
3882
3671
|
// in order to allow the user to have `server.py`, we need our `server.py` to be called
|
|
3883
3672
|
// somethig else
|
|
3884
3673
|
const handlerPyFilename = 'vc__handler__python';
|
|
3885
|
-
await writeFile(
|
|
3674
|
+
await writeFile(path_1.join(workPath, `${handlerPyFilename}.py`), handlerPyContents);
|
|
3886
3675
|
// Use the system-installed version of `python3` when running via `vercel dev`
|
|
3887
|
-
const runtime = meta.isDev ? 'python3' :
|
|
3676
|
+
const runtime = meta.isDev ? 'python3' : pythonRuntime;
|
|
3888
3677
|
const globOptions = {
|
|
3889
3678
|
cwd: workPath,
|
|
3890
3679
|
ignore: config && typeof config.excludeFiles === 'string'
|
|
3891
3680
|
? config.excludeFiles
|
|
3892
3681
|
: 'node_modules/**',
|
|
3893
3682
|
};
|
|
3894
|
-
const lambda = await
|
|
3895
|
-
files: await
|
|
3683
|
+
const lambda = await build_utils_1.createLambda({
|
|
3684
|
+
files: await build_utils_1.glob('**', globOptions),
|
|
3896
3685
|
handler: `${handlerPyFilename}.vc_handler`,
|
|
3897
3686
|
runtime,
|
|
3898
3687
|
environment: {},
|
|
3899
3688
|
});
|
|
3900
3689
|
return { output: lambda };
|
|
3901
3690
|
};
|
|
3691
|
+
exports.build = build;
|
|
3692
|
+
|
|
3693
|
+
|
|
3694
|
+
/***/ }),
|
|
3695
|
+
|
|
3696
|
+
/***/ 95:
|
|
3697
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3698
|
+
|
|
3699
|
+
"use strict";
|
|
3700
|
+
|
|
3701
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3702
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3703
|
+
};
|
|
3704
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3705
|
+
exports.installRequirementsFile = exports.installRequirement = void 0;
|
|
3706
|
+
const execa_1 = __importDefault(__webpack_require__(580));
|
|
3707
|
+
const build_utils_1 = __webpack_require__(445);
|
|
3708
|
+
const makeDependencyCheckCode = (dependency) => `
|
|
3709
|
+
from importlib import util
|
|
3710
|
+
dep = '${dependency}'.replace('-', '_')
|
|
3711
|
+
spec = util.find_spec(dep)
|
|
3712
|
+
print(spec.origin)
|
|
3713
|
+
`;
|
|
3714
|
+
async function isInstalled(pythonPath, dependency, cwd) {
|
|
3715
|
+
try {
|
|
3716
|
+
const { stdout } = await execa_1.default(pythonPath, ['-c', makeDependencyCheckCode(dependency)], {
|
|
3717
|
+
stdio: 'pipe',
|
|
3718
|
+
cwd,
|
|
3719
|
+
});
|
|
3720
|
+
return stdout.startsWith(cwd);
|
|
3721
|
+
}
|
|
3722
|
+
catch (err) {
|
|
3723
|
+
return false;
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
const makeRequirementsCheckCode = (requirementsPath) => `
|
|
3727
|
+
import distutils.text_file
|
|
3728
|
+
import pkg_resources
|
|
3729
|
+
from pkg_resources import DistributionNotFound, VersionConflict
|
|
3730
|
+
dependencies = distutils.text_file.TextFile(filename='${requirementsPath}').readlines()
|
|
3731
|
+
pkg_resources.require(dependencies)
|
|
3732
|
+
`;
|
|
3733
|
+
async function areRequirementsInstalled(pythonPath, requirementsPath, cwd) {
|
|
3734
|
+
try {
|
|
3735
|
+
await execa_1.default(pythonPath, ['-c', makeRequirementsCheckCode(requirementsPath)], {
|
|
3736
|
+
stdio: 'pipe',
|
|
3737
|
+
cwd,
|
|
3738
|
+
});
|
|
3739
|
+
return true;
|
|
3740
|
+
}
|
|
3741
|
+
catch (err) {
|
|
3742
|
+
return false;
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
async function pipInstall(pipPath, workPath, args) {
|
|
3746
|
+
const target = '.';
|
|
3747
|
+
// See: https://github.com/pypa/pip/issues/4222#issuecomment-417646535
|
|
3748
|
+
//
|
|
3749
|
+
// Disable installing to the Python user install directory, which is
|
|
3750
|
+
// the default behavior on Debian systems and causes error:
|
|
3751
|
+
//
|
|
3752
|
+
// distutils.errors.DistutilsOptionError: can't combine user with
|
|
3753
|
+
// prefix, exec_prefix/home, or install_(plat)base
|
|
3754
|
+
process.env.PIP_USER = '0';
|
|
3755
|
+
const cmdArgs = [
|
|
3756
|
+
'install',
|
|
3757
|
+
'--disable-pip-version-check',
|
|
3758
|
+
'--target',
|
|
3759
|
+
target,
|
|
3760
|
+
...args,
|
|
3761
|
+
];
|
|
3762
|
+
const pretty = `${pipPath} ${cmdArgs.join(' ')}`;
|
|
3763
|
+
build_utils_1.debug(`Running "${pretty}"...`);
|
|
3764
|
+
try {
|
|
3765
|
+
await execa_1.default(pipPath, cmdArgs, {
|
|
3766
|
+
cwd: workPath,
|
|
3767
|
+
});
|
|
3768
|
+
}
|
|
3769
|
+
catch (err) {
|
|
3770
|
+
console.log(`Failed to run "${pretty}"`);
|
|
3771
|
+
throw err;
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
// note that any internal dependency that vc_init.py requires that's installed
|
|
3775
|
+
// with this function can get overriden by a newer version from requirements.txt,
|
|
3776
|
+
// so vc_init should do runtime version checks to be compatible with any recent
|
|
3777
|
+
// version of its dependencies
|
|
3778
|
+
async function installRequirement({ pythonPath, pipPath, dependency, version, workPath, meta, args = [], }) {
|
|
3779
|
+
if (meta.isDev && (await isInstalled(pythonPath, dependency, workPath))) {
|
|
3780
|
+
build_utils_1.debug(`Skipping ${dependency} dependency installation, already installed in ${workPath}`);
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
const exact = `${dependency}==${version}`;
|
|
3784
|
+
await pipInstall(pipPath, workPath, [exact, ...args]);
|
|
3785
|
+
}
|
|
3786
|
+
exports.installRequirement = installRequirement;
|
|
3787
|
+
async function installRequirementsFile({ pythonPath, pipPath, filePath, workPath, meta, args = [], }) {
|
|
3788
|
+
if (meta.isDev &&
|
|
3789
|
+
(await areRequirementsInstalled(pythonPath, filePath, workPath))) {
|
|
3790
|
+
build_utils_1.debug(`Skipping requirements file installation, already installed`);
|
|
3791
|
+
return;
|
|
3792
|
+
}
|
|
3793
|
+
await pipInstall(pipPath, workPath, ['--upgrade', '-r', filePath, ...args]);
|
|
3794
|
+
}
|
|
3795
|
+
exports.installRequirementsFile = installRequirementsFile;
|
|
3796
|
+
|
|
3797
|
+
|
|
3798
|
+
/***/ }),
|
|
3902
3799
|
|
|
3903
|
-
|
|
3800
|
+
/***/ 445:
|
|
3801
|
+
/***/ ((module) => {
|
|
3904
3802
|
|
|
3803
|
+
"use strict";
|
|
3804
|
+
module.exports = require("@vercel/build-utils");
|
|
3905
3805
|
|
|
3906
|
-
})
|
|
3806
|
+
/***/ }),
|
|
3907
3807
|
|
|
3908
|
-
|
|
3808
|
+
/***/ 357:
|
|
3809
|
+
/***/ ((module) => {
|
|
3810
|
+
|
|
3811
|
+
"use strict";
|
|
3812
|
+
module.exports = require("assert");
|
|
3813
|
+
|
|
3814
|
+
/***/ }),
|
|
3815
|
+
|
|
3816
|
+
/***/ 129:
|
|
3817
|
+
/***/ ((module) => {
|
|
3818
|
+
|
|
3819
|
+
"use strict";
|
|
3820
|
+
module.exports = require("child_process");
|
|
3821
|
+
|
|
3822
|
+
/***/ }),
|
|
3823
|
+
|
|
3824
|
+
/***/ 614:
|
|
3825
|
+
/***/ ((module) => {
|
|
3826
|
+
|
|
3827
|
+
"use strict";
|
|
3828
|
+
module.exports = require("events");
|
|
3829
|
+
|
|
3830
|
+
/***/ }),
|
|
3831
|
+
|
|
3832
|
+
/***/ 747:
|
|
3833
|
+
/***/ ((module) => {
|
|
3834
|
+
|
|
3835
|
+
"use strict";
|
|
3836
|
+
module.exports = require("fs");
|
|
3837
|
+
|
|
3838
|
+
/***/ }),
|
|
3839
|
+
|
|
3840
|
+
/***/ 622:
|
|
3841
|
+
/***/ ((module) => {
|
|
3842
|
+
|
|
3843
|
+
"use strict";
|
|
3844
|
+
module.exports = require("path");
|
|
3845
|
+
|
|
3846
|
+
/***/ }),
|
|
3847
|
+
|
|
3848
|
+
/***/ 413:
|
|
3849
|
+
/***/ ((module) => {
|
|
3850
|
+
|
|
3851
|
+
"use strict";
|
|
3852
|
+
module.exports = require("stream");
|
|
3853
|
+
|
|
3854
|
+
/***/ }),
|
|
3855
|
+
|
|
3856
|
+
/***/ 669:
|
|
3857
|
+
/***/ ((module) => {
|
|
3858
|
+
|
|
3859
|
+
"use strict";
|
|
3860
|
+
module.exports = require("util");
|
|
3861
|
+
|
|
3862
|
+
/***/ })
|
|
3863
|
+
|
|
3864
|
+
/******/ });
|
|
3865
|
+
/************************************************************************/
|
|
3866
|
+
/******/ // The module cache
|
|
3867
|
+
/******/ var __webpack_module_cache__ = {};
|
|
3868
|
+
/******/
|
|
3869
|
+
/******/ // The require function
|
|
3870
|
+
/******/ function __webpack_require__(moduleId) {
|
|
3871
|
+
/******/ // Check if module is in cache
|
|
3872
|
+
/******/ if(__webpack_module_cache__[moduleId]) {
|
|
3873
|
+
/******/ return __webpack_module_cache__[moduleId].exports;
|
|
3874
|
+
/******/ }
|
|
3875
|
+
/******/ // Create a new module (and put it into the cache)
|
|
3876
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3877
|
+
/******/ // no module.id needed
|
|
3878
|
+
/******/ // no module.loaded needed
|
|
3879
|
+
/******/ exports: {}
|
|
3880
|
+
/******/ };
|
|
3881
|
+
/******/
|
|
3882
|
+
/******/ // Execute the module function
|
|
3883
|
+
/******/ var threw = true;
|
|
3884
|
+
/******/ try {
|
|
3885
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
3886
|
+
/******/ threw = false;
|
|
3887
|
+
/******/ } finally {
|
|
3888
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
3889
|
+
/******/ }
|
|
3890
|
+
/******/
|
|
3891
|
+
/******/ // Return the exports of the module
|
|
3892
|
+
/******/ return module.exports;
|
|
3893
|
+
/******/ }
|
|
3894
|
+
/******/
|
|
3895
|
+
/************************************************************************/
|
|
3896
|
+
/******/ /* webpack/runtime/compat */
|
|
3897
|
+
/******/
|
|
3898
|
+
/******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
|
|
3899
|
+
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
|
3900
|
+
/******/ // startup
|
|
3901
|
+
/******/ // Load entry module and return exports
|
|
3902
|
+
/******/ return __webpack_require__(855);
|
|
3909
3903
|
/******/ })()
|
|
3910
3904
|
;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Meta } from '@vercel/build-utils';
|
|
2
|
+
interface InstallRequirementArg {
|
|
3
|
+
pythonPath: string;
|
|
4
|
+
pipPath: string;
|
|
5
|
+
dependency: string;
|
|
6
|
+
version: string;
|
|
7
|
+
workPath: string;
|
|
8
|
+
meta: Meta;
|
|
9
|
+
args?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function installRequirement({ pythonPath, pipPath, dependency, version, workPath, meta, args, }: InstallRequirementArg): Promise<void>;
|
|
12
|
+
interface InstallRequirementsFileArg {
|
|
13
|
+
pythonPath: string;
|
|
14
|
+
pipPath: string;
|
|
15
|
+
filePath: string;
|
|
16
|
+
workPath: string;
|
|
17
|
+
meta: Meta;
|
|
18
|
+
args?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function installRequirementsFile({ pythonPath, pipPath, filePath, workPath, meta, args, }: InstallRequirementsFileArg): Promise<void>;
|
|
21
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "2.0.6-canary.
|
|
3
|
+
"version": "2.0.6-canary.6",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/execa": "^0.9.0",
|
|
23
|
-
"@vercel/ncc": "0.
|
|
23
|
+
"@vercel/ncc": "0.24.0",
|
|
24
24
|
"execa": "^1.0.0",
|
|
25
25
|
"typescript": "4.3.4"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4aa6a139127e4e57469d4b6785546ccb49ca188b"
|
|
28
28
|
}
|