vercel 23.1.3-canary.3 → 23.1.3-canary.33

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.
Files changed (90) hide show
  1. package/dist/VERCEL_DIR_README.txt +11 -0
  2. package/dist/builder-worker.js +48 -0
  3. package/dist/clipboard_i686.exe +0 -0
  4. package/dist/clipboard_x86_64.exe +0 -0
  5. package/dist/index.js +270627 -0
  6. package/dist/runtimes/go1.x/bootstrap.d.ts +1 -0
  7. package/dist/runtimes/go1.x/bootstrap.go +273 -0
  8. package/dist/runtimes/go1.x/bootstrap.js +9 -0
  9. package/dist/runtimes/go1.x/bootstrap.js.map +1 -0
  10. package/dist/runtimes/go1.x/filename.d.ts +1 -0
  11. package/dist/runtimes/go1.x/filename.js +8 -0
  12. package/dist/runtimes/go1.x/filename.js.map +1 -0
  13. package/dist/runtimes/go1.x/index.d.ts +2 -0
  14. package/dist/runtimes/go1.x/index.js +56 -0
  15. package/dist/runtimes/go1.x/index.js.map +1 -0
  16. package/dist/runtimes/nodejs/bootstrap +16 -0
  17. package/dist/runtimes/nodejs/bootstrap.d.ts +1 -0
  18. package/dist/runtimes/nodejs/bootstrap.js +199 -0
  19. package/dist/runtimes/nodejs/bootstrap.js.map +1 -0
  20. package/dist/runtimes/nodejs10.x/bootstrap +9 -0
  21. package/dist/runtimes/nodejs10.x/bootstrap.d.ts +1 -0
  22. package/dist/runtimes/nodejs10.x/bootstrap.js +8 -0
  23. package/dist/runtimes/nodejs10.x/bootstrap.js.map +1 -0
  24. package/dist/runtimes/nodejs10.x/index.d.ts +2 -0
  25. package/dist/runtimes/nodejs10.x/index.js +23 -0
  26. package/dist/runtimes/nodejs10.x/index.js.map +1 -0
  27. package/dist/runtimes/nodejs12.x/bootstrap +9 -0
  28. package/dist/runtimes/nodejs12.x/bootstrap.d.ts +1 -0
  29. package/dist/runtimes/nodejs12.x/bootstrap.js +8 -0
  30. package/dist/runtimes/nodejs12.x/bootstrap.js.map +1 -0
  31. package/dist/runtimes/nodejs12.x/index.d.ts +2 -0
  32. package/dist/runtimes/nodejs12.x/index.js +23 -0
  33. package/dist/runtimes/nodejs12.x/index.js.map +1 -0
  34. package/dist/runtimes/nodejs6.10/bootstrap +9 -0
  35. package/dist/runtimes/nodejs6.10/bootstrap.d.ts +1 -0
  36. package/dist/runtimes/nodejs6.10/bootstrap.js +8 -0
  37. package/dist/runtimes/nodejs6.10/bootstrap.js.map +1 -0
  38. package/dist/runtimes/nodejs6.10/index.d.ts +2 -0
  39. package/dist/runtimes/nodejs6.10/index.js +23 -0
  40. package/dist/runtimes/nodejs6.10/index.js.map +1 -0
  41. package/dist/runtimes/nodejs8.10/bootstrap +9 -0
  42. package/dist/runtimes/nodejs8.10/bootstrap.d.ts +1 -0
  43. package/dist/runtimes/nodejs8.10/bootstrap.js +8 -0
  44. package/dist/runtimes/nodejs8.10/bootstrap.js.map +1 -0
  45. package/dist/runtimes/nodejs8.10/index.d.ts +2 -0
  46. package/dist/runtimes/nodejs8.10/index.js +23 -0
  47. package/dist/runtimes/nodejs8.10/index.js.map +1 -0
  48. package/dist/runtimes/provided/bootstrap +3 -0
  49. package/dist/runtimes/provided/bootstrap.d.ts +1 -0
  50. package/dist/runtimes/provided/bootstrap.js +8 -0
  51. package/dist/runtimes/provided/bootstrap.js.map +1 -0
  52. package/dist/runtimes/python/bootstrap +10 -0
  53. package/dist/runtimes/python/bootstrap.d.ts +1 -0
  54. package/dist/runtimes/python/bootstrap.js +12 -0
  55. package/dist/runtimes/python/bootstrap.js.map +1 -0
  56. package/dist/runtimes/python/bootstrap.py +147 -0
  57. package/dist/runtimes/python2.7/bootstrap +9 -0
  58. package/dist/runtimes/python2.7/bootstrap.d.ts +1 -0
  59. package/dist/runtimes/python2.7/bootstrap.js +8 -0
  60. package/dist/runtimes/python2.7/bootstrap.js.map +1 -0
  61. package/dist/runtimes/python2.7/index.d.ts +2 -0
  62. package/dist/runtimes/python2.7/index.js +23 -0
  63. package/dist/runtimes/python2.7/index.js.map +1 -0
  64. package/dist/runtimes/python3/bootstrap +20 -0
  65. package/dist/runtimes/python3/bootstrap.d.ts +1 -0
  66. package/dist/runtimes/python3/bootstrap.js +26 -0
  67. package/dist/runtimes/python3/bootstrap.js.map +1 -0
  68. package/dist/runtimes/python3/index.d.ts +2 -0
  69. package/dist/runtimes/python3/index.js +19 -0
  70. package/dist/runtimes/python3/index.js.map +1 -0
  71. package/dist/runtimes/python3.6/bootstrap +9 -0
  72. package/dist/runtimes/python3.6/bootstrap.d.ts +1 -0
  73. package/dist/runtimes/python3.6/bootstrap.js +8 -0
  74. package/dist/runtimes/python3.6/bootstrap.js.map +1 -0
  75. package/dist/runtimes/python3.6/index.d.ts +2 -0
  76. package/dist/runtimes/python3.6/index.js +23 -0
  77. package/dist/runtimes/python3.6/index.js.map +1 -0
  78. package/dist/runtimes/python3.7/bootstrap +9 -0
  79. package/dist/runtimes/python3.7/bootstrap.d.ts +1 -0
  80. package/dist/runtimes/python3.7/bootstrap.js +8 -0
  81. package/dist/runtimes/python3.7/bootstrap.js.map +1 -0
  82. package/dist/runtimes/python3.7/index.d.ts +2 -0
  83. package/dist/runtimes/python3.7/index.js +23 -0
  84. package/dist/runtimes/python3.7/index.js.map +1 -0
  85. package/dist/term-size +0 -0
  86. package/dist/term-size.exe +0 -0
  87. package/dist/xdg-open +1066 -0
  88. package/dist/xsel +0 -0
  89. package/package.json +16 -12
  90. package/dist/package.json +0 -184
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Node.js version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "nodejs" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../nodejs"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const nodeBin = path_1.join(__dirname, 'bin', 'node');
6
+ const bootstrap = path_1.join(__dirname, '..', 'nodejs', 'bootstrap.js');
7
+ child_process_1.spawn(nodeBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs12.x/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,OAAO,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const install_node_1 = require("../../install-node");
13
+ const runtimes_1 = require("../../runtimes");
14
+ function init({ cacheDir }) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield Promise.all([
17
+ runtimes_1.initializeRuntime(runtimes_1.runtimes.nodejs),
18
+ install_node_1.installNode(cacheDir, '12.14.1')
19
+ ]);
20
+ });
21
+ }
22
+ exports.init = init;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs12.x/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,qDAAiD;AACjD,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,EAAE,QAAQ,EAAW;;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;YACjB,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC;YAClC,0BAAW,CAAC,QAAQ,EAAE,SAAS,CAAC;SAChC,CAAC,CAAC;IACJ,CAAC;CAAA;AALD,oBAKC"}
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Node.js version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "nodejs" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../nodejs"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const nodeBin = path_1.join(__dirname, 'bin', 'node');
6
+ const bootstrap = path_1.join(__dirname, '..', 'nodejs', 'bootstrap.js');
7
+ child_process_1.spawn(nodeBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs6.10/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,OAAO,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const install_node_1 = require("../../install-node");
13
+ const runtimes_1 = require("../../runtimes");
14
+ function init({ cacheDir }) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield Promise.all([
17
+ runtimes_1.initializeRuntime(runtimes_1.runtimes.nodejs),
18
+ install_node_1.installNode(cacheDir, '6.10.0')
19
+ ]);
20
+ });
21
+ }
22
+ exports.init = init;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs6.10/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,qDAAiD;AACjD,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,EAAE,QAAQ,EAAW;;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;YACjB,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC;YAClC,0BAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC/B,CAAC,CAAC;IACJ,CAAC;CAAA;AALD,oBAKC"}
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Node.js version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "nodejs" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../nodejs"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const nodeBin = path_1.join(__dirname, 'bin', 'node');
6
+ const bootstrap = path_1.join(__dirname, '..', 'nodejs', 'bootstrap.js');
7
+ child_process_1.spawn(nodeBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs8.10/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,OAAO,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const install_node_1 = require("../../install-node");
13
+ const runtimes_1 = require("../../runtimes");
14
+ function init({ cacheDir }) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield Promise.all([
17
+ runtimes_1.initializeRuntime(runtimes_1.runtimes.nodejs),
18
+ install_node_1.installNode(cacheDir, '8.10.0')
19
+ ]);
20
+ });
21
+ }
22
+ exports.init = init;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/nodejs8.10/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,qDAAiD;AACjD,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,EAAE,QAAQ,EAAW;;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;YACjB,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC;YAClC,0BAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC/B,CAAC,CAAC;IACJ,CAAC;CAAA;AALD,oBAKC"}
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ # Delegate out to the provided `bootstrap` file
3
+ exec "$LAMBDA_TASK_ROOT/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ // Delegate out to the provided `bootstrap` file within the lambda
6
+ const bootstrap = path_1.join(process.env.LAMBDA_TASK_ROOT, 'bootstrap');
7
+ child_process_1.spawn(bootstrap, [], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/provided/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,kEAAkE;AAClE,MAAM,SAAS,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AAClE,qBAAK,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # `PYTHONPATH` is *not* a restricted env var, so only set the
5
+ # default one if the user did not provide one of their own
6
+ if [ -z "${PYTHONPATH-}" ]; then
7
+ export PYTHONPATH="$LAMBDA_RUNTIME_DIR"
8
+ fi
9
+
10
+ exec python "$LAMBDA_RUNTIME_DIR/bootstrap.py"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ // `PYTHONPATH` is *not* a restricted env var, so only set the
6
+ // default one if the user did not provide one of their own
7
+ if (!process.env.PYTHONPATH) {
8
+ process.env.PYTHONPATH = process.env.LAMBDA_RUNTIME_DIR;
9
+ }
10
+ const bootstrap = path_1.join(__dirname, 'bootstrap.py');
11
+ child_process_1.spawn('python', [bootstrap], { stdio: 'inherit' });
12
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/python/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,8DAA8D;AAC9D,2DAA2D;AAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;IAC5B,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACxD;AAED,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAClD,qBAAK,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,147 @@
1
+ # Parts of this runtime based off of:
2
+ # https://gist.github.com/avoidik/78ddc7854c7b88607f7cf56db3e591e5
3
+
4
+ import os
5
+ import sys
6
+ import json
7
+ import importlib
8
+
9
+ is_python_3 = sys.version_info > (3, 0)
10
+
11
+ if is_python_3:
12
+ import urllib.request
13
+ else:
14
+ import urllib2
15
+
16
+
17
+ class LambdaRequest:
18
+ def __init__(self, path, data=None):
19
+ req = None
20
+ runtime_path = '/2018-06-01/runtime/'
21
+ url = (
22
+ 'http://'
23
+ + os.environ.get(
24
+ 'AWS_LAMBDA_RUNTIME_API', '127.0.0.1:3000'
25
+ )
26
+ + runtime_path
27
+ + path
28
+ )
29
+
30
+ if is_python_3:
31
+ req = urllib.request.urlopen(url, data)
32
+ else:
33
+ req = urllib2.urlopen(url, data)
34
+
35
+ info = req.info()
36
+ body = req.read()
37
+
38
+ if is_python_3:
39
+ body = body.decode(encoding='UTF-8')
40
+
41
+ self.status_code = req.getcode()
42
+ self.body = body
43
+ self.info = info
44
+
45
+ def get_header(self, name):
46
+ if is_python_3:
47
+ return self.info.get(name)
48
+ else:
49
+ return self.info.getheader(name)
50
+
51
+ def get_json_body(self):
52
+ return json.loads(self.body)
53
+
54
+
55
+ def lambda_runtime_next_invocation():
56
+ res = LambdaRequest('invocation/next')
57
+
58
+ if res.status_code != 200:
59
+ raise Exception(
60
+ 'Unexpected /invocation/next response: '
61
+ + res.body
62
+ )
63
+
64
+ x_amzn_trace_id = res.get_header('Lambda-Runtime-Trace-Id')
65
+ if x_amzn_trace_id != None:
66
+ os.environ['_X_AMZN_TRACE_ID'] = x_amzn_trace_id
67
+ elif '_X_AMZN_TRACE_ID' in os.environ:
68
+ del os.environ['_X_AMZN_TRACE_ID']
69
+
70
+ aws_request_id = res.get_header('Lambda-Runtime-Aws-Request-Id')
71
+
72
+ context = {
73
+ # TODO: fill this out
74
+ 'aws_request_id': aws_request_id
75
+ }
76
+
77
+ event = res.get_json_body()
78
+
79
+ return (event, context)
80
+
81
+
82
+ def lambda_runtime_invoke_response(result, context):
83
+ body = json.dumps(result, separators=(',', ':')).encode(
84
+ encoding='UTF-8'
85
+ )
86
+ res = LambdaRequest(
87
+ 'invocation/'
88
+ + context['aws_request_id']
89
+ + '/response',
90
+ body,
91
+ )
92
+ if res.status_code != 202:
93
+ raise Exception(
94
+ 'Unexpected /invocation/response response: '
95
+ + res.body
96
+ )
97
+
98
+
99
+ def lambda_runtime_invoke_error(err, context):
100
+ body = json.dumps(err, separators=(',', ':')).encode(
101
+ encoding='UTF-8'
102
+ )
103
+ res = LambdaRequest(
104
+ 'invocation/'
105
+ + context['aws_request_id']
106
+ + '/error',
107
+ body,
108
+ )
109
+
110
+
111
+ def lambda_runtime_get_handler():
112
+ (module_name, handler_name) = os.environ['_HANDLER'].split('.')
113
+ mod = importlib.import_module(module_name)
114
+ # TODO: invoke `__init__`?
115
+ return getattr(mod, handler_name)
116
+
117
+
118
+ def lambda_runtime_main():
119
+ if not is_python_3:
120
+ reload(sys)
121
+ sys.setdefaultencoding('utf-8')
122
+
123
+ sys.path.insert(
124
+ 0, os.environ.get('LAMBDA_TASK_ROOT', '/var/task')
125
+ )
126
+
127
+ fn = lambda_runtime_get_handler()
128
+
129
+ while True:
130
+ (event, context) = lambda_runtime_next_invocation()
131
+ # print(event)
132
+ # print(context)
133
+ result = None
134
+ try:
135
+ result = fn(event, context)
136
+ except:
137
+ err = str(sys.exc_info()[0])
138
+ print(err)
139
+ lambda_runtime_invoke_error(
140
+ {'error': err}, context
141
+ )
142
+ else:
143
+ lambda_runtime_invoke_response(result, context)
144
+
145
+
146
+ if __name__ == '__main__':
147
+ lambda_runtime_main()
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Python version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "python" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../python"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const pythonBin = path_1.join(__dirname, 'bin', 'python');
6
+ const bootstrap = path_1.join(__dirname, '..', 'python', 'bootstrap.py');
7
+ child_process_1.spawn(pythonBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/python2.7/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const install_python_1 = require("../../install-python");
13
+ const runtimes_1 = require("../../runtimes");
14
+ function init({ cacheDir }) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield Promise.all([
17
+ runtimes_1.initializeRuntime(runtimes_1.runtimes.python),
18
+ install_python_1.installPython(cacheDir, '2.7.12')
19
+ ]);
20
+ });
21
+ }
22
+ exports.init = init;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/python2.7/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,yDAAqD;AACrD,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,EAAE,QAAQ,EAAW;;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;YACjB,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC;YAClC,8BAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC;SACjC,CAAC,CAAC;IACJ,CAAC;CAAA;AALD,oBAKC"}
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Use the system installed python3
5
+ PYTHONBIN="$( command -v python3 || command -v python || echo '' )"
6
+ if [ -z "$PYTHONBIN" ]; then
7
+ echo "Please install Python 3"
8
+ exit 1
9
+ fi
10
+
11
+ # Check if python version is 3
12
+ PYTHONVERSION="$( "$PYTHONBIN" --version 2>&1 )"
13
+ case "$PYTHONVERSION" in
14
+ "Python 3"*) ;;
15
+ *) echo "Please install Python 3" && exit 1 ;;
16
+ esac
17
+
18
+ # Execute the "python" runtime bootstrap
19
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../python"
20
+ exec "$PYTHONBIN" "$LAMBDA_RUNTIME_DIR/bootstrap.py" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ // `PYTHONPATH` is *not* a restricted env var, so only set the
6
+ // default one if the user did not provide one of their own
7
+ if (!process.env.PYTHONPATH) {
8
+ process.env.PYTHONPATH = process.env.LAMBDA_RUNTIME_DIR;
9
+ }
10
+ let pythonBin = 'python3';
11
+ function fallback() {
12
+ pythonBin = 'python';
13
+ }
14
+ function handler(data) {
15
+ const isPython3 = data && data.toString() && data.toString().startsWith('Python 3');
16
+ if (!isPython3) {
17
+ fallback();
18
+ }
19
+ const bootstrap = path_1.join(__dirname, '..', 'python', 'bootstrap.py');
20
+ child_process_1.spawn(pythonBin, [bootstrap], { stdio: 'inherit' });
21
+ }
22
+ const child = child_process_1.spawn(pythonBin, ['--version']);
23
+ child.on('error', fallback);
24
+ child.stderr.on('data', handler);
25
+ child.stdout.on('data', handler);
26
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/python3/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,8DAA8D;AAC9D,2DAA2D;AAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;IAC5B,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACxD;AAED,IAAI,SAAS,GAAG,SAAS,CAAC;AAC1B,SAAS,QAAQ;IAChB,SAAS,GAAG,QAAQ,CAAC;AACtB,CAAC;AACD,SAAS,OAAO,CAAC,IAAa;IAC7B,MAAM,SAAS,GACd,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEnE,IAAI,CAAC,SAAS,EAAE;QACf,QAAQ,EAAE,CAAC;KACX;IAED,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAClE,qBAAK,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AACrD,CAAC;AACD,MAAM,KAAK,GAAG,qBAAK,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;AAC9C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5B,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACjC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init(_runtime: Runtime): Promise<void>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const runtimes_1 = require("../../runtimes");
13
+ function init(_runtime) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ yield runtimes_1.initializeRuntime(runtimes_1.runtimes.python);
16
+ });
17
+ }
18
+ exports.init = init;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/python3/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,QAAiB;;QAC3C,MAAM,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CAAA;AAFD,oBAEC"}
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Python version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "python" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../python"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const pythonBin = path_1.join(__dirname, 'bin', 'python');
6
+ const bootstrap = path_1.join(__dirname, '..', 'python', 'bootstrap.py');
7
+ child_process_1.spawn(pythonBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/python3.6/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const install_python_1 = require("../../install-python");
13
+ const runtimes_1 = require("../../runtimes");
14
+ function init({ cacheDir }) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield Promise.all([
17
+ runtimes_1.initializeRuntime(runtimes_1.runtimes.python),
18
+ install_python_1.installPython(cacheDir, '3.6.8')
19
+ ]);
20
+ });
21
+ }
22
+ exports.init = init;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtimes/python3.6/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,yDAAqD;AACrD,6CAA6D;AAE7D,SAAsB,IAAI,CAAC,EAAE,QAAQ,EAAW;;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;YACjB,4BAAiB,CAAC,mBAAQ,CAAC,MAAM,CAAC;YAClC,8BAAa,CAAC,QAAQ,EAAE,OAAO,CAAC;SAChC,CAAC,CAAC;IACJ,CAAC;CAAA;AALD,oBAKC"}
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Ensure the downloaded Python version is used
5
+ export PATH="$LAMBDA_RUNTIME_DIR/bin:$PATH"
6
+
7
+ # Execute the "python" runtime bootstrap
8
+ export LAMBDA_RUNTIME_DIR="$(dirname "$0")/../python"
9
+ exec "$LAMBDA_RUNTIME_DIR/bootstrap" "$@"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const child_process_1 = require("child_process");
5
+ const pythonBin = path_1.join(__dirname, 'bin', 'python');
6
+ const bootstrap = path_1.join(__dirname, '..', 'python', 'bootstrap.py');
7
+ child_process_1.spawn(pythonBin, [bootstrap], { stdio: 'inherit' });
8
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/runtimes/python3.7/bootstrap.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAC5B,iDAAsC;AAEtC,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,WAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAClE,qBAAK,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Runtime } from '../../types';
2
+ export declare function init({ cacheDir }: Runtime): Promise<void>;