@vercel/fun 1.3.0 → 1.3.1
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/src/deferred.js +1 -2
- package/dist/src/deferred.js.map +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.js +88 -96
- package/dist/src/index.js.map +1 -1
- package/dist/src/install-node.d.ts +0 -1
- package/dist/src/install-node.js +32 -44
- package/dist/src/install-node.js.map +1 -1
- package/dist/src/install-python.d.ts +0 -1
- package/dist/src/install-python.js +16 -33
- package/dist/src/install-python.js.map +1 -1
- package/dist/src/providers/docker/index.js +1 -1
- package/dist/src/providers/docker/index.js.map +1 -1
- package/dist/src/providers/native/index.d.ts +0 -1
- package/dist/src/providers/native/index.js +133 -128
- package/dist/src/providers/native/index.js.map +1 -1
- package/dist/src/runtime-server.d.ts +0 -1
- package/dist/src/runtime-server.js +115 -129
- package/dist/src/runtime-server.js.map +1 -1
- package/dist/src/runtimes/go1.x/filename.js +1 -2
- package/dist/src/runtimes/go1.x/filename.js.map +1 -1
- package/dist/src/runtimes/go1.x/index.js +27 -39
- package/dist/src/runtimes/go1.x/index.js.map +1 -1
- package/dist/src/runtimes/nodejs/bootstrap.js +99 -124
- package/dist/src/runtimes/nodejs/bootstrap.js.map +1 -1
- package/dist/src/runtimes/nodejs10.x/index.js +6 -18
- package/dist/src/runtimes/nodejs10.x/index.js.map +1 -1
- package/dist/src/runtimes/nodejs12.x/index.js +6 -18
- package/dist/src/runtimes/nodejs12.x/index.js.map +1 -1
- package/dist/src/runtimes/nodejs14.x/index.js +6 -18
- package/dist/src/runtimes/nodejs14.x/index.js.map +1 -1
- package/dist/src/runtimes/nodejs6.10/index.js +6 -18
- package/dist/src/runtimes/nodejs6.10/index.js.map +1 -1
- package/dist/src/runtimes/nodejs8.10/index.js +6 -18
- package/dist/src/runtimes/nodejs8.10/index.js.map +1 -1
- package/dist/src/runtimes/python/bootstrap.js.map +1 -1
- package/dist/src/runtimes/python2.7/index.js +6 -18
- package/dist/src/runtimes/python2.7/index.js.map +1 -1
- package/dist/src/runtimes/python3/bootstrap.js.map +1 -1
- package/dist/src/runtimes/python3/index.js +3 -15
- package/dist/src/runtimes/python3/index.js.map +1 -1
- package/dist/src/runtimes/python3.6/index.js +6 -18
- package/dist/src/runtimes/python3.6/index.js.map +1 -1
- package/dist/src/runtimes/python3.7/index.js +6 -18
- package/dist/src/runtimes/python3.7/index.js.map +1 -1
- package/dist/src/runtimes.js +129 -136
- package/dist/src/runtimes.js.map +1 -1
- package/dist/src/types.d.ts +0 -2
- package/dist/src/unzip.d.ts +0 -2
- package/dist/src/unzip.js +65 -78
- package/dist/src/unzip.js.map +1 -1
- package/package.json +4 -6
package/dist/src/unzip.js
CHANGED
|
@@ -1,106 +1,93 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
6
|
+
exports.ZipFile = exports.zipFromBuffer = exports.zipFromFile = void 0;
|
|
7
|
+
exports.unzipToTemp = unzipToTemp;
|
|
8
|
+
exports.unzip = unzip;
|
|
16
9
|
const node_os_1 = require("node:os");
|
|
17
10
|
const stat_mode_1 = __importDefault(require("stat-mode"));
|
|
18
|
-
const promisepipe_1 = __importDefault(require("promisepipe"));
|
|
19
11
|
const debug_1 = __importDefault(require("debug"));
|
|
20
12
|
const node_path_1 = require("node:path");
|
|
21
13
|
const node_fs_1 = require("node:fs");
|
|
22
14
|
const promises_1 = require("node:fs/promises");
|
|
23
|
-
const
|
|
15
|
+
const consumers_1 = require("node:stream/consumers");
|
|
16
|
+
const promises_2 = require("node:stream/promises");
|
|
24
17
|
const yauzl_promise_1 = require("yauzl-promise");
|
|
25
18
|
Object.defineProperty(exports, "ZipFile", { enumerable: true, get: function () { return yauzl_promise_1.ZipFile; } });
|
|
26
19
|
Object.defineProperty(exports, "zipFromFile", { enumerable: true, get: function () { return yauzl_promise_1.open; } });
|
|
27
20
|
Object.defineProperty(exports, "zipFromBuffer", { enumerable: true, get: function () { return yauzl_promise_1.fromBuffer; } });
|
|
28
21
|
const debug = (0, debug_1.default)('@vercel/fun:unzip');
|
|
29
|
-
function unzipToTemp(data, tmpDir = (0, node_os_1.tmpdir)()) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return dir;
|
|
47
|
-
});
|
|
22
|
+
async function unzipToTemp(data, tmpDir = (0, node_os_1.tmpdir)()) {
|
|
23
|
+
const dir = (0, node_path_1.join)(tmpDir, `zeit-fun-${Math.random()
|
|
24
|
+
.toString(16)
|
|
25
|
+
.substring(2)}`);
|
|
26
|
+
let zip;
|
|
27
|
+
if (Buffer.isBuffer(data)) {
|
|
28
|
+
debug('Unzipping buffer (length=%o) to temp dir %o', data.length, dir);
|
|
29
|
+
zip = await (0, yauzl_promise_1.fromBuffer)(data);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
debug('Unzipping %o to temp dir %o', data, dir);
|
|
33
|
+
zip = await (0, yauzl_promise_1.open)(data);
|
|
34
|
+
}
|
|
35
|
+
await unzip(zip, dir);
|
|
36
|
+
await zip.close();
|
|
37
|
+
debug('Finished unzipping to %o', dir);
|
|
38
|
+
return dir;
|
|
48
39
|
}
|
|
49
|
-
exports.unzipToTemp = unzipToTemp;
|
|
50
40
|
const getMode = (entry) => new stat_mode_1.default({ mode: entry.externalFileAttributes >>> 16 });
|
|
51
|
-
function unzip(zipFile, dir, opts = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
41
|
+
async function unzip(zipFile, dir, opts = {}) {
|
|
42
|
+
let entry;
|
|
43
|
+
const strip = opts.strip || 0;
|
|
44
|
+
while ((entry = await zipFile.readEntry()) !== null) {
|
|
45
|
+
const fileName = strip === 0
|
|
46
|
+
? entry.fileName
|
|
47
|
+
: entry.fileName
|
|
48
|
+
.split('/')
|
|
49
|
+
.slice(strip)
|
|
50
|
+
.join('/');
|
|
51
|
+
const destPath = (0, node_path_1.join)(dir, fileName);
|
|
52
|
+
if (/\/$/.test(entry.fileName)) {
|
|
53
|
+
debug('Creating directory %o', destPath);
|
|
54
|
+
await (0, promises_1.mkdir)(destPath, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const [entryStream] = await Promise.all([
|
|
58
|
+
entry.openReadStream(),
|
|
59
|
+
// ensure parent directory exists
|
|
60
|
+
(0, promises_1.mkdir)((0, node_path_1.dirname)(destPath), { recursive: true })
|
|
61
|
+
]);
|
|
62
|
+
const mode = getMode(entry);
|
|
63
|
+
if (mode.isSymbolicLink()) {
|
|
64
|
+
const linkDest = await (0, consumers_1.text)(entryStream);
|
|
65
|
+
debug('Creating symboling link %o to %o', destPath, linkDest);
|
|
66
|
+
await (0, promises_1.symlink)(linkDest, destPath);
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(
|
|
72
|
-
]);
|
|
73
|
-
const mode = getMode(entry);
|
|
74
|
-
if (mode.isSymbolicLink()) {
|
|
75
|
-
const linkDest = String(yield (0, stream_to_promise_1.default)(entryStream));
|
|
76
|
-
debug('Creating symboling link %o to %o', destPath, linkDest);
|
|
77
|
-
yield (0, promises_1.symlink)(linkDest, destPath);
|
|
69
|
+
const modeOctal = mode.toOctal();
|
|
70
|
+
const modeVal = parseInt(modeOctal, 8);
|
|
71
|
+
if (modeVal === 0) {
|
|
72
|
+
debug('Unzipping file to %o', destPath);
|
|
78
73
|
}
|
|
79
74
|
else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
yield (0, promises_1.unlink)(destPath);
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
if (err.code !== 'ENOENT') {
|
|
93
|
-
throw err;
|
|
94
|
-
}
|
|
75
|
+
debug('Unzipping file to %o with mode %s (%s)', destPath, modeOctal, String(mode));
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
await (0, promises_1.unlink)(destPath);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
if (err.code !== 'ENOENT') {
|
|
82
|
+
throw err;
|
|
95
83
|
}
|
|
96
|
-
const destStream = (0, node_fs_1.createWriteStream)(destPath, {
|
|
97
|
-
mode: modeVal
|
|
98
|
-
});
|
|
99
|
-
yield (0, promisepipe_1.default)(entryStream, destStream);
|
|
100
84
|
}
|
|
85
|
+
const destStream = (0, node_fs_1.createWriteStream)(destPath, {
|
|
86
|
+
mode: modeVal
|
|
87
|
+
});
|
|
88
|
+
await (0, promises_2.pipeline)(entryStream, destStream);
|
|
101
89
|
}
|
|
102
90
|
}
|
|
103
|
-
}
|
|
91
|
+
}
|
|
104
92
|
}
|
|
105
|
-
exports.unzip = unzip;
|
|
106
93
|
//# sourceMappingURL=unzip.js.map
|
package/dist/src/unzip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unzip.js","sourceRoot":"","sources":["../../src/unzip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unzip.js","sourceRoot":"","sources":["../../src/unzip.ts"],"names":[],"mappings":";;;;;;AAmBA,kCAsBC;AASD,sBAyDC;AA3GD,qCAAiC;AACjC,0DAA6B;AAC7B,kDAAgC;AAChC,yCAA0C;AAC1C,qCAA4C;AAC5C,+CAA0D;AAC1D,qDAA6C;AAC7C,mDAAgD;AAChD,iDAKuB;AAEc,wFALpC,uBAAO,OAKoC;AAAnC,4FAJA,oBAAW,OAIA;AAAE,8FAHP,0BAAa,OAGO;AAEnC,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,mBAAmB,CAAC,CAAC;AAExC,KAAK,UAAU,WAAW,CAChC,IAAqB,EACrB,SAAiB,IAAA,gBAAM,GAAE;IAEzB,MAAM,GAAG,GAAG,IAAA,gBAAI,EACf,MAAM,EACN,YAAY,IAAI,CAAC,MAAM,EAAE;SACvB,QAAQ,CAAC,EAAE,CAAC;SACZ,SAAS,CAAC,CAAC,CAAC,EAAE,CAChB,CAAC;IACF,IAAI,GAAY,CAAC;IACjB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,6CAA6C,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACvE,GAAG,GAAG,MAAM,IAAA,0BAAa,EAAC,IAAI,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACP,KAAK,CAAC,6BAA6B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAChD,GAAG,GAAG,MA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AC;IACF,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fun",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Local Lambda development environment",
|
|
5
5
|
"main": "dist/src/index",
|
|
6
6
|
"typings": "dist/src/index",
|
|
@@ -27,10 +27,8 @@
|
|
|
27
27
|
"ms": "2.1.1",
|
|
28
28
|
"node-fetch": "2.6.7",
|
|
29
29
|
"path-to-regexp": "8.2.0",
|
|
30
|
-
"promisepipe": "3.0.0",
|
|
31
30
|
"semver": "7.5.4",
|
|
32
31
|
"stat-mode": "0.3.0",
|
|
33
|
-
"stream-to-promise": "2.2.0",
|
|
34
32
|
"tar": "7.5.7",
|
|
35
33
|
"tinyexec": "0.3.2",
|
|
36
34
|
"tree-kill": "1.2.2",
|
|
@@ -43,7 +41,7 @@
|
|
|
43
41
|
"@types/debug": "4.1.9",
|
|
44
42
|
"@types/generic-pool": "3.1.9",
|
|
45
43
|
"@types/micro": "7.3.6",
|
|
46
|
-
"@types/node": "
|
|
44
|
+
"@types/node": "20.19.33",
|
|
47
45
|
"@types/node-fetch": "2.5.0",
|
|
48
46
|
"@types/tar": "4.0.0",
|
|
49
47
|
"@types/yauzl-promise": "2.1.0",
|
|
@@ -54,7 +52,7 @@
|
|
|
54
52
|
"pre-commit": "1.2.2",
|
|
55
53
|
"prettier": "1.15.3",
|
|
56
54
|
"source-map-support": "0.5.10",
|
|
57
|
-
"typescript": "
|
|
55
|
+
"typescript": "5.9.3",
|
|
58
56
|
"vitest": "3.0.5"
|
|
59
57
|
},
|
|
60
58
|
"pre-commit": "lint:staged",
|
|
@@ -66,6 +64,6 @@
|
|
|
66
64
|
},
|
|
67
65
|
"packageManager": "pnpm@10.1.0",
|
|
68
66
|
"engines": {
|
|
69
|
-
"node": ">=
|
|
67
|
+
"node": ">= 20"
|
|
70
68
|
}
|
|
71
69
|
}
|