@vercel/go 3.7.1 → 3.9.0
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/bin/proxy-linux-amd64 +0 -0
- package/bin/proxy-linux-arm64 +0 -0
- package/dist/index.js +768 -422
- package/package.json +5 -3
- package/bootstrap/go.mod +0 -3
- package/bootstrap/vc-init.go +0 -274
- /package/bootstrap/{vc-utils.go → utils.go} +0 -0
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var require_windows = __commonJS({
|
|
|
75
75
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
|
76
76
|
module2.exports = isexe;
|
|
77
77
|
isexe.sync = sync;
|
|
78
|
-
var
|
|
78
|
+
var fs3 = require("fs");
|
|
79
79
|
function checkPathExt(path, options) {
|
|
80
80
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
81
81
|
if (!pathext) {
|
|
@@ -100,12 +100,12 @@ var require_windows = __commonJS({
|
|
|
100
100
|
return checkPathExt(path, options);
|
|
101
101
|
}
|
|
102
102
|
function isexe(path, options, cb) {
|
|
103
|
-
|
|
103
|
+
fs3.stat(path, function(er2, stat) {
|
|
104
104
|
cb(er2, er2 ? false : checkStat(stat, path, options));
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
function sync(path, options) {
|
|
108
|
-
return checkStat(
|
|
108
|
+
return checkStat(fs3.statSync(path), path, options);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
});
|
|
@@ -115,14 +115,14 @@ var require_mode = __commonJS({
|
|
|
115
115
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
|
116
116
|
module2.exports = isexe;
|
|
117
117
|
isexe.sync = sync;
|
|
118
|
-
var
|
|
118
|
+
var fs3 = require("fs");
|
|
119
119
|
function isexe(path, options, cb) {
|
|
120
|
-
|
|
120
|
+
fs3.stat(path, function(er2, stat) {
|
|
121
121
|
cb(er2, er2 ? false : checkStat(stat, options));
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
function sync(path, options) {
|
|
125
|
-
return checkStat(
|
|
125
|
+
return checkStat(fs3.statSync(path), options);
|
|
126
126
|
}
|
|
127
127
|
function checkStat(stat, options) {
|
|
128
128
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -146,7 +146,7 @@ var require_mode = __commonJS({
|
|
|
146
146
|
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
147
147
|
var require_isexe = __commonJS({
|
|
148
148
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
|
149
|
-
var
|
|
149
|
+
var fs3 = require("fs");
|
|
150
150
|
var core;
|
|
151
151
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
152
152
|
core = require_windows();
|
|
@@ -422,7 +422,7 @@ var require_shebang_command = __commonJS({
|
|
|
422
422
|
var require_readShebang = __commonJS({
|
|
423
423
|
"../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
|
|
424
424
|
"use strict";
|
|
425
|
-
var
|
|
425
|
+
var fs3 = require("fs");
|
|
426
426
|
var shebangCommand = require_shebang_command();
|
|
427
427
|
function readShebang(command) {
|
|
428
428
|
const size = 150;
|
|
@@ -435,9 +435,9 @@ var require_readShebang = __commonJS({
|
|
|
435
435
|
}
|
|
436
436
|
let fd;
|
|
437
437
|
try {
|
|
438
|
-
fd =
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
fd = fs3.openSync(command, "r");
|
|
439
|
+
fs3.readSync(fd, buffer, 0, size, 0);
|
|
440
|
+
fs3.closeSync(fd);
|
|
441
441
|
} catch (e) {
|
|
442
442
|
}
|
|
443
443
|
return shebangCommand(buffer.toString());
|
|
@@ -1917,28 +1917,28 @@ var require_end_of_stream = __commonJS({
|
|
|
1917
1917
|
}
|
|
1918
1918
|
});
|
|
1919
1919
|
|
|
1920
|
-
// ../../node_modules/.pnpm/pump@3.0.
|
|
1920
|
+
// ../../node_modules/.pnpm/pump@3.0.4/node_modules/pump/index.js
|
|
1921
1921
|
var require_pump = __commonJS({
|
|
1922
|
-
"../../node_modules/.pnpm/pump@3.0.
|
|
1922
|
+
"../../node_modules/.pnpm/pump@3.0.4/node_modules/pump/index.js"(exports, module2) {
|
|
1923
1923
|
var once2 = require_once();
|
|
1924
1924
|
var eos = require_end_of_stream();
|
|
1925
|
-
var
|
|
1925
|
+
var fs3;
|
|
1926
1926
|
try {
|
|
1927
|
-
|
|
1927
|
+
fs3 = require("fs");
|
|
1928
1928
|
} catch (e) {
|
|
1929
1929
|
}
|
|
1930
1930
|
var noop = function() {
|
|
1931
1931
|
};
|
|
1932
|
-
var ancient = /^v?\.0/.test(process.version);
|
|
1932
|
+
var ancient = typeof process === "undefined" ? false : /^v?\.0/.test(process.version);
|
|
1933
1933
|
var isFn = function(fn2) {
|
|
1934
1934
|
return typeof fn2 === "function";
|
|
1935
1935
|
};
|
|
1936
1936
|
var isFS = function(stream) {
|
|
1937
1937
|
if (!ancient)
|
|
1938
1938
|
return false;
|
|
1939
|
-
if (!
|
|
1939
|
+
if (!fs3)
|
|
1940
1940
|
return false;
|
|
1941
|
-
return (stream instanceof (
|
|
1941
|
+
return (stream instanceof (fs3.ReadStream || noop) || stream instanceof (fs3.WriteStream || noop)) && isFn(stream.close);
|
|
1942
1942
|
};
|
|
1943
1943
|
var isRequest = function(stream) {
|
|
1944
1944
|
return stream.setHeader && isFn(stream.abort);
|
|
@@ -3053,56 +3053,56 @@ var require_polyfills = __commonJS({
|
|
|
3053
3053
|
}
|
|
3054
3054
|
var chdir;
|
|
3055
3055
|
module2.exports = patch;
|
|
3056
|
-
function patch(
|
|
3056
|
+
function patch(fs3) {
|
|
3057
3057
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
3058
|
-
patchLchmod(
|
|
3059
|
-
}
|
|
3060
|
-
if (!
|
|
3061
|
-
patchLutimes(
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
if (
|
|
3082
|
-
|
|
3058
|
+
patchLchmod(fs3);
|
|
3059
|
+
}
|
|
3060
|
+
if (!fs3.lutimes) {
|
|
3061
|
+
patchLutimes(fs3);
|
|
3062
|
+
}
|
|
3063
|
+
fs3.chown = chownFix(fs3.chown);
|
|
3064
|
+
fs3.fchown = chownFix(fs3.fchown);
|
|
3065
|
+
fs3.lchown = chownFix(fs3.lchown);
|
|
3066
|
+
fs3.chmod = chmodFix(fs3.chmod);
|
|
3067
|
+
fs3.fchmod = chmodFix(fs3.fchmod);
|
|
3068
|
+
fs3.lchmod = chmodFix(fs3.lchmod);
|
|
3069
|
+
fs3.chownSync = chownFixSync(fs3.chownSync);
|
|
3070
|
+
fs3.fchownSync = chownFixSync(fs3.fchownSync);
|
|
3071
|
+
fs3.lchownSync = chownFixSync(fs3.lchownSync);
|
|
3072
|
+
fs3.chmodSync = chmodFixSync(fs3.chmodSync);
|
|
3073
|
+
fs3.fchmodSync = chmodFixSync(fs3.fchmodSync);
|
|
3074
|
+
fs3.lchmodSync = chmodFixSync(fs3.lchmodSync);
|
|
3075
|
+
fs3.stat = statFix(fs3.stat);
|
|
3076
|
+
fs3.fstat = statFix(fs3.fstat);
|
|
3077
|
+
fs3.lstat = statFix(fs3.lstat);
|
|
3078
|
+
fs3.statSync = statFixSync(fs3.statSync);
|
|
3079
|
+
fs3.fstatSync = statFixSync(fs3.fstatSync);
|
|
3080
|
+
fs3.lstatSync = statFixSync(fs3.lstatSync);
|
|
3081
|
+
if (fs3.chmod && !fs3.lchmod) {
|
|
3082
|
+
fs3.lchmod = function(path, mode, cb) {
|
|
3083
3083
|
if (cb)
|
|
3084
3084
|
process.nextTick(cb);
|
|
3085
3085
|
};
|
|
3086
|
-
|
|
3086
|
+
fs3.lchmodSync = function() {
|
|
3087
3087
|
};
|
|
3088
3088
|
}
|
|
3089
|
-
if (
|
|
3090
|
-
|
|
3089
|
+
if (fs3.chown && !fs3.lchown) {
|
|
3090
|
+
fs3.lchown = function(path, uid, gid, cb) {
|
|
3091
3091
|
if (cb)
|
|
3092
3092
|
process.nextTick(cb);
|
|
3093
3093
|
};
|
|
3094
|
-
|
|
3094
|
+
fs3.lchownSync = function() {
|
|
3095
3095
|
};
|
|
3096
3096
|
}
|
|
3097
3097
|
if (platform === "win32") {
|
|
3098
|
-
|
|
3098
|
+
fs3.rename = typeof fs3.rename !== "function" ? fs3.rename : function(fs$rename) {
|
|
3099
3099
|
function rename(from, to2, cb) {
|
|
3100
3100
|
var start = Date.now();
|
|
3101
3101
|
var backoff = 0;
|
|
3102
3102
|
fs$rename(from, to2, function CB(er2) {
|
|
3103
3103
|
if (er2 && (er2.code === "EACCES" || er2.code === "EPERM" || er2.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
3104
3104
|
setTimeout(function() {
|
|
3105
|
-
|
|
3105
|
+
fs3.stat(to2, function(stater, st2) {
|
|
3106
3106
|
if (stater && stater.code === "ENOENT")
|
|
3107
3107
|
fs$rename(from, to2, CB);
|
|
3108
3108
|
else
|
|
@@ -3120,9 +3120,9 @@ var require_polyfills = __commonJS({
|
|
|
3120
3120
|
if (Object.setPrototypeOf)
|
|
3121
3121
|
Object.setPrototypeOf(rename, fs$rename);
|
|
3122
3122
|
return rename;
|
|
3123
|
-
}(
|
|
3123
|
+
}(fs3.rename);
|
|
3124
3124
|
}
|
|
3125
|
-
|
|
3125
|
+
fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) {
|
|
3126
3126
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
3127
3127
|
var callback;
|
|
3128
3128
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -3130,23 +3130,23 @@ var require_polyfills = __commonJS({
|
|
|
3130
3130
|
callback = function(er2, _2, __) {
|
|
3131
3131
|
if (er2 && er2.code === "EAGAIN" && eagCounter < 10) {
|
|
3132
3132
|
eagCounter++;
|
|
3133
|
-
return fs$read.call(
|
|
3133
|
+
return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
|
|
3134
3134
|
}
|
|
3135
3135
|
callback_.apply(this, arguments);
|
|
3136
3136
|
};
|
|
3137
3137
|
}
|
|
3138
|
-
return fs$read.call(
|
|
3138
|
+
return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
|
|
3139
3139
|
}
|
|
3140
3140
|
if (Object.setPrototypeOf)
|
|
3141
3141
|
Object.setPrototypeOf(read, fs$read);
|
|
3142
3142
|
return read;
|
|
3143
|
-
}(
|
|
3144
|
-
|
|
3143
|
+
}(fs3.read);
|
|
3144
|
+
fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : function(fs$readSync) {
|
|
3145
3145
|
return function(fd, buffer, offset, length, position) {
|
|
3146
3146
|
var eagCounter = 0;
|
|
3147
3147
|
while (true) {
|
|
3148
3148
|
try {
|
|
3149
|
-
return fs$readSync.call(
|
|
3149
|
+
return fs$readSync.call(fs3, fd, buffer, offset, length, position);
|
|
3150
3150
|
} catch (er2) {
|
|
3151
3151
|
if (er2.code === "EAGAIN" && eagCounter < 10) {
|
|
3152
3152
|
eagCounter++;
|
|
@@ -3156,10 +3156,10 @@ var require_polyfills = __commonJS({
|
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
3158
|
};
|
|
3159
|
-
}(
|
|
3160
|
-
function patchLchmod(
|
|
3161
|
-
|
|
3162
|
-
|
|
3159
|
+
}(fs3.readSync);
|
|
3160
|
+
function patchLchmod(fs4) {
|
|
3161
|
+
fs4.lchmod = function(path, mode, callback) {
|
|
3162
|
+
fs4.open(
|
|
3163
3163
|
path,
|
|
3164
3164
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
3165
3165
|
mode,
|
|
@@ -3169,8 +3169,8 @@ var require_polyfills = __commonJS({
|
|
|
3169
3169
|
callback(err);
|
|
3170
3170
|
return;
|
|
3171
3171
|
}
|
|
3172
|
-
|
|
3173
|
-
|
|
3172
|
+
fs4.fchmod(fd, mode, function(err2) {
|
|
3173
|
+
fs4.close(fd, function(err22) {
|
|
3174
3174
|
if (callback)
|
|
3175
3175
|
callback(err2 || err22);
|
|
3176
3176
|
});
|
|
@@ -3178,68 +3178,68 @@ var require_polyfills = __commonJS({
|
|
|
3178
3178
|
}
|
|
3179
3179
|
);
|
|
3180
3180
|
};
|
|
3181
|
-
|
|
3182
|
-
var fd =
|
|
3181
|
+
fs4.lchmodSync = function(path, mode) {
|
|
3182
|
+
var fd = fs4.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
3183
3183
|
var threw = true;
|
|
3184
3184
|
var ret;
|
|
3185
3185
|
try {
|
|
3186
|
-
ret =
|
|
3186
|
+
ret = fs4.fchmodSync(fd, mode);
|
|
3187
3187
|
threw = false;
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
if (threw) {
|
|
3190
3190
|
try {
|
|
3191
|
-
|
|
3191
|
+
fs4.closeSync(fd);
|
|
3192
3192
|
} catch (er2) {
|
|
3193
3193
|
}
|
|
3194
3194
|
} else {
|
|
3195
|
-
|
|
3195
|
+
fs4.closeSync(fd);
|
|
3196
3196
|
}
|
|
3197
3197
|
}
|
|
3198
3198
|
return ret;
|
|
3199
3199
|
};
|
|
3200
3200
|
}
|
|
3201
|
-
function patchLutimes(
|
|
3202
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
3203
|
-
|
|
3204
|
-
|
|
3201
|
+
function patchLutimes(fs4) {
|
|
3202
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
|
|
3203
|
+
fs4.lutimes = function(path, at2, mt2, cb) {
|
|
3204
|
+
fs4.open(path, constants.O_SYMLINK, function(er2, fd) {
|
|
3205
3205
|
if (er2) {
|
|
3206
3206
|
if (cb)
|
|
3207
3207
|
cb(er2);
|
|
3208
3208
|
return;
|
|
3209
3209
|
}
|
|
3210
|
-
|
|
3211
|
-
|
|
3210
|
+
fs4.futimes(fd, at2, mt2, function(er3) {
|
|
3211
|
+
fs4.close(fd, function(er22) {
|
|
3212
3212
|
if (cb)
|
|
3213
3213
|
cb(er3 || er22);
|
|
3214
3214
|
});
|
|
3215
3215
|
});
|
|
3216
3216
|
});
|
|
3217
3217
|
};
|
|
3218
|
-
|
|
3219
|
-
var fd =
|
|
3218
|
+
fs4.lutimesSync = function(path, at2, mt2) {
|
|
3219
|
+
var fd = fs4.openSync(path, constants.O_SYMLINK);
|
|
3220
3220
|
var ret;
|
|
3221
3221
|
var threw = true;
|
|
3222
3222
|
try {
|
|
3223
|
-
ret =
|
|
3223
|
+
ret = fs4.futimesSync(fd, at2, mt2);
|
|
3224
3224
|
threw = false;
|
|
3225
3225
|
} finally {
|
|
3226
3226
|
if (threw) {
|
|
3227
3227
|
try {
|
|
3228
|
-
|
|
3228
|
+
fs4.closeSync(fd);
|
|
3229
3229
|
} catch (er2) {
|
|
3230
3230
|
}
|
|
3231
3231
|
} else {
|
|
3232
|
-
|
|
3232
|
+
fs4.closeSync(fd);
|
|
3233
3233
|
}
|
|
3234
3234
|
}
|
|
3235
3235
|
return ret;
|
|
3236
3236
|
};
|
|
3237
|
-
} else if (
|
|
3238
|
-
|
|
3237
|
+
} else if (fs4.futimes) {
|
|
3238
|
+
fs4.lutimes = function(_a14, _b7, _c7, cb) {
|
|
3239
3239
|
if (cb)
|
|
3240
3240
|
process.nextTick(cb);
|
|
3241
3241
|
};
|
|
3242
|
-
|
|
3242
|
+
fs4.lutimesSync = function() {
|
|
3243
3243
|
};
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
@@ -3247,7 +3247,7 @@ var require_polyfills = __commonJS({
|
|
|
3247
3247
|
if (!orig)
|
|
3248
3248
|
return orig;
|
|
3249
3249
|
return function(target, mode, cb) {
|
|
3250
|
-
return orig.call(
|
|
3250
|
+
return orig.call(fs3, target, mode, function(er2) {
|
|
3251
3251
|
if (chownErOk(er2))
|
|
3252
3252
|
er2 = null;
|
|
3253
3253
|
if (cb)
|
|
@@ -3260,7 +3260,7 @@ var require_polyfills = __commonJS({
|
|
|
3260
3260
|
return orig;
|
|
3261
3261
|
return function(target, mode) {
|
|
3262
3262
|
try {
|
|
3263
|
-
return orig.call(
|
|
3263
|
+
return orig.call(fs3, target, mode);
|
|
3264
3264
|
} catch (er2) {
|
|
3265
3265
|
if (!chownErOk(er2))
|
|
3266
3266
|
throw er2;
|
|
@@ -3271,7 +3271,7 @@ var require_polyfills = __commonJS({
|
|
|
3271
3271
|
if (!orig)
|
|
3272
3272
|
return orig;
|
|
3273
3273
|
return function(target, uid, gid, cb) {
|
|
3274
|
-
return orig.call(
|
|
3274
|
+
return orig.call(fs3, target, uid, gid, function(er2) {
|
|
3275
3275
|
if (chownErOk(er2))
|
|
3276
3276
|
er2 = null;
|
|
3277
3277
|
if (cb)
|
|
@@ -3284,7 +3284,7 @@ var require_polyfills = __commonJS({
|
|
|
3284
3284
|
return orig;
|
|
3285
3285
|
return function(target, uid, gid) {
|
|
3286
3286
|
try {
|
|
3287
|
-
return orig.call(
|
|
3287
|
+
return orig.call(fs3, target, uid, gid);
|
|
3288
3288
|
} catch (er2) {
|
|
3289
3289
|
if (!chownErOk(er2))
|
|
3290
3290
|
throw er2;
|
|
@@ -3309,14 +3309,14 @@ var require_polyfills = __commonJS({
|
|
|
3309
3309
|
if (cb)
|
|
3310
3310
|
cb.apply(this, arguments);
|
|
3311
3311
|
}
|
|
3312
|
-
return options ? orig.call(
|
|
3312
|
+
return options ? orig.call(fs3, target, options, callback) : orig.call(fs3, target, callback);
|
|
3313
3313
|
};
|
|
3314
3314
|
}
|
|
3315
3315
|
function statFixSync(orig) {
|
|
3316
3316
|
if (!orig)
|
|
3317
3317
|
return orig;
|
|
3318
3318
|
return function(target, options) {
|
|
3319
|
-
var stats = options ? orig.call(
|
|
3319
|
+
var stats = options ? orig.call(fs3, target, options) : orig.call(fs3, target);
|
|
3320
3320
|
if (stats) {
|
|
3321
3321
|
if (stats.uid < 0)
|
|
3322
3322
|
stats.uid += 4294967296;
|
|
@@ -3347,7 +3347,7 @@ var require_legacy_streams = __commonJS({
|
|
|
3347
3347
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
|
|
3348
3348
|
var Stream = require("stream").Stream;
|
|
3349
3349
|
module2.exports = legacy;
|
|
3350
|
-
function legacy(
|
|
3350
|
+
function legacy(fs3) {
|
|
3351
3351
|
return {
|
|
3352
3352
|
ReadStream,
|
|
3353
3353
|
WriteStream
|
|
@@ -3392,7 +3392,7 @@ var require_legacy_streams = __commonJS({
|
|
|
3392
3392
|
});
|
|
3393
3393
|
return;
|
|
3394
3394
|
}
|
|
3395
|
-
|
|
3395
|
+
fs3.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
3396
3396
|
if (err) {
|
|
3397
3397
|
self.emit("error", err);
|
|
3398
3398
|
self.readable = false;
|
|
@@ -3432,7 +3432,7 @@ var require_legacy_streams = __commonJS({
|
|
|
3432
3432
|
this.busy = false;
|
|
3433
3433
|
this._queue = [];
|
|
3434
3434
|
if (this.fd === null) {
|
|
3435
|
-
this._open =
|
|
3435
|
+
this._open = fs3.open;
|
|
3436
3436
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
3437
3437
|
this.flush();
|
|
3438
3438
|
}
|
|
@@ -3467,7 +3467,7 @@ var require_clone = __commonJS({
|
|
|
3467
3467
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
3468
3468
|
var require_graceful_fs = __commonJS({
|
|
3469
3469
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
|
|
3470
|
-
var
|
|
3470
|
+
var fs3 = require("fs");
|
|
3471
3471
|
var polyfills = require_polyfills();
|
|
3472
3472
|
var legacy = require_legacy_streams();
|
|
3473
3473
|
var clone = require_clone();
|
|
@@ -3499,12 +3499,12 @@ var require_graceful_fs = __commonJS({
|
|
|
3499
3499
|
m2 = "GFS4: " + m2.split(/\n/).join("\nGFS4: ");
|
|
3500
3500
|
console.error(m2);
|
|
3501
3501
|
};
|
|
3502
|
-
if (!
|
|
3502
|
+
if (!fs3[gracefulQueue]) {
|
|
3503
3503
|
queue = global[gracefulQueue] || [];
|
|
3504
|
-
publishQueue(
|
|
3505
|
-
|
|
3504
|
+
publishQueue(fs3, queue);
|
|
3505
|
+
fs3.close = function(fs$close) {
|
|
3506
3506
|
function close(fd, cb) {
|
|
3507
|
-
return fs$close.call(
|
|
3507
|
+
return fs$close.call(fs3, fd, function(err) {
|
|
3508
3508
|
if (!err) {
|
|
3509
3509
|
resetQueue();
|
|
3510
3510
|
}
|
|
@@ -3516,41 +3516,41 @@ var require_graceful_fs = __commonJS({
|
|
|
3516
3516
|
value: fs$close
|
|
3517
3517
|
});
|
|
3518
3518
|
return close;
|
|
3519
|
-
}(
|
|
3520
|
-
|
|
3519
|
+
}(fs3.close);
|
|
3520
|
+
fs3.closeSync = function(fs$closeSync) {
|
|
3521
3521
|
function closeSync(fd) {
|
|
3522
|
-
fs$closeSync.apply(
|
|
3522
|
+
fs$closeSync.apply(fs3, arguments);
|
|
3523
3523
|
resetQueue();
|
|
3524
3524
|
}
|
|
3525
3525
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
3526
3526
|
value: fs$closeSync
|
|
3527
3527
|
});
|
|
3528
3528
|
return closeSync;
|
|
3529
|
-
}(
|
|
3529
|
+
}(fs3.closeSync);
|
|
3530
3530
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
3531
3531
|
process.on("exit", function() {
|
|
3532
|
-
debug5(
|
|
3533
|
-
require("assert").equal(
|
|
3532
|
+
debug5(fs3[gracefulQueue]);
|
|
3533
|
+
require("assert").equal(fs3[gracefulQueue].length, 0);
|
|
3534
3534
|
});
|
|
3535
3535
|
}
|
|
3536
3536
|
}
|
|
3537
3537
|
var queue;
|
|
3538
3538
|
if (!global[gracefulQueue]) {
|
|
3539
|
-
publishQueue(global,
|
|
3540
|
-
}
|
|
3541
|
-
module2.exports = patch(clone(
|
|
3542
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
3543
|
-
module2.exports = patch(
|
|
3544
|
-
|
|
3545
|
-
}
|
|
3546
|
-
function patch(
|
|
3547
|
-
polyfills(
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
var fs$readFile =
|
|
3552
|
-
|
|
3553
|
-
function
|
|
3539
|
+
publishQueue(global, fs3[gracefulQueue]);
|
|
3540
|
+
}
|
|
3541
|
+
module2.exports = patch(clone(fs3));
|
|
3542
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs3.__patched) {
|
|
3543
|
+
module2.exports = patch(fs3);
|
|
3544
|
+
fs3.__patched = true;
|
|
3545
|
+
}
|
|
3546
|
+
function patch(fs4) {
|
|
3547
|
+
polyfills(fs4);
|
|
3548
|
+
fs4.gracefulify = patch;
|
|
3549
|
+
fs4.createReadStream = createReadStream;
|
|
3550
|
+
fs4.createWriteStream = createWriteStream2;
|
|
3551
|
+
var fs$readFile = fs4.readFile;
|
|
3552
|
+
fs4.readFile = readFile3;
|
|
3553
|
+
function readFile3(path, options, cb) {
|
|
3554
3554
|
if (typeof options === "function")
|
|
3555
3555
|
cb = options, options = null;
|
|
3556
3556
|
return go$readFile(path, options, cb);
|
|
@@ -3565,8 +3565,8 @@ var require_graceful_fs = __commonJS({
|
|
|
3565
3565
|
});
|
|
3566
3566
|
}
|
|
3567
3567
|
}
|
|
3568
|
-
var fs$writeFile =
|
|
3569
|
-
|
|
3568
|
+
var fs$writeFile = fs4.writeFile;
|
|
3569
|
+
fs4.writeFile = writeFile2;
|
|
3570
3570
|
function writeFile2(path, data, options, cb) {
|
|
3571
3571
|
if (typeof options === "function")
|
|
3572
3572
|
cb = options, options = null;
|
|
@@ -3582,9 +3582,9 @@ var require_graceful_fs = __commonJS({
|
|
|
3582
3582
|
});
|
|
3583
3583
|
}
|
|
3584
3584
|
}
|
|
3585
|
-
var fs$appendFile =
|
|
3585
|
+
var fs$appendFile = fs4.appendFile;
|
|
3586
3586
|
if (fs$appendFile)
|
|
3587
|
-
|
|
3587
|
+
fs4.appendFile = appendFile;
|
|
3588
3588
|
function appendFile(path, data, options, cb) {
|
|
3589
3589
|
if (typeof options === "function")
|
|
3590
3590
|
cb = options, options = null;
|
|
@@ -3600,9 +3600,9 @@ var require_graceful_fs = __commonJS({
|
|
|
3600
3600
|
});
|
|
3601
3601
|
}
|
|
3602
3602
|
}
|
|
3603
|
-
var fs$copyFile =
|
|
3603
|
+
var fs$copyFile = fs4.copyFile;
|
|
3604
3604
|
if (fs$copyFile)
|
|
3605
|
-
|
|
3605
|
+
fs4.copyFile = copyFile;
|
|
3606
3606
|
function copyFile(src, dest, flags, cb) {
|
|
3607
3607
|
if (typeof flags === "function") {
|
|
3608
3608
|
cb = flags;
|
|
@@ -3620,8 +3620,8 @@ var require_graceful_fs = __commonJS({
|
|
|
3620
3620
|
});
|
|
3621
3621
|
}
|
|
3622
3622
|
}
|
|
3623
|
-
var fs$readdir =
|
|
3624
|
-
|
|
3623
|
+
var fs$readdir = fs4.readdir;
|
|
3624
|
+
fs4.readdir = readdir2;
|
|
3625
3625
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
3626
3626
|
function readdir2(path, options, cb) {
|
|
3627
3627
|
if (typeof options === "function")
|
|
@@ -3662,21 +3662,21 @@ var require_graceful_fs = __commonJS({
|
|
|
3662
3662
|
}
|
|
3663
3663
|
}
|
|
3664
3664
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
3665
|
-
var legStreams = legacy(
|
|
3665
|
+
var legStreams = legacy(fs4);
|
|
3666
3666
|
ReadStream = legStreams.ReadStream;
|
|
3667
3667
|
WriteStream = legStreams.WriteStream;
|
|
3668
3668
|
}
|
|
3669
|
-
var fs$ReadStream =
|
|
3669
|
+
var fs$ReadStream = fs4.ReadStream;
|
|
3670
3670
|
if (fs$ReadStream) {
|
|
3671
3671
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
3672
3672
|
ReadStream.prototype.open = ReadStream$open;
|
|
3673
3673
|
}
|
|
3674
|
-
var fs$WriteStream =
|
|
3674
|
+
var fs$WriteStream = fs4.WriteStream;
|
|
3675
3675
|
if (fs$WriteStream) {
|
|
3676
3676
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
3677
3677
|
WriteStream.prototype.open = WriteStream$open;
|
|
3678
3678
|
}
|
|
3679
|
-
Object.defineProperty(
|
|
3679
|
+
Object.defineProperty(fs4, "ReadStream", {
|
|
3680
3680
|
get: function() {
|
|
3681
3681
|
return ReadStream;
|
|
3682
3682
|
},
|
|
@@ -3686,7 +3686,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3686
3686
|
enumerable: true,
|
|
3687
3687
|
configurable: true
|
|
3688
3688
|
});
|
|
3689
|
-
Object.defineProperty(
|
|
3689
|
+
Object.defineProperty(fs4, "WriteStream", {
|
|
3690
3690
|
get: function() {
|
|
3691
3691
|
return WriteStream;
|
|
3692
3692
|
},
|
|
@@ -3697,7 +3697,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3697
3697
|
configurable: true
|
|
3698
3698
|
});
|
|
3699
3699
|
var FileReadStream = ReadStream;
|
|
3700
|
-
Object.defineProperty(
|
|
3700
|
+
Object.defineProperty(fs4, "FileReadStream", {
|
|
3701
3701
|
get: function() {
|
|
3702
3702
|
return FileReadStream;
|
|
3703
3703
|
},
|
|
@@ -3708,7 +3708,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3708
3708
|
configurable: true
|
|
3709
3709
|
});
|
|
3710
3710
|
var FileWriteStream = WriteStream;
|
|
3711
|
-
Object.defineProperty(
|
|
3711
|
+
Object.defineProperty(fs4, "FileWriteStream", {
|
|
3712
3712
|
get: function() {
|
|
3713
3713
|
return FileWriteStream;
|
|
3714
3714
|
},
|
|
@@ -3757,13 +3757,13 @@ var require_graceful_fs = __commonJS({
|
|
|
3757
3757
|
});
|
|
3758
3758
|
}
|
|
3759
3759
|
function createReadStream(path, options) {
|
|
3760
|
-
return new
|
|
3760
|
+
return new fs4.ReadStream(path, options);
|
|
3761
3761
|
}
|
|
3762
3762
|
function createWriteStream2(path, options) {
|
|
3763
|
-
return new
|
|
3763
|
+
return new fs4.WriteStream(path, options);
|
|
3764
3764
|
}
|
|
3765
|
-
var fs$open =
|
|
3766
|
-
|
|
3765
|
+
var fs$open = fs4.open;
|
|
3766
|
+
fs4.open = open;
|
|
3767
3767
|
function open(path, flags, mode, cb) {
|
|
3768
3768
|
if (typeof mode === "function")
|
|
3769
3769
|
cb = mode, mode = null;
|
|
@@ -3779,20 +3779,20 @@ var require_graceful_fs = __commonJS({
|
|
|
3779
3779
|
});
|
|
3780
3780
|
}
|
|
3781
3781
|
}
|
|
3782
|
-
return
|
|
3782
|
+
return fs4;
|
|
3783
3783
|
}
|
|
3784
3784
|
function enqueue(elem) {
|
|
3785
3785
|
debug5("ENQUEUE", elem[0].name, elem[1]);
|
|
3786
|
-
|
|
3786
|
+
fs3[gracefulQueue].push(elem);
|
|
3787
3787
|
retry2();
|
|
3788
3788
|
}
|
|
3789
3789
|
var retryTimer;
|
|
3790
3790
|
function resetQueue() {
|
|
3791
3791
|
var now = Date.now();
|
|
3792
|
-
for (var i = 0; i <
|
|
3793
|
-
if (
|
|
3794
|
-
|
|
3795
|
-
|
|
3792
|
+
for (var i = 0; i < fs3[gracefulQueue].length; ++i) {
|
|
3793
|
+
if (fs3[gracefulQueue][i].length > 2) {
|
|
3794
|
+
fs3[gracefulQueue][i][3] = now;
|
|
3795
|
+
fs3[gracefulQueue][i][4] = now;
|
|
3796
3796
|
}
|
|
3797
3797
|
}
|
|
3798
3798
|
retry2();
|
|
@@ -3800,9 +3800,9 @@ var require_graceful_fs = __commonJS({
|
|
|
3800
3800
|
function retry2() {
|
|
3801
3801
|
clearTimeout(retryTimer);
|
|
3802
3802
|
retryTimer = void 0;
|
|
3803
|
-
if (
|
|
3803
|
+
if (fs3[gracefulQueue].length === 0)
|
|
3804
3804
|
return;
|
|
3805
|
-
var elem =
|
|
3805
|
+
var elem = fs3[gracefulQueue].shift();
|
|
3806
3806
|
var fn2 = elem[0];
|
|
3807
3807
|
var args = elem[1];
|
|
3808
3808
|
var err = elem[2];
|
|
@@ -3824,7 +3824,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3824
3824
|
debug5("RETRY", fn2.name, args);
|
|
3825
3825
|
fn2.apply(null, args.concat([startTime]));
|
|
3826
3826
|
} else {
|
|
3827
|
-
|
|
3827
|
+
fs3[gracefulQueue].push(elem);
|
|
3828
3828
|
}
|
|
3829
3829
|
}
|
|
3830
3830
|
if (retryTimer === void 0) {
|
|
@@ -3839,7 +3839,7 @@ var require_fs = __commonJS({
|
|
|
3839
3839
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/fs/index.js"(exports) {
|
|
3840
3840
|
"use strict";
|
|
3841
3841
|
var u2 = require_universalify().fromCallback;
|
|
3842
|
-
var
|
|
3842
|
+
var fs3 = require_graceful_fs();
|
|
3843
3843
|
var api = [
|
|
3844
3844
|
"access",
|
|
3845
3845
|
"appendFile",
|
|
@@ -3874,31 +3874,31 @@ var require_fs = __commonJS({
|
|
|
3874
3874
|
"utimes",
|
|
3875
3875
|
"writeFile"
|
|
3876
3876
|
].filter((key) => {
|
|
3877
|
-
return typeof
|
|
3877
|
+
return typeof fs3[key] === "function";
|
|
3878
3878
|
});
|
|
3879
|
-
Object.keys(
|
|
3879
|
+
Object.keys(fs3).forEach((key) => {
|
|
3880
3880
|
if (key === "promises") {
|
|
3881
3881
|
return;
|
|
3882
3882
|
}
|
|
3883
|
-
exports[key] =
|
|
3883
|
+
exports[key] = fs3[key];
|
|
3884
3884
|
});
|
|
3885
3885
|
api.forEach((method) => {
|
|
3886
|
-
exports[method] = u2(
|
|
3886
|
+
exports[method] = u2(fs3[method]);
|
|
3887
3887
|
});
|
|
3888
3888
|
exports.exists = function(filename, callback) {
|
|
3889
3889
|
if (typeof callback === "function") {
|
|
3890
|
-
return
|
|
3890
|
+
return fs3.exists(filename, callback);
|
|
3891
3891
|
}
|
|
3892
3892
|
return new Promise((resolve) => {
|
|
3893
|
-
return
|
|
3893
|
+
return fs3.exists(filename, resolve);
|
|
3894
3894
|
});
|
|
3895
3895
|
};
|
|
3896
3896
|
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
3897
3897
|
if (typeof callback === "function") {
|
|
3898
|
-
return
|
|
3898
|
+
return fs3.read(fd, buffer, offset, length, position, callback);
|
|
3899
3899
|
}
|
|
3900
3900
|
return new Promise((resolve, reject) => {
|
|
3901
|
-
|
|
3901
|
+
fs3.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
3902
3902
|
if (err)
|
|
3903
3903
|
return reject(err);
|
|
3904
3904
|
resolve({ bytesRead, buffer: buffer2 });
|
|
@@ -3907,10 +3907,10 @@ var require_fs = __commonJS({
|
|
|
3907
3907
|
};
|
|
3908
3908
|
exports.write = function(fd, buffer, ...args) {
|
|
3909
3909
|
if (typeof args[args.length - 1] === "function") {
|
|
3910
|
-
return
|
|
3910
|
+
return fs3.write(fd, buffer, ...args);
|
|
3911
3911
|
}
|
|
3912
3912
|
return new Promise((resolve, reject) => {
|
|
3913
|
-
|
|
3913
|
+
fs3.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
3914
3914
|
if (err)
|
|
3915
3915
|
return reject(err);
|
|
3916
3916
|
resolve({ bytesWritten, buffer: buffer2 });
|
|
@@ -3948,7 +3948,7 @@ var require_win32 = __commonJS({
|
|
|
3948
3948
|
var require_mkdirs = __commonJS({
|
|
3949
3949
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports, module2) {
|
|
3950
3950
|
"use strict";
|
|
3951
|
-
var
|
|
3951
|
+
var fs3 = require_graceful_fs();
|
|
3952
3952
|
var path = require("path");
|
|
3953
3953
|
var invalidWin32Path = require_win32().invalidWin32Path;
|
|
3954
3954
|
var o777 = parseInt("0777", 8);
|
|
@@ -3965,7 +3965,7 @@ var require_mkdirs = __commonJS({
|
|
|
3965
3965
|
return callback(errInval);
|
|
3966
3966
|
}
|
|
3967
3967
|
let mode = opts.mode;
|
|
3968
|
-
const xfs = opts.fs ||
|
|
3968
|
+
const xfs = opts.fs || fs3;
|
|
3969
3969
|
if (mode === void 0) {
|
|
3970
3970
|
mode = o777 & ~process.umask();
|
|
3971
3971
|
}
|
|
@@ -4009,7 +4009,7 @@ var require_mkdirs = __commonJS({
|
|
|
4009
4009
|
var require_mkdirs_sync = __commonJS({
|
|
4010
4010
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports, module2) {
|
|
4011
4011
|
"use strict";
|
|
4012
|
-
var
|
|
4012
|
+
var fs3 = require_graceful_fs();
|
|
4013
4013
|
var path = require("path");
|
|
4014
4014
|
var invalidWin32Path = require_win32().invalidWin32Path;
|
|
4015
4015
|
var o777 = parseInt("0777", 8);
|
|
@@ -4018,7 +4018,7 @@ var require_mkdirs_sync = __commonJS({
|
|
|
4018
4018
|
opts = { mode: opts };
|
|
4019
4019
|
}
|
|
4020
4020
|
let mode = opts.mode;
|
|
4021
|
-
const xfs = opts.fs ||
|
|
4021
|
+
const xfs = opts.fs || fs3;
|
|
4022
4022
|
if (process.platform === "win32" && invalidWin32Path(p2)) {
|
|
4023
4023
|
const errInval = new Error(p2 + " contains invalid WIN32 path characters.");
|
|
4024
4024
|
errInval.code = "EINVAL";
|
|
@@ -4079,36 +4079,36 @@ var require_mkdirs2 = __commonJS({
|
|
|
4079
4079
|
var require_utimes = __commonJS({
|
|
4080
4080
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
|
|
4081
4081
|
"use strict";
|
|
4082
|
-
var
|
|
4082
|
+
var fs3 = require_graceful_fs();
|
|
4083
4083
|
var os2 = require("os");
|
|
4084
4084
|
var path = require("path");
|
|
4085
4085
|
function hasMillisResSync() {
|
|
4086
4086
|
let tmpfile = path.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2));
|
|
4087
4087
|
tmpfile = path.join(os2.tmpdir(), tmpfile);
|
|
4088
4088
|
const d = /* @__PURE__ */ new Date(1435410243862);
|
|
4089
|
-
|
|
4090
|
-
const fd =
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
return
|
|
4089
|
+
fs3.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
|
|
4090
|
+
const fd = fs3.openSync(tmpfile, "r+");
|
|
4091
|
+
fs3.futimesSync(fd, d, d);
|
|
4092
|
+
fs3.closeSync(fd);
|
|
4093
|
+
return fs3.statSync(tmpfile).mtime > 1435410243e3;
|
|
4094
4094
|
}
|
|
4095
4095
|
function hasMillisRes(callback) {
|
|
4096
4096
|
let tmpfile = path.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
|
|
4097
4097
|
tmpfile = path.join(os2.tmpdir(), tmpfile);
|
|
4098
4098
|
const d = /* @__PURE__ */ new Date(1435410243862);
|
|
4099
|
-
|
|
4099
|
+
fs3.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
|
|
4100
4100
|
if (err)
|
|
4101
4101
|
return callback(err);
|
|
4102
|
-
|
|
4102
|
+
fs3.open(tmpfile, "r+", (err2, fd) => {
|
|
4103
4103
|
if (err2)
|
|
4104
4104
|
return callback(err2);
|
|
4105
|
-
|
|
4105
|
+
fs3.futimes(fd, d, d, (err3) => {
|
|
4106
4106
|
if (err3)
|
|
4107
4107
|
return callback(err3);
|
|
4108
|
-
|
|
4108
|
+
fs3.close(fd, (err4) => {
|
|
4109
4109
|
if (err4)
|
|
4110
4110
|
return callback(err4);
|
|
4111
|
-
|
|
4111
|
+
fs3.stat(tmpfile, (err5, stats) => {
|
|
4112
4112
|
if (err5)
|
|
4113
4113
|
return callback(err5);
|
|
4114
4114
|
callback(null, stats.mtime > 1435410243e3);
|
|
@@ -4128,11 +4128,11 @@ var require_utimes = __commonJS({
|
|
|
4128
4128
|
}
|
|
4129
4129
|
}
|
|
4130
4130
|
function utimesMillis(path2, atime, mtime, callback) {
|
|
4131
|
-
|
|
4131
|
+
fs3.open(path2, "r+", (err, fd) => {
|
|
4132
4132
|
if (err)
|
|
4133
4133
|
return callback(err);
|
|
4134
|
-
|
|
4135
|
-
|
|
4134
|
+
fs3.futimes(fd, atime, mtime, (futimesErr) => {
|
|
4135
|
+
fs3.close(fd, (closeErr) => {
|
|
4136
4136
|
if (callback)
|
|
4137
4137
|
callback(futimesErr || closeErr);
|
|
4138
4138
|
});
|
|
@@ -4140,9 +4140,9 @@ var require_utimes = __commonJS({
|
|
|
4140
4140
|
});
|
|
4141
4141
|
}
|
|
4142
4142
|
function utimesMillisSync(path2, atime, mtime) {
|
|
4143
|
-
const fd =
|
|
4144
|
-
|
|
4145
|
-
return
|
|
4143
|
+
const fd = fs3.openSync(path2, "r+");
|
|
4144
|
+
fs3.futimesSync(fd, atime, mtime);
|
|
4145
|
+
return fs3.closeSync(fd);
|
|
4146
4146
|
}
|
|
4147
4147
|
module2.exports = {
|
|
4148
4148
|
hasMillisRes,
|
|
@@ -4175,7 +4175,7 @@ var require_buffer = __commonJS({
|
|
|
4175
4175
|
var require_copy_sync = __commonJS({
|
|
4176
4176
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports, module2) {
|
|
4177
4177
|
"use strict";
|
|
4178
|
-
var
|
|
4178
|
+
var fs3 = require_graceful_fs();
|
|
4179
4179
|
var path = require("path");
|
|
4180
4180
|
var mkdirpSync = require_mkdirs2().mkdirsSync;
|
|
4181
4181
|
var utimesSync = require_utimes().utimesMillisSync;
|
|
@@ -4196,7 +4196,7 @@ var require_copy_sync = __commonJS({
|
|
|
4196
4196
|
if (opts.filter && !opts.filter(src, dest))
|
|
4197
4197
|
return;
|
|
4198
4198
|
const destParent = path.dirname(dest);
|
|
4199
|
-
if (!
|
|
4199
|
+
if (!fs3.existsSync(destParent))
|
|
4200
4200
|
mkdirpSync(destParent);
|
|
4201
4201
|
return startCopy(destStat, src, dest, opts);
|
|
4202
4202
|
}
|
|
@@ -4206,7 +4206,7 @@ var require_copy_sync = __commonJS({
|
|
|
4206
4206
|
return getStats(destStat, src, dest, opts);
|
|
4207
4207
|
}
|
|
4208
4208
|
function getStats(destStat, src, dest, opts) {
|
|
4209
|
-
const statSync = opts.dereference ?
|
|
4209
|
+
const statSync = opts.dereference ? fs3.statSync : fs3.lstatSync;
|
|
4210
4210
|
const srcStat = statSync(src);
|
|
4211
4211
|
if (srcStat.isDirectory())
|
|
4212
4212
|
return onDir(srcStat, destStat, src, dest, opts);
|
|
@@ -4222,16 +4222,16 @@ var require_copy_sync = __commonJS({
|
|
|
4222
4222
|
}
|
|
4223
4223
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
4224
4224
|
if (opts.overwrite) {
|
|
4225
|
-
|
|
4225
|
+
fs3.unlinkSync(dest);
|
|
4226
4226
|
return copyFile(srcStat, src, dest, opts);
|
|
4227
4227
|
} else if (opts.errorOnExist) {
|
|
4228
4228
|
throw new Error(`'${dest}' already exists`);
|
|
4229
4229
|
}
|
|
4230
4230
|
}
|
|
4231
4231
|
function copyFile(srcStat, src, dest, opts) {
|
|
4232
|
-
if (typeof
|
|
4233
|
-
|
|
4234
|
-
|
|
4232
|
+
if (typeof fs3.copyFileSync === "function") {
|
|
4233
|
+
fs3.copyFileSync(src, dest);
|
|
4234
|
+
fs3.chmodSync(dest, srcStat.mode);
|
|
4235
4235
|
if (opts.preserveTimestamps) {
|
|
4236
4236
|
return utimesSync(dest, srcStat.atime, srcStat.mtime);
|
|
4237
4237
|
}
|
|
@@ -4242,18 +4242,18 @@ var require_copy_sync = __commonJS({
|
|
|
4242
4242
|
function copyFileFallback(srcStat, src, dest, opts) {
|
|
4243
4243
|
const BUF_LENGTH = 64 * 1024;
|
|
4244
4244
|
const _buff = require_buffer()(BUF_LENGTH);
|
|
4245
|
-
const fdr =
|
|
4246
|
-
const fdw =
|
|
4245
|
+
const fdr = fs3.openSync(src, "r");
|
|
4246
|
+
const fdw = fs3.openSync(dest, "w", srcStat.mode);
|
|
4247
4247
|
let pos = 0;
|
|
4248
4248
|
while (pos < srcStat.size) {
|
|
4249
|
-
const bytesRead =
|
|
4250
|
-
|
|
4249
|
+
const bytesRead = fs3.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
4250
|
+
fs3.writeSync(fdw, _buff, 0, bytesRead);
|
|
4251
4251
|
pos += bytesRead;
|
|
4252
4252
|
}
|
|
4253
4253
|
if (opts.preserveTimestamps)
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4254
|
+
fs3.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
4255
|
+
fs3.closeSync(fdr);
|
|
4256
|
+
fs3.closeSync(fdw);
|
|
4257
4257
|
}
|
|
4258
4258
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
4259
4259
|
if (destStat === notExist)
|
|
@@ -4264,12 +4264,12 @@ var require_copy_sync = __commonJS({
|
|
|
4264
4264
|
return copyDir(src, dest, opts);
|
|
4265
4265
|
}
|
|
4266
4266
|
function mkDirAndCopy(srcStat, src, dest, opts) {
|
|
4267
|
-
|
|
4267
|
+
fs3.mkdirSync(dest);
|
|
4268
4268
|
copyDir(src, dest, opts);
|
|
4269
|
-
return
|
|
4269
|
+
return fs3.chmodSync(dest, srcStat.mode);
|
|
4270
4270
|
}
|
|
4271
4271
|
function copyDir(src, dest, opts) {
|
|
4272
|
-
|
|
4272
|
+
fs3.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
|
|
4273
4273
|
}
|
|
4274
4274
|
function copyDirItem(item, src, dest, opts) {
|
|
4275
4275
|
const srcItem = path.join(src, item);
|
|
@@ -4278,19 +4278,19 @@ var require_copy_sync = __commonJS({
|
|
|
4278
4278
|
return startCopy(destStat, srcItem, destItem, opts);
|
|
4279
4279
|
}
|
|
4280
4280
|
function onLink(destStat, src, dest, opts) {
|
|
4281
|
-
let resolvedSrc =
|
|
4281
|
+
let resolvedSrc = fs3.readlinkSync(src);
|
|
4282
4282
|
if (opts.dereference) {
|
|
4283
4283
|
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
4284
4284
|
}
|
|
4285
4285
|
if (destStat === notExist) {
|
|
4286
|
-
return
|
|
4286
|
+
return fs3.symlinkSync(resolvedSrc, dest);
|
|
4287
4287
|
} else {
|
|
4288
4288
|
let resolvedDest;
|
|
4289
4289
|
try {
|
|
4290
|
-
resolvedDest =
|
|
4290
|
+
resolvedDest = fs3.readlinkSync(dest);
|
|
4291
4291
|
} catch (err) {
|
|
4292
4292
|
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
4293
|
-
return
|
|
4293
|
+
return fs3.symlinkSync(resolvedSrc, dest);
|
|
4294
4294
|
throw err;
|
|
4295
4295
|
}
|
|
4296
4296
|
if (opts.dereference) {
|
|
@@ -4299,15 +4299,15 @@ var require_copy_sync = __commonJS({
|
|
|
4299
4299
|
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
4300
4300
|
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
4301
4301
|
}
|
|
4302
|
-
if (
|
|
4302
|
+
if (fs3.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
4303
4303
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
4304
4304
|
}
|
|
4305
4305
|
return copyLink(resolvedSrc, dest);
|
|
4306
4306
|
}
|
|
4307
4307
|
}
|
|
4308
4308
|
function copyLink(resolvedSrc, dest) {
|
|
4309
|
-
|
|
4310
|
-
return
|
|
4309
|
+
fs3.unlinkSync(dest);
|
|
4310
|
+
return fs3.symlinkSync(resolvedSrc, dest);
|
|
4311
4311
|
}
|
|
4312
4312
|
function isSrcSubdir(src, dest) {
|
|
4313
4313
|
const srcArray = path.resolve(src).split(path.sep);
|
|
@@ -4315,10 +4315,10 @@ var require_copy_sync = __commonJS({
|
|
|
4315
4315
|
return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
|
|
4316
4316
|
}
|
|
4317
4317
|
function checkStats(src, dest) {
|
|
4318
|
-
const srcStat =
|
|
4318
|
+
const srcStat = fs3.statSync(src);
|
|
4319
4319
|
let destStat;
|
|
4320
4320
|
try {
|
|
4321
|
-
destStat =
|
|
4321
|
+
destStat = fs3.statSync(dest);
|
|
4322
4322
|
} catch (err) {
|
|
4323
4323
|
if (err.code === "ENOENT")
|
|
4324
4324
|
return { srcStat, destStat: notExist };
|
|
@@ -4355,13 +4355,13 @@ var require_path_exists = __commonJS({
|
|
|
4355
4355
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
|
|
4356
4356
|
"use strict";
|
|
4357
4357
|
var u2 = require_universalify().fromPromise;
|
|
4358
|
-
var
|
|
4358
|
+
var fs3 = require_fs();
|
|
4359
4359
|
function pathExists5(path) {
|
|
4360
|
-
return
|
|
4360
|
+
return fs3.access(path).then(() => true).catch(() => false);
|
|
4361
4361
|
}
|
|
4362
4362
|
module2.exports = {
|
|
4363
4363
|
pathExists: u2(pathExists5),
|
|
4364
|
-
pathExistsSync:
|
|
4364
|
+
pathExistsSync: fs3.existsSync
|
|
4365
4365
|
};
|
|
4366
4366
|
}
|
|
4367
4367
|
});
|
|
@@ -4370,7 +4370,7 @@ var require_path_exists = __commonJS({
|
|
|
4370
4370
|
var require_copy = __commonJS({
|
|
4371
4371
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
|
|
4372
4372
|
"use strict";
|
|
4373
|
-
var
|
|
4373
|
+
var fs3 = require_graceful_fs();
|
|
4374
4374
|
var path = require("path");
|
|
4375
4375
|
var mkdirp3 = require_mkdirs2().mkdirs;
|
|
4376
4376
|
var pathExists5 = require_path_exists().pathExists;
|
|
@@ -4431,7 +4431,7 @@ var require_copy = __commonJS({
|
|
|
4431
4431
|
return getStats(destStat, src, dest, opts, cb);
|
|
4432
4432
|
}
|
|
4433
4433
|
function getStats(destStat, src, dest, opts, cb) {
|
|
4434
|
-
const stat = opts.dereference ?
|
|
4434
|
+
const stat = opts.dereference ? fs3.stat : fs3.lstat;
|
|
4435
4435
|
stat(src, (err, srcStat) => {
|
|
4436
4436
|
if (err)
|
|
4437
4437
|
return cb(err);
|
|
@@ -4450,7 +4450,7 @@ var require_copy = __commonJS({
|
|
|
4450
4450
|
}
|
|
4451
4451
|
function mayCopyFile(srcStat, src, dest, opts, cb) {
|
|
4452
4452
|
if (opts.overwrite) {
|
|
4453
|
-
|
|
4453
|
+
fs3.unlink(dest, (err) => {
|
|
4454
4454
|
if (err)
|
|
4455
4455
|
return cb(err);
|
|
4456
4456
|
return copyFile(srcStat, src, dest, opts, cb);
|
|
@@ -4461,8 +4461,8 @@ var require_copy = __commonJS({
|
|
|
4461
4461
|
return cb();
|
|
4462
4462
|
}
|
|
4463
4463
|
function copyFile(srcStat, src, dest, opts, cb) {
|
|
4464
|
-
if (typeof
|
|
4465
|
-
return
|
|
4464
|
+
if (typeof fs3.copyFile === "function") {
|
|
4465
|
+
return fs3.copyFile(src, dest, (err) => {
|
|
4466
4466
|
if (err)
|
|
4467
4467
|
return cb(err);
|
|
4468
4468
|
return setDestModeAndTimestamps(srcStat, dest, opts, cb);
|
|
@@ -4471,14 +4471,14 @@ var require_copy = __commonJS({
|
|
|
4471
4471
|
return copyFileFallback(srcStat, src, dest, opts, cb);
|
|
4472
4472
|
}
|
|
4473
4473
|
function copyFileFallback(srcStat, src, dest, opts, cb) {
|
|
4474
|
-
const rs2 =
|
|
4474
|
+
const rs2 = fs3.createReadStream(src);
|
|
4475
4475
|
rs2.on("error", (err) => cb(err)).once("open", () => {
|
|
4476
|
-
const ws2 =
|
|
4476
|
+
const ws2 = fs3.createWriteStream(dest, { mode: srcStat.mode });
|
|
4477
4477
|
ws2.on("error", (err) => cb(err)).on("open", () => rs2.pipe(ws2)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
|
|
4478
4478
|
});
|
|
4479
4479
|
}
|
|
4480
4480
|
function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
|
|
4481
|
-
|
|
4481
|
+
fs3.chmod(dest, srcStat.mode, (err) => {
|
|
4482
4482
|
if (err)
|
|
4483
4483
|
return cb(err);
|
|
4484
4484
|
if (opts.preserveTimestamps) {
|
|
@@ -4496,18 +4496,18 @@ var require_copy = __commonJS({
|
|
|
4496
4496
|
return copyDir(src, dest, opts, cb);
|
|
4497
4497
|
}
|
|
4498
4498
|
function mkDirAndCopy(srcStat, src, dest, opts, cb) {
|
|
4499
|
-
|
|
4499
|
+
fs3.mkdir(dest, (err) => {
|
|
4500
4500
|
if (err)
|
|
4501
4501
|
return cb(err);
|
|
4502
4502
|
copyDir(src, dest, opts, (err2) => {
|
|
4503
4503
|
if (err2)
|
|
4504
4504
|
return cb(err2);
|
|
4505
|
-
return
|
|
4505
|
+
return fs3.chmod(dest, srcStat.mode, cb);
|
|
4506
4506
|
});
|
|
4507
4507
|
});
|
|
4508
4508
|
}
|
|
4509
4509
|
function copyDir(src, dest, opts, cb) {
|
|
4510
|
-
|
|
4510
|
+
fs3.readdir(src, (err, items) => {
|
|
4511
4511
|
if (err)
|
|
4512
4512
|
return cb(err);
|
|
4513
4513
|
return copyDirItems(items, src, dest, opts, cb);
|
|
@@ -4533,19 +4533,19 @@ var require_copy = __commonJS({
|
|
|
4533
4533
|
});
|
|
4534
4534
|
}
|
|
4535
4535
|
function onLink(destStat, src, dest, opts, cb) {
|
|
4536
|
-
|
|
4536
|
+
fs3.readlink(src, (err, resolvedSrc) => {
|
|
4537
4537
|
if (err)
|
|
4538
4538
|
return cb(err);
|
|
4539
4539
|
if (opts.dereference) {
|
|
4540
4540
|
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
4541
4541
|
}
|
|
4542
4542
|
if (destStat === notExist) {
|
|
4543
|
-
return
|
|
4543
|
+
return fs3.symlink(resolvedSrc, dest, cb);
|
|
4544
4544
|
} else {
|
|
4545
|
-
|
|
4545
|
+
fs3.readlink(dest, (err2, resolvedDest) => {
|
|
4546
4546
|
if (err2) {
|
|
4547
4547
|
if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
|
|
4548
|
-
return
|
|
4548
|
+
return fs3.symlink(resolvedSrc, dest, cb);
|
|
4549
4549
|
return cb(err2);
|
|
4550
4550
|
}
|
|
4551
4551
|
if (opts.dereference) {
|
|
@@ -4563,10 +4563,10 @@ var require_copy = __commonJS({
|
|
|
4563
4563
|
});
|
|
4564
4564
|
}
|
|
4565
4565
|
function copyLink(resolvedSrc, dest, cb) {
|
|
4566
|
-
|
|
4566
|
+
fs3.unlink(dest, (err) => {
|
|
4567
4567
|
if (err)
|
|
4568
4568
|
return cb(err);
|
|
4569
|
-
return
|
|
4569
|
+
return fs3.symlink(resolvedSrc, dest, cb);
|
|
4570
4570
|
});
|
|
4571
4571
|
}
|
|
4572
4572
|
function isSrcSubdir(src, dest) {
|
|
@@ -4575,10 +4575,10 @@ var require_copy = __commonJS({
|
|
|
4575
4575
|
return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
|
|
4576
4576
|
}
|
|
4577
4577
|
function checkStats(src, dest, cb) {
|
|
4578
|
-
|
|
4578
|
+
fs3.stat(src, (err, srcStat) => {
|
|
4579
4579
|
if (err)
|
|
4580
4580
|
return cb(err);
|
|
4581
|
-
|
|
4581
|
+
fs3.stat(dest, (err2, destStat) => {
|
|
4582
4582
|
if (err2) {
|
|
4583
4583
|
if (err2.code === "ENOENT")
|
|
4584
4584
|
return cb(null, { srcStat, destStat: notExist });
|
|
@@ -4621,7 +4621,7 @@ var require_copy2 = __commonJS({
|
|
|
4621
4621
|
var require_rimraf = __commonJS({
|
|
4622
4622
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/remove/rimraf.js"(exports, module2) {
|
|
4623
4623
|
"use strict";
|
|
4624
|
-
var
|
|
4624
|
+
var fs3 = require_graceful_fs();
|
|
4625
4625
|
var path = require("path");
|
|
4626
4626
|
var assert = require("assert");
|
|
4627
4627
|
var isWindows = process.platform === "win32";
|
|
@@ -4635,9 +4635,9 @@ var require_rimraf = __commonJS({
|
|
|
4635
4635
|
"readdir"
|
|
4636
4636
|
];
|
|
4637
4637
|
methods.forEach((m2) => {
|
|
4638
|
-
options[m2] = options[m2] ||
|
|
4638
|
+
options[m2] = options[m2] || fs3[m2];
|
|
4639
4639
|
m2 = m2 + "Sync";
|
|
4640
|
-
options[m2] = options[m2] ||
|
|
4640
|
+
options[m2] = options[m2] || fs3[m2];
|
|
4641
4641
|
});
|
|
4642
4642
|
options.maxBusyTries = options.maxBusyTries || 3;
|
|
4643
4643
|
}
|
|
@@ -4886,14 +4886,14 @@ var require_empty = __commonJS({
|
|
|
4886
4886
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
|
|
4887
4887
|
"use strict";
|
|
4888
4888
|
var u2 = require_universalify().fromCallback;
|
|
4889
|
-
var
|
|
4889
|
+
var fs3 = require("fs");
|
|
4890
4890
|
var path = require("path");
|
|
4891
4891
|
var mkdir = require_mkdirs2();
|
|
4892
4892
|
var remove3 = require_remove();
|
|
4893
4893
|
var emptyDir = u2(function emptyDir2(dir, callback) {
|
|
4894
4894
|
callback = callback || function() {
|
|
4895
4895
|
};
|
|
4896
|
-
|
|
4896
|
+
fs3.readdir(dir, (err, items) => {
|
|
4897
4897
|
if (err)
|
|
4898
4898
|
return mkdir.mkdirs(dir, callback);
|
|
4899
4899
|
items = items.map((item) => path.join(dir, item));
|
|
@@ -4913,7 +4913,7 @@ var require_empty = __commonJS({
|
|
|
4913
4913
|
function emptyDirSync(dir) {
|
|
4914
4914
|
let items;
|
|
4915
4915
|
try {
|
|
4916
|
-
items =
|
|
4916
|
+
items = fs3.readdirSync(dir);
|
|
4917
4917
|
} catch (err) {
|
|
4918
4918
|
return mkdir.mkdirsSync(dir);
|
|
4919
4919
|
}
|
|
@@ -4937,18 +4937,18 @@ var require_file = __commonJS({
|
|
|
4937
4937
|
"use strict";
|
|
4938
4938
|
var u2 = require_universalify().fromCallback;
|
|
4939
4939
|
var path = require("path");
|
|
4940
|
-
var
|
|
4940
|
+
var fs3 = require_graceful_fs();
|
|
4941
4941
|
var mkdir = require_mkdirs2();
|
|
4942
4942
|
var pathExists5 = require_path_exists().pathExists;
|
|
4943
4943
|
function createFile(file, callback) {
|
|
4944
4944
|
function makeFile() {
|
|
4945
|
-
|
|
4945
|
+
fs3.writeFile(file, "", (err) => {
|
|
4946
4946
|
if (err)
|
|
4947
4947
|
return callback(err);
|
|
4948
4948
|
callback();
|
|
4949
4949
|
});
|
|
4950
4950
|
}
|
|
4951
|
-
|
|
4951
|
+
fs3.stat(file, (err, stats) => {
|
|
4952
4952
|
if (!err && stats.isFile())
|
|
4953
4953
|
return callback();
|
|
4954
4954
|
const dir = path.dirname(file);
|
|
@@ -4968,16 +4968,16 @@ var require_file = __commonJS({
|
|
|
4968
4968
|
function createFileSync(file) {
|
|
4969
4969
|
let stats;
|
|
4970
4970
|
try {
|
|
4971
|
-
stats =
|
|
4971
|
+
stats = fs3.statSync(file);
|
|
4972
4972
|
} catch (e) {
|
|
4973
4973
|
}
|
|
4974
4974
|
if (stats && stats.isFile())
|
|
4975
4975
|
return;
|
|
4976
4976
|
const dir = path.dirname(file);
|
|
4977
|
-
if (!
|
|
4977
|
+
if (!fs3.existsSync(dir)) {
|
|
4978
4978
|
mkdir.mkdirsSync(dir);
|
|
4979
4979
|
}
|
|
4980
|
-
|
|
4980
|
+
fs3.writeFileSync(file, "");
|
|
4981
4981
|
}
|
|
4982
4982
|
module2.exports = {
|
|
4983
4983
|
createFile: u2(createFile),
|
|
@@ -4992,12 +4992,12 @@ var require_link = __commonJS({
|
|
|
4992
4992
|
"use strict";
|
|
4993
4993
|
var u2 = require_universalify().fromCallback;
|
|
4994
4994
|
var path = require("path");
|
|
4995
|
-
var
|
|
4995
|
+
var fs3 = require_graceful_fs();
|
|
4996
4996
|
var mkdir = require_mkdirs2();
|
|
4997
4997
|
var pathExists5 = require_path_exists().pathExists;
|
|
4998
4998
|
function createLink(srcpath, dstpath, callback) {
|
|
4999
4999
|
function makeLink(srcpath2, dstpath2) {
|
|
5000
|
-
|
|
5000
|
+
fs3.link(srcpath2, dstpath2, (err) => {
|
|
5001
5001
|
if (err)
|
|
5002
5002
|
return callback(err);
|
|
5003
5003
|
callback(null);
|
|
@@ -5008,7 +5008,7 @@ var require_link = __commonJS({
|
|
|
5008
5008
|
return callback(err);
|
|
5009
5009
|
if (destinationExists)
|
|
5010
5010
|
return callback(null);
|
|
5011
|
-
|
|
5011
|
+
fs3.lstat(srcpath, (err2) => {
|
|
5012
5012
|
if (err2) {
|
|
5013
5013
|
err2.message = err2.message.replace("lstat", "ensureLink");
|
|
5014
5014
|
return callback(err2);
|
|
@@ -5029,21 +5029,21 @@ var require_link = __commonJS({
|
|
|
5029
5029
|
});
|
|
5030
5030
|
}
|
|
5031
5031
|
function createLinkSync(srcpath, dstpath) {
|
|
5032
|
-
const destinationExists =
|
|
5032
|
+
const destinationExists = fs3.existsSync(dstpath);
|
|
5033
5033
|
if (destinationExists)
|
|
5034
5034
|
return void 0;
|
|
5035
5035
|
try {
|
|
5036
|
-
|
|
5036
|
+
fs3.lstatSync(srcpath);
|
|
5037
5037
|
} catch (err) {
|
|
5038
5038
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
5039
5039
|
throw err;
|
|
5040
5040
|
}
|
|
5041
5041
|
const dir = path.dirname(dstpath);
|
|
5042
|
-
const dirExists =
|
|
5042
|
+
const dirExists = fs3.existsSync(dir);
|
|
5043
5043
|
if (dirExists)
|
|
5044
|
-
return
|
|
5044
|
+
return fs3.linkSync(srcpath, dstpath);
|
|
5045
5045
|
mkdir.mkdirsSync(dir);
|
|
5046
|
-
return
|
|
5046
|
+
return fs3.linkSync(srcpath, dstpath);
|
|
5047
5047
|
}
|
|
5048
5048
|
module2.exports = {
|
|
5049
5049
|
createLink: u2(createLink),
|
|
@@ -5057,11 +5057,11 @@ var require_symlink_paths = __commonJS({
|
|
|
5057
5057
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
|
|
5058
5058
|
"use strict";
|
|
5059
5059
|
var path = require("path");
|
|
5060
|
-
var
|
|
5060
|
+
var fs3 = require_graceful_fs();
|
|
5061
5061
|
var pathExists5 = require_path_exists().pathExists;
|
|
5062
5062
|
function symlinkPaths(srcpath, dstpath, callback) {
|
|
5063
5063
|
if (path.isAbsolute(srcpath)) {
|
|
5064
|
-
return
|
|
5064
|
+
return fs3.lstat(srcpath, (err) => {
|
|
5065
5065
|
if (err) {
|
|
5066
5066
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
5067
5067
|
return callback(err);
|
|
@@ -5083,7 +5083,7 @@ var require_symlink_paths = __commonJS({
|
|
|
5083
5083
|
"toDst": srcpath
|
|
5084
5084
|
});
|
|
5085
5085
|
} else {
|
|
5086
|
-
return
|
|
5086
|
+
return fs3.lstat(srcpath, (err2) => {
|
|
5087
5087
|
if (err2) {
|
|
5088
5088
|
err2.message = err2.message.replace("lstat", "ensureSymlink");
|
|
5089
5089
|
return callback(err2);
|
|
@@ -5100,7 +5100,7 @@ var require_symlink_paths = __commonJS({
|
|
|
5100
5100
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
5101
5101
|
let exists;
|
|
5102
5102
|
if (path.isAbsolute(srcpath)) {
|
|
5103
|
-
exists =
|
|
5103
|
+
exists = fs3.existsSync(srcpath);
|
|
5104
5104
|
if (!exists)
|
|
5105
5105
|
throw new Error("absolute srcpath does not exist");
|
|
5106
5106
|
return {
|
|
@@ -5110,14 +5110,14 @@ var require_symlink_paths = __commonJS({
|
|
|
5110
5110
|
} else {
|
|
5111
5111
|
const dstdir = path.dirname(dstpath);
|
|
5112
5112
|
const relativeToDst = path.join(dstdir, srcpath);
|
|
5113
|
-
exists =
|
|
5113
|
+
exists = fs3.existsSync(relativeToDst);
|
|
5114
5114
|
if (exists) {
|
|
5115
5115
|
return {
|
|
5116
5116
|
"toCwd": relativeToDst,
|
|
5117
5117
|
"toDst": srcpath
|
|
5118
5118
|
};
|
|
5119
5119
|
} else {
|
|
5120
|
-
exists =
|
|
5120
|
+
exists = fs3.existsSync(srcpath);
|
|
5121
5121
|
if (!exists)
|
|
5122
5122
|
throw new Error("relative srcpath does not exist");
|
|
5123
5123
|
return {
|
|
@@ -5138,13 +5138,13 @@ var require_symlink_paths = __commonJS({
|
|
|
5138
5138
|
var require_symlink_type = __commonJS({
|
|
5139
5139
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
|
|
5140
5140
|
"use strict";
|
|
5141
|
-
var
|
|
5141
|
+
var fs3 = require_graceful_fs();
|
|
5142
5142
|
function symlinkType(srcpath, type, callback) {
|
|
5143
5143
|
callback = typeof type === "function" ? type : callback;
|
|
5144
5144
|
type = typeof type === "function" ? false : type;
|
|
5145
5145
|
if (type)
|
|
5146
5146
|
return callback(null, type);
|
|
5147
|
-
|
|
5147
|
+
fs3.lstat(srcpath, (err, stats) => {
|
|
5148
5148
|
if (err)
|
|
5149
5149
|
return callback(null, "file");
|
|
5150
5150
|
type = stats && stats.isDirectory() ? "dir" : "file";
|
|
@@ -5156,7 +5156,7 @@ var require_symlink_type = __commonJS({
|
|
|
5156
5156
|
if (type)
|
|
5157
5157
|
return type;
|
|
5158
5158
|
try {
|
|
5159
|
-
stats =
|
|
5159
|
+
stats = fs3.lstatSync(srcpath);
|
|
5160
5160
|
} catch (e) {
|
|
5161
5161
|
return "file";
|
|
5162
5162
|
}
|
|
@@ -5175,7 +5175,7 @@ var require_symlink = __commonJS({
|
|
|
5175
5175
|
"use strict";
|
|
5176
5176
|
var u2 = require_universalify().fromCallback;
|
|
5177
5177
|
var path = require("path");
|
|
5178
|
-
var
|
|
5178
|
+
var fs3 = require_graceful_fs();
|
|
5179
5179
|
var _mkdirs = require_mkdirs2();
|
|
5180
5180
|
var mkdirs = _mkdirs.mkdirs;
|
|
5181
5181
|
var mkdirsSync = _mkdirs.mkdirsSync;
|
|
@@ -5206,11 +5206,11 @@ var require_symlink = __commonJS({
|
|
|
5206
5206
|
if (err4)
|
|
5207
5207
|
return callback(err4);
|
|
5208
5208
|
if (dirExists)
|
|
5209
|
-
return
|
|
5209
|
+
return fs3.symlink(srcpath, dstpath, type2, callback);
|
|
5210
5210
|
mkdirs(dir, (err5) => {
|
|
5211
5211
|
if (err5)
|
|
5212
5212
|
return callback(err5);
|
|
5213
|
-
|
|
5213
|
+
fs3.symlink(srcpath, dstpath, type2, callback);
|
|
5214
5214
|
});
|
|
5215
5215
|
});
|
|
5216
5216
|
});
|
|
@@ -5218,18 +5218,18 @@ var require_symlink = __commonJS({
|
|
|
5218
5218
|
});
|
|
5219
5219
|
}
|
|
5220
5220
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
5221
|
-
const destinationExists =
|
|
5221
|
+
const destinationExists = fs3.existsSync(dstpath);
|
|
5222
5222
|
if (destinationExists)
|
|
5223
5223
|
return void 0;
|
|
5224
5224
|
const relative2 = symlinkPathsSync(srcpath, dstpath);
|
|
5225
5225
|
srcpath = relative2.toDst;
|
|
5226
5226
|
type = symlinkTypeSync(relative2.toCwd, type);
|
|
5227
5227
|
const dir = path.dirname(dstpath);
|
|
5228
|
-
const exists =
|
|
5228
|
+
const exists = fs3.existsSync(dir);
|
|
5229
5229
|
if (exists)
|
|
5230
|
-
return
|
|
5230
|
+
return fs3.symlinkSync(srcpath, dstpath, type);
|
|
5231
5231
|
mkdirsSync(dir);
|
|
5232
|
-
return
|
|
5232
|
+
return fs3.symlinkSync(srcpath, dstpath, type);
|
|
5233
5233
|
}
|
|
5234
5234
|
module2.exports = {
|
|
5235
5235
|
createSymlink: u2(createSymlink),
|
|
@@ -5274,7 +5274,7 @@ var require_jsonfile = __commonJS({
|
|
|
5274
5274
|
} catch (_2) {
|
|
5275
5275
|
_fs = require("fs");
|
|
5276
5276
|
}
|
|
5277
|
-
function
|
|
5277
|
+
function readFile3(file, options, callback) {
|
|
5278
5278
|
if (callback == null) {
|
|
5279
5279
|
callback = options;
|
|
5280
5280
|
options = {};
|
|
@@ -5283,12 +5283,12 @@ var require_jsonfile = __commonJS({
|
|
|
5283
5283
|
options = { encoding: options };
|
|
5284
5284
|
}
|
|
5285
5285
|
options = options || {};
|
|
5286
|
-
var
|
|
5286
|
+
var fs3 = options.fs || _fs;
|
|
5287
5287
|
var shouldThrow = true;
|
|
5288
5288
|
if ("throws" in options) {
|
|
5289
5289
|
shouldThrow = options.throws;
|
|
5290
5290
|
}
|
|
5291
|
-
|
|
5291
|
+
fs3.readFile(file, options, function(err, data) {
|
|
5292
5292
|
if (err)
|
|
5293
5293
|
return callback(err);
|
|
5294
5294
|
data = stripBom(data);
|
|
@@ -5311,13 +5311,13 @@ var require_jsonfile = __commonJS({
|
|
|
5311
5311
|
if (typeof options === "string") {
|
|
5312
5312
|
options = { encoding: options };
|
|
5313
5313
|
}
|
|
5314
|
-
var
|
|
5314
|
+
var fs3 = options.fs || _fs;
|
|
5315
5315
|
var shouldThrow = true;
|
|
5316
5316
|
if ("throws" in options) {
|
|
5317
5317
|
shouldThrow = options.throws;
|
|
5318
5318
|
}
|
|
5319
5319
|
try {
|
|
5320
|
-
var content =
|
|
5320
|
+
var content = fs3.readFileSync(file, options);
|
|
5321
5321
|
content = stripBom(content);
|
|
5322
5322
|
return JSON.parse(content, options.reviver);
|
|
5323
5323
|
} catch (err) {
|
|
@@ -5349,7 +5349,7 @@ var require_jsonfile = __commonJS({
|
|
|
5349
5349
|
options = {};
|
|
5350
5350
|
}
|
|
5351
5351
|
options = options || {};
|
|
5352
|
-
var
|
|
5352
|
+
var fs3 = options.fs || _fs;
|
|
5353
5353
|
var str = "";
|
|
5354
5354
|
try {
|
|
5355
5355
|
str = stringify(obj, options);
|
|
@@ -5358,13 +5358,13 @@ var require_jsonfile = __commonJS({
|
|
|
5358
5358
|
callback(err, null);
|
|
5359
5359
|
return;
|
|
5360
5360
|
}
|
|
5361
|
-
|
|
5361
|
+
fs3.writeFile(file, str, options, callback);
|
|
5362
5362
|
}
|
|
5363
5363
|
function writeFileSync(file, obj, options) {
|
|
5364
5364
|
options = options || {};
|
|
5365
|
-
var
|
|
5365
|
+
var fs3 = options.fs || _fs;
|
|
5366
5366
|
var str = stringify(obj, options);
|
|
5367
|
-
return
|
|
5367
|
+
return fs3.writeFileSync(file, str, options);
|
|
5368
5368
|
}
|
|
5369
5369
|
function stripBom(content) {
|
|
5370
5370
|
if (Buffer.isBuffer(content))
|
|
@@ -5373,7 +5373,7 @@ var require_jsonfile = __commonJS({
|
|
|
5373
5373
|
return content;
|
|
5374
5374
|
}
|
|
5375
5375
|
var jsonfile = {
|
|
5376
|
-
readFile:
|
|
5376
|
+
readFile: readFile3,
|
|
5377
5377
|
readFileSync,
|
|
5378
5378
|
writeFile: writeFile2,
|
|
5379
5379
|
writeFileSync
|
|
@@ -5432,13 +5432,13 @@ var require_output_json = __commonJS({
|
|
|
5432
5432
|
var require_output_json_sync = __commonJS({
|
|
5433
5433
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
|
|
5434
5434
|
"use strict";
|
|
5435
|
-
var
|
|
5435
|
+
var fs3 = require_graceful_fs();
|
|
5436
5436
|
var path = require("path");
|
|
5437
5437
|
var mkdir = require_mkdirs2();
|
|
5438
5438
|
var jsonFile = require_jsonfile2();
|
|
5439
5439
|
function outputJsonSync(file, data, options) {
|
|
5440
5440
|
const dir = path.dirname(file);
|
|
5441
|
-
if (!
|
|
5441
|
+
if (!fs3.existsSync(dir)) {
|
|
5442
5442
|
mkdir.mkdirsSync(dir);
|
|
5443
5443
|
}
|
|
5444
5444
|
jsonFile.writeJsonSync(file, data, options);
|
|
@@ -5469,7 +5469,7 @@ var require_json = __commonJS({
|
|
|
5469
5469
|
var require_move_sync = __commonJS({
|
|
5470
5470
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/move-sync/index.js"(exports, module2) {
|
|
5471
5471
|
"use strict";
|
|
5472
|
-
var
|
|
5472
|
+
var fs3 = require_graceful_fs();
|
|
5473
5473
|
var path = require("path");
|
|
5474
5474
|
var copySync = require_copy_sync2().copySync;
|
|
5475
5475
|
var removeSync = require_remove().removeSync;
|
|
@@ -5481,7 +5481,7 @@ var require_move_sync = __commonJS({
|
|
|
5481
5481
|
src = path.resolve(src);
|
|
5482
5482
|
dest = path.resolve(dest);
|
|
5483
5483
|
if (src === dest)
|
|
5484
|
-
return
|
|
5484
|
+
return fs3.accessSync(src);
|
|
5485
5485
|
if (isSrcSubdir(src, dest))
|
|
5486
5486
|
throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
|
|
5487
5487
|
mkdirpSync(path.dirname(dest));
|
|
@@ -5489,7 +5489,7 @@ var require_move_sync = __commonJS({
|
|
|
5489
5489
|
function tryRenameSync() {
|
|
5490
5490
|
if (overwrite) {
|
|
5491
5491
|
try {
|
|
5492
|
-
return
|
|
5492
|
+
return fs3.renameSync(src, dest);
|
|
5493
5493
|
} catch (err) {
|
|
5494
5494
|
if (err.code === "ENOTEMPTY" || err.code === "EEXIST" || err.code === "EPERM") {
|
|
5495
5495
|
removeSync(dest);
|
|
@@ -5502,8 +5502,8 @@ var require_move_sync = __commonJS({
|
|
|
5502
5502
|
}
|
|
5503
5503
|
} else {
|
|
5504
5504
|
try {
|
|
5505
|
-
|
|
5506
|
-
return
|
|
5505
|
+
fs3.linkSync(src, dest);
|
|
5506
|
+
return fs3.unlinkSync(src);
|
|
5507
5507
|
} catch (err) {
|
|
5508
5508
|
if (err.code === "EXDEV" || err.code === "EISDIR" || err.code === "EPERM" || err.code === "ENOTSUP") {
|
|
5509
5509
|
return moveSyncAcrossDevice(src, dest, overwrite);
|
|
@@ -5514,7 +5514,7 @@ var require_move_sync = __commonJS({
|
|
|
5514
5514
|
}
|
|
5515
5515
|
}
|
|
5516
5516
|
function moveSyncAcrossDevice(src, dest, overwrite) {
|
|
5517
|
-
const stat =
|
|
5517
|
+
const stat = fs3.statSync(src);
|
|
5518
5518
|
if (stat.isDirectory()) {
|
|
5519
5519
|
return moveDirSyncAcrossDevice(src, dest, overwrite);
|
|
5520
5520
|
} else {
|
|
@@ -5525,18 +5525,18 @@ var require_move_sync = __commonJS({
|
|
|
5525
5525
|
const BUF_LENGTH = 64 * 1024;
|
|
5526
5526
|
const _buff = buffer(BUF_LENGTH);
|
|
5527
5527
|
const flags = overwrite ? "w" : "wx";
|
|
5528
|
-
const fdr =
|
|
5529
|
-
const stat =
|
|
5530
|
-
const fdw =
|
|
5528
|
+
const fdr = fs3.openSync(src, "r");
|
|
5529
|
+
const stat = fs3.fstatSync(fdr);
|
|
5530
|
+
const fdw = fs3.openSync(dest, flags, stat.mode);
|
|
5531
5531
|
let pos = 0;
|
|
5532
5532
|
while (pos < stat.size) {
|
|
5533
|
-
const bytesRead =
|
|
5534
|
-
|
|
5533
|
+
const bytesRead = fs3.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
5534
|
+
fs3.writeSync(fdw, _buff, 0, bytesRead);
|
|
5535
5535
|
pos += bytesRead;
|
|
5536
5536
|
}
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
return
|
|
5537
|
+
fs3.closeSync(fdr);
|
|
5538
|
+
fs3.closeSync(fdw);
|
|
5539
|
+
return fs3.unlinkSync(src);
|
|
5540
5540
|
}
|
|
5541
5541
|
function moveDirSyncAcrossDevice(src, dest, overwrite) {
|
|
5542
5542
|
const options = {
|
|
@@ -5555,7 +5555,7 @@ var require_move_sync = __commonJS({
|
|
|
5555
5555
|
}
|
|
5556
5556
|
function isSrcSubdir(src, dest) {
|
|
5557
5557
|
try {
|
|
5558
|
-
return
|
|
5558
|
+
return fs3.statSync(src).isDirectory() && src !== dest && dest.indexOf(src) > -1 && dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src);
|
|
5559
5559
|
} catch (e) {
|
|
5560
5560
|
return false;
|
|
5561
5561
|
}
|
|
@@ -5571,7 +5571,7 @@ var require_move = __commonJS({
|
|
|
5571
5571
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
|
|
5572
5572
|
"use strict";
|
|
5573
5573
|
var u2 = require_universalify().fromCallback;
|
|
5574
|
-
var
|
|
5574
|
+
var fs3 = require_graceful_fs();
|
|
5575
5575
|
var path = require("path");
|
|
5576
5576
|
var copy3 = require_copy2().copy;
|
|
5577
5577
|
var remove3 = require_remove().remove;
|
|
@@ -5586,8 +5586,8 @@ var require_move = __commonJS({
|
|
|
5586
5586
|
src = path.resolve(src);
|
|
5587
5587
|
dest = path.resolve(dest);
|
|
5588
5588
|
if (src === dest)
|
|
5589
|
-
return
|
|
5590
|
-
|
|
5589
|
+
return fs3.access(src, cb);
|
|
5590
|
+
fs3.stat(src, (err, st2) => {
|
|
5591
5591
|
if (err)
|
|
5592
5592
|
return cb(err);
|
|
5593
5593
|
if (st2.isDirectory() && isSrcSubdir(src, dest)) {
|
|
@@ -5617,7 +5617,7 @@ var require_move = __commonJS({
|
|
|
5617
5617
|
});
|
|
5618
5618
|
}
|
|
5619
5619
|
function rename(src, dest, overwrite, cb) {
|
|
5620
|
-
|
|
5620
|
+
fs3.rename(src, dest, (err) => {
|
|
5621
5621
|
if (!err)
|
|
5622
5622
|
return cb();
|
|
5623
5623
|
if (err.code !== "EXDEV")
|
|
@@ -5654,7 +5654,7 @@ var require_output = __commonJS({
|
|
|
5654
5654
|
"../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/output/index.js"(exports, module2) {
|
|
5655
5655
|
"use strict";
|
|
5656
5656
|
var u2 = require_universalify().fromCallback;
|
|
5657
|
-
var
|
|
5657
|
+
var fs3 = require_graceful_fs();
|
|
5658
5658
|
var path = require("path");
|
|
5659
5659
|
var mkdir = require_mkdirs2();
|
|
5660
5660
|
var pathExists5 = require_path_exists().pathExists;
|
|
@@ -5668,21 +5668,21 @@ var require_output = __commonJS({
|
|
|
5668
5668
|
if (err)
|
|
5669
5669
|
return callback(err);
|
|
5670
5670
|
if (itDoes)
|
|
5671
|
-
return
|
|
5671
|
+
return fs3.writeFile(file, data, encoding, callback);
|
|
5672
5672
|
mkdir.mkdirs(dir, (err2) => {
|
|
5673
5673
|
if (err2)
|
|
5674
5674
|
return callback(err2);
|
|
5675
|
-
|
|
5675
|
+
fs3.writeFile(file, data, encoding, callback);
|
|
5676
5676
|
});
|
|
5677
5677
|
});
|
|
5678
5678
|
}
|
|
5679
5679
|
function outputFileSync(file, ...args) {
|
|
5680
5680
|
const dir = path.dirname(file);
|
|
5681
|
-
if (
|
|
5682
|
-
return
|
|
5681
|
+
if (fs3.existsSync(dir)) {
|
|
5682
|
+
return fs3.writeFileSync(file, ...args);
|
|
5683
5683
|
}
|
|
5684
5684
|
mkdir.mkdirsSync(dir);
|
|
5685
|
-
|
|
5685
|
+
fs3.writeFileSync(file, ...args);
|
|
5686
5686
|
}
|
|
5687
5687
|
module2.exports = {
|
|
5688
5688
|
outputFile: u2(outputFile),
|
|
@@ -5712,11 +5712,11 @@ var require_lib2 = __commonJS({
|
|
|
5712
5712
|
require_path_exists(),
|
|
5713
5713
|
require_remove()
|
|
5714
5714
|
);
|
|
5715
|
-
var
|
|
5716
|
-
if (Object.getOwnPropertyDescriptor(
|
|
5715
|
+
var fs3 = require("fs");
|
|
5716
|
+
if (Object.getOwnPropertyDescriptor(fs3, "promises")) {
|
|
5717
5717
|
Object.defineProperty(module2.exports, "promises", {
|
|
5718
5718
|
get() {
|
|
5719
|
-
return
|
|
5719
|
+
return fs3.promises;
|
|
5720
5720
|
}
|
|
5721
5721
|
});
|
|
5722
5722
|
}
|
|
@@ -7498,9 +7498,9 @@ var require_public_api = __commonJS({
|
|
|
7498
7498
|
}
|
|
7499
7499
|
});
|
|
7500
7500
|
|
|
7501
|
-
// ../../node_modules/.pnpm/node-fetch@2.6.
|
|
7501
|
+
// ../../node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/lib/index.js
|
|
7502
7502
|
var require_lib4 = __commonJS({
|
|
7503
|
-
"../../node_modules/.pnpm/node-fetch@2.6.
|
|
7503
|
+
"../../node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/lib/index.js"(exports, module2) {
|
|
7504
7504
|
"use strict";
|
|
7505
7505
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7506
7506
|
function _interopDefault(ex) {
|
|
@@ -8495,6 +8495,11 @@ var require_lib4 = __commonJS({
|
|
|
8495
8495
|
const dest = new URL$1(destination).hostname;
|
|
8496
8496
|
return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
|
|
8497
8497
|
};
|
|
8498
|
+
var isSameProtocol = function isSameProtocol2(destination, original) {
|
|
8499
|
+
const orig = new URL$1(original).protocol;
|
|
8500
|
+
const dest = new URL$1(destination).protocol;
|
|
8501
|
+
return orig === dest;
|
|
8502
|
+
};
|
|
8498
8503
|
function fetch(url, opts) {
|
|
8499
8504
|
if (!fetch.Promise) {
|
|
8500
8505
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
@@ -8510,7 +8515,7 @@ var require_lib4 = __commonJS({
|
|
|
8510
8515
|
let error = new AbortError("The user aborted a request.");
|
|
8511
8516
|
reject(error);
|
|
8512
8517
|
if (request.body && request.body instanceof Stream.Readable) {
|
|
8513
|
-
request.body
|
|
8518
|
+
destroyStream(request.body, error);
|
|
8514
8519
|
}
|
|
8515
8520
|
if (!response || !response.body)
|
|
8516
8521
|
return;
|
|
@@ -8545,8 +8550,31 @@ var require_lib4 = __commonJS({
|
|
|
8545
8550
|
}
|
|
8546
8551
|
req.on("error", function(err) {
|
|
8547
8552
|
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
|
|
8553
|
+
if (response && response.body) {
|
|
8554
|
+
destroyStream(response.body, err);
|
|
8555
|
+
}
|
|
8548
8556
|
finalize();
|
|
8549
8557
|
});
|
|
8558
|
+
fixResponseChunkedTransferBadEnding(req, function(err) {
|
|
8559
|
+
if (signal && signal.aborted) {
|
|
8560
|
+
return;
|
|
8561
|
+
}
|
|
8562
|
+
if (response && response.body) {
|
|
8563
|
+
destroyStream(response.body, err);
|
|
8564
|
+
}
|
|
8565
|
+
});
|
|
8566
|
+
if (parseInt(process.version.substring(1)) < 14) {
|
|
8567
|
+
req.on("socket", function(s3) {
|
|
8568
|
+
s3.addListener("close", function(hadError) {
|
|
8569
|
+
const hasDataListener = s3.listenerCount("data") > 0;
|
|
8570
|
+
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
|
|
8571
|
+
const err = new Error("Premature close");
|
|
8572
|
+
err.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
8573
|
+
response.body.emit("error", err);
|
|
8574
|
+
}
|
|
8575
|
+
});
|
|
8576
|
+
});
|
|
8577
|
+
}
|
|
8550
8578
|
req.on("response", function(res) {
|
|
8551
8579
|
clearTimeout(reqTimeout);
|
|
8552
8580
|
const headers = createHeadersLenient(res.headers);
|
|
@@ -8597,7 +8625,7 @@ var require_lib4 = __commonJS({
|
|
|
8597
8625
|
timeout: request.timeout,
|
|
8598
8626
|
size: request.size
|
|
8599
8627
|
};
|
|
8600
|
-
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
|
8628
|
+
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
|
8601
8629
|
for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
|
|
8602
8630
|
requestOpts.headers.delete(name);
|
|
8603
8631
|
}
|
|
@@ -8658,6 +8686,12 @@ var require_lib4 = __commonJS({
|
|
|
8658
8686
|
response = new Response(body, response_options);
|
|
8659
8687
|
resolve(response);
|
|
8660
8688
|
});
|
|
8689
|
+
raw.on("end", function() {
|
|
8690
|
+
if (!response) {
|
|
8691
|
+
response = new Response(body, response_options);
|
|
8692
|
+
resolve(response);
|
|
8693
|
+
}
|
|
8694
|
+
});
|
|
8661
8695
|
return;
|
|
8662
8696
|
}
|
|
8663
8697
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
@@ -8672,6 +8706,33 @@ var require_lib4 = __commonJS({
|
|
|
8672
8706
|
writeToStream(req, request);
|
|
8673
8707
|
});
|
|
8674
8708
|
}
|
|
8709
|
+
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
8710
|
+
let socket;
|
|
8711
|
+
request.on("socket", function(s3) {
|
|
8712
|
+
socket = s3;
|
|
8713
|
+
});
|
|
8714
|
+
request.on("response", function(response) {
|
|
8715
|
+
const headers = response.headers;
|
|
8716
|
+
if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
|
|
8717
|
+
response.once("close", function(hadError) {
|
|
8718
|
+
const hasDataListener = socket.listenerCount("data") > 0;
|
|
8719
|
+
if (hasDataListener && !hadError) {
|
|
8720
|
+
const err = new Error("Premature close");
|
|
8721
|
+
err.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
8722
|
+
errorCallback(err);
|
|
8723
|
+
}
|
|
8724
|
+
});
|
|
8725
|
+
}
|
|
8726
|
+
});
|
|
8727
|
+
}
|
|
8728
|
+
function destroyStream(stream, err) {
|
|
8729
|
+
if (stream.destroy) {
|
|
8730
|
+
stream.destroy(err);
|
|
8731
|
+
} else {
|
|
8732
|
+
stream.emit("error", err);
|
|
8733
|
+
stream.end();
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8675
8736
|
fetch.isRedirect = function(code) {
|
|
8676
8737
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
8677
8738
|
};
|
|
@@ -8786,7 +8847,7 @@ var require_pend = __commonJS({
|
|
|
8786
8847
|
// ../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js
|
|
8787
8848
|
var require_fd_slicer = __commonJS({
|
|
8788
8849
|
"../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js"(exports) {
|
|
8789
|
-
var
|
|
8850
|
+
var fs3 = require("fs");
|
|
8790
8851
|
var util = require("util");
|
|
8791
8852
|
var stream = require("stream");
|
|
8792
8853
|
var Readable = stream.Readable;
|
|
@@ -8811,7 +8872,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8811
8872
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
8812
8873
|
var self = this;
|
|
8813
8874
|
self.pend.go(function(cb) {
|
|
8814
|
-
|
|
8875
|
+
fs3.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
8815
8876
|
cb();
|
|
8816
8877
|
callback(err, bytesRead, buffer2);
|
|
8817
8878
|
});
|
|
@@ -8820,7 +8881,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8820
8881
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
8821
8882
|
var self = this;
|
|
8822
8883
|
self.pend.go(function(cb) {
|
|
8823
|
-
|
|
8884
|
+
fs3.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
8824
8885
|
cb();
|
|
8825
8886
|
callback(err, written, buffer2);
|
|
8826
8887
|
});
|
|
@@ -8843,7 +8904,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8843
8904
|
if (self.refCount < 0)
|
|
8844
8905
|
throw new Error("invalid unref");
|
|
8845
8906
|
if (self.autoClose) {
|
|
8846
|
-
|
|
8907
|
+
fs3.close(self.fd, onCloseDone);
|
|
8847
8908
|
}
|
|
8848
8909
|
function onCloseDone(err) {
|
|
8849
8910
|
if (err) {
|
|
@@ -8882,7 +8943,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8882
8943
|
if (self.destroyed)
|
|
8883
8944
|
return cb();
|
|
8884
8945
|
var buffer = new Buffer(toRead);
|
|
8885
|
-
|
|
8946
|
+
fs3.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
8886
8947
|
if (err) {
|
|
8887
8948
|
self.destroy(err);
|
|
8888
8949
|
} else if (bytesRead === 0) {
|
|
@@ -8932,7 +8993,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8932
8993
|
self.context.pend.go(function(cb) {
|
|
8933
8994
|
if (self.destroyed)
|
|
8934
8995
|
return cb();
|
|
8935
|
-
|
|
8996
|
+
fs3.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
8936
8997
|
if (err2) {
|
|
8937
8998
|
self.destroy();
|
|
8938
8999
|
cb();
|
|
@@ -9361,7 +9422,7 @@ var require_buffer_crc32 = __commonJS({
|
|
|
9361
9422
|
// ../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js
|
|
9362
9423
|
var require_yauzl = __commonJS({
|
|
9363
9424
|
"../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js"(exports) {
|
|
9364
|
-
var
|
|
9425
|
+
var fs3 = require("fs");
|
|
9365
9426
|
var zlib = require("zlib");
|
|
9366
9427
|
var fd_slicer = require_fd_slicer();
|
|
9367
9428
|
var crc32 = require_buffer_crc32();
|
|
@@ -9398,12 +9459,12 @@ var require_yauzl = __commonJS({
|
|
|
9398
9459
|
options.strictFileNames = false;
|
|
9399
9460
|
if (callback == null)
|
|
9400
9461
|
callback = defaultCallback;
|
|
9401
|
-
|
|
9462
|
+
fs3.open(path, "r", function(err, fd) {
|
|
9402
9463
|
if (err)
|
|
9403
9464
|
return callback(err);
|
|
9404
9465
|
fromFd(fd, options, function(err2, zipfile) {
|
|
9405
9466
|
if (err2)
|
|
9406
|
-
|
|
9467
|
+
fs3.close(fd, defaultCallback);
|
|
9407
9468
|
callback(err2, zipfile);
|
|
9408
9469
|
});
|
|
9409
9470
|
});
|
|
@@ -9427,7 +9488,7 @@ var require_yauzl = __commonJS({
|
|
|
9427
9488
|
options.strictFileNames = false;
|
|
9428
9489
|
if (callback == null)
|
|
9429
9490
|
callback = defaultCallback;
|
|
9430
|
-
|
|
9491
|
+
fs3.fstat(fd, function(err, stats) {
|
|
9431
9492
|
if (err)
|
|
9432
9493
|
return callback(err);
|
|
9433
9494
|
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
@@ -10877,15 +10938,94 @@ var require_xdg_app_paths = __commonJS({
|
|
|
10877
10938
|
}
|
|
10878
10939
|
});
|
|
10879
10940
|
|
|
10941
|
+
// ../../internals/ipc-proxy/dist/index.js
|
|
10942
|
+
var require_dist2 = __commonJS({
|
|
10943
|
+
"../../internals/ipc-proxy/dist/index.js"(exports, module2) {
|
|
10944
|
+
"use strict";
|
|
10945
|
+
var __defProp2 = Object.defineProperty;
|
|
10946
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
10947
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
10948
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
10949
|
+
var __export2 = (target, all) => {
|
|
10950
|
+
for (var name in all)
|
|
10951
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
10952
|
+
};
|
|
10953
|
+
var __copyProps2 = (to2, from, except, desc) => {
|
|
10954
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10955
|
+
for (let key of __getOwnPropNames2(from))
|
|
10956
|
+
if (!__hasOwnProp2.call(to2, key) && key !== except)
|
|
10957
|
+
__defProp2(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
10958
|
+
}
|
|
10959
|
+
return to2;
|
|
10960
|
+
};
|
|
10961
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
10962
|
+
var src_exports2 = {};
|
|
10963
|
+
__export2(src_exports2, {
|
|
10964
|
+
createStandaloneLambda: () => createStandaloneLambda2,
|
|
10965
|
+
getBootstrapDir: () => getBootstrapDir,
|
|
10966
|
+
getProxyBinaryPath: () => getProxyBinaryPath
|
|
10967
|
+
});
|
|
10968
|
+
module2.exports = __toCommonJS2(src_exports2);
|
|
10969
|
+
var import_node_path10 = require("path");
|
|
10970
|
+
var import_node_fs7 = require("fs");
|
|
10971
|
+
var import_promises2 = require("fs/promises");
|
|
10972
|
+
var import_build_utils6 = require("@vercel/build-utils");
|
|
10973
|
+
function proxyBinaryName(architecture) {
|
|
10974
|
+
return architecture === "arm64" ? "proxy-linux-arm64" : "proxy-linux-amd64";
|
|
10975
|
+
}
|
|
10976
|
+
function getProxyBinaryPath(architecture) {
|
|
10977
|
+
const binPath = (0, import_node_path10.join)(__dirname, "..", "bin", proxyBinaryName(architecture));
|
|
10978
|
+
if (!(0, import_node_fs7.existsSync)(binPath)) {
|
|
10979
|
+
throw new Error(
|
|
10980
|
+
`IPC proxy binary not found for architecture "${architecture}" at ${binPath}. Ensure @vercel-internals/ipc-proxy has been built and its prebuilt binaries copied alongside the consumer's dist output.`
|
|
10981
|
+
);
|
|
10982
|
+
}
|
|
10983
|
+
return binPath;
|
|
10984
|
+
}
|
|
10985
|
+
function getBootstrapDir() {
|
|
10986
|
+
return (0, import_node_path10.join)(__dirname, "..", "bootstrap");
|
|
10987
|
+
}
|
|
10988
|
+
async function createStandaloneLambda2(options) {
|
|
10989
|
+
const {
|
|
10990
|
+
userServerPath,
|
|
10991
|
+
architecture,
|
|
10992
|
+
lambdaOptions,
|
|
10993
|
+
includedFiles,
|
|
10994
|
+
runtimeLanguage,
|
|
10995
|
+
supportsResponseStreaming = true
|
|
10996
|
+
} = options;
|
|
10997
|
+
const proxyPath = getProxyBinaryPath(architecture);
|
|
10998
|
+
const [proxyData, userServerData] = await Promise.all([
|
|
10999
|
+
(0, import_promises2.readFile)(proxyPath),
|
|
11000
|
+
(0, import_promises2.readFile)(userServerPath)
|
|
11001
|
+
]);
|
|
11002
|
+
return new import_build_utils6.Lambda({
|
|
11003
|
+
...lambdaOptions,
|
|
11004
|
+
files: {
|
|
11005
|
+
...includedFiles,
|
|
11006
|
+
executable: new import_build_utils6.FileBlob({ mode: 493, data: proxyData }),
|
|
11007
|
+
"user-server": new import_build_utils6.FileBlob({ mode: 493, data: userServerData })
|
|
11008
|
+
},
|
|
11009
|
+
handler: "executable",
|
|
11010
|
+
runtime: "executable",
|
|
11011
|
+
supportsResponseStreaming,
|
|
11012
|
+
architecture,
|
|
11013
|
+
runtimeLanguage
|
|
11014
|
+
});
|
|
11015
|
+
}
|
|
11016
|
+
}
|
|
11017
|
+
});
|
|
11018
|
+
|
|
10880
11019
|
// src/index.ts
|
|
10881
11020
|
var src_exports = {};
|
|
10882
11021
|
__export(src_exports, {
|
|
10883
11022
|
build: () => build,
|
|
10884
11023
|
detectEntrypoint: () => detectEntrypoint,
|
|
10885
11024
|
detectGoEntrypoint: () => detectGoEntrypoint,
|
|
11025
|
+
diagnostics: () => diagnostics,
|
|
10886
11026
|
getNewHandlerFunctionName: () => getNewHandlerFunctionName,
|
|
10887
11027
|
prepareCache: () => prepareCache,
|
|
10888
|
-
shouldServe: () =>
|
|
11028
|
+
shouldServe: () => import_build_utils5.shouldServe,
|
|
10889
11029
|
startDevServer: () => startDevServer,
|
|
10890
11030
|
version: () => version
|
|
10891
11031
|
});
|
|
@@ -10897,7 +11037,7 @@ var import_child_process2 = require("child_process");
|
|
|
10897
11037
|
var import_once = __toESM(require_dist());
|
|
10898
11038
|
var import_path7 = require("path");
|
|
10899
11039
|
var import_fs_extra4 = __toESM(require_lib2());
|
|
10900
|
-
var
|
|
11040
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
|
10901
11041
|
|
|
10902
11042
|
// src/go-helpers.ts
|
|
10903
11043
|
var import_crypto = require("crypto");
|
|
@@ -14120,6 +14260,7 @@ var wo = (s3) => {
|
|
|
14120
14260
|
var import_execa = __toESM(require_execa());
|
|
14121
14261
|
var import_node_fetch = __toESM(require_lib4());
|
|
14122
14262
|
var import_fs_extra = __toESM(require_lib2());
|
|
14263
|
+
var import_fs5 = __toESM(require("fs"));
|
|
14123
14264
|
var import_path4 = require("path");
|
|
14124
14265
|
var import_string_argv = __toESM(require_string_argv());
|
|
14125
14266
|
var import_build_utils = require("@vercel/build-utils");
|
|
@@ -14254,12 +14395,13 @@ Learn more: https://vercel.com/docs/functions/serverless-functions/runtimes/go
|
|
|
14254
14395
|
return JSON.parse(analyzed);
|
|
14255
14396
|
}
|
|
14256
14397
|
var GoWrapper = class {
|
|
14257
|
-
constructor(env, opts = {}) {
|
|
14398
|
+
constructor(env, opts = {}, resolvedVersion) {
|
|
14258
14399
|
if (!opts.cwd) {
|
|
14259
14400
|
opts.cwd = process.cwd();
|
|
14260
14401
|
}
|
|
14261
14402
|
this.env = env;
|
|
14262
14403
|
this.opts = opts;
|
|
14404
|
+
this.resolvedVersion = resolvedVersion;
|
|
14263
14405
|
}
|
|
14264
14406
|
async execute(...args) {
|
|
14265
14407
|
const { opts, env } = this;
|
|
@@ -14293,6 +14435,24 @@ var GoWrapper = class {
|
|
|
14293
14435
|
}
|
|
14294
14436
|
return this.execute(...args);
|
|
14295
14437
|
}
|
|
14438
|
+
/**
|
|
14439
|
+
* Runs `go mod edit -json <path>` and returns the parsed structure.
|
|
14440
|
+
*/
|
|
14441
|
+
async modEditJson(goModPath) {
|
|
14442
|
+
try {
|
|
14443
|
+
(0, import_build_utils.debug)(`Exec: go mod edit -json ${goModPath}`);
|
|
14444
|
+
const result = await (0, import_execa.default)("go", ["mod", "edit", "-json", goModPath], {
|
|
14445
|
+
...this.opts,
|
|
14446
|
+
env: this.env,
|
|
14447
|
+
extendEnv: false,
|
|
14448
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
14449
|
+
});
|
|
14450
|
+
return JSON.parse(result.stdout);
|
|
14451
|
+
} catch (err) {
|
|
14452
|
+
(0, import_build_utils.debug)(`Failed to read go.mod for manifest: ${err}`);
|
|
14453
|
+
return null;
|
|
14454
|
+
}
|
|
14455
|
+
}
|
|
14296
14456
|
vendor() {
|
|
14297
14457
|
return this.execute("mod", "vendor");
|
|
14298
14458
|
}
|
|
@@ -14306,6 +14466,9 @@ var GoWrapper = class {
|
|
|
14306
14466
|
}
|
|
14307
14467
|
return this.execute(...args);
|
|
14308
14468
|
}
|
|
14469
|
+
getEnv() {
|
|
14470
|
+
return this.env;
|
|
14471
|
+
}
|
|
14309
14472
|
build(src, dest, { vendorMode = false } = {}) {
|
|
14310
14473
|
(0, import_build_utils.debug)(`Building optimized 'go' binary ${src} -> ${dest}`);
|
|
14311
14474
|
const sources = Array.isArray(src) ? src : [src];
|
|
@@ -14407,7 +14570,7 @@ async function createGo({
|
|
|
14407
14570
|
if (version2 === goSelectedVersion || short === goSelectedVersion) {
|
|
14408
14571
|
(0, import_build_utils.debug)(`Selected go ${version2} (from ${label})`);
|
|
14409
14572
|
await setGoEnv(goDir);
|
|
14410
|
-
return new GoWrapper(env, opts);
|
|
14573
|
+
return new GoWrapper(env, opts, version2);
|
|
14411
14574
|
} else {
|
|
14412
14575
|
(0, import_build_utils.debug)(`Found go ${version2} in ${label}, but need ${goSelectedVersion}`);
|
|
14413
14576
|
}
|
|
@@ -14420,7 +14583,7 @@ async function createGo({
|
|
|
14420
14583
|
version: goSelectedVersion
|
|
14421
14584
|
});
|
|
14422
14585
|
await setGoEnv(goGlobalCacheDir);
|
|
14423
|
-
return new GoWrapper(env, opts);
|
|
14586
|
+
return new GoWrapper(env, opts, goSelectedVersion);
|
|
14424
14587
|
}
|
|
14425
14588
|
async function download({ dest, version: version2 }) {
|
|
14426
14589
|
const { filename, url } = getGoUrl(version2);
|
|
@@ -14499,6 +14662,83 @@ async function parseGoModVersionFromModule(modulePath) {
|
|
|
14499
14662
|
}
|
|
14500
14663
|
return version2;
|
|
14501
14664
|
}
|
|
14665
|
+
async function isElfBinary(filePath) {
|
|
14666
|
+
const fd = await import_fs5.default.promises.open(filePath, "r");
|
|
14667
|
+
try {
|
|
14668
|
+
const buf = new Uint8Array(4);
|
|
14669
|
+
await fd.read(buf, 0, 4, 0);
|
|
14670
|
+
return buf[0] === 127 && buf[1] === 69 && buf[2] === 76 && buf[3] === 70;
|
|
14671
|
+
} finally {
|
|
14672
|
+
await fd.close();
|
|
14673
|
+
}
|
|
14674
|
+
}
|
|
14675
|
+
async function getGoModuleName(goModPath) {
|
|
14676
|
+
try {
|
|
14677
|
+
const content = await (0, import_fs_extra.readFile)(goModPath, "utf8");
|
|
14678
|
+
const match = content.match(/^\s*module\s+(.+)$/m);
|
|
14679
|
+
if (match) {
|
|
14680
|
+
const modulePath = match[1].trim();
|
|
14681
|
+
return (0, import_path4.basename)(modulePath);
|
|
14682
|
+
}
|
|
14683
|
+
} catch {
|
|
14684
|
+
}
|
|
14685
|
+
return void 0;
|
|
14686
|
+
}
|
|
14687
|
+
async function findGoBinary(workPath, destPath, goModPath, buildStartTime) {
|
|
14688
|
+
if (await (0, import_fs_extra.pathExists)(destPath)) {
|
|
14689
|
+
return;
|
|
14690
|
+
}
|
|
14691
|
+
const moduleName = goModPath ? await getGoModuleName(goModPath) : void 0;
|
|
14692
|
+
const candidates = [moduleName, "server", "app", "main", "api"].filter(
|
|
14693
|
+
(c) => Boolean(c)
|
|
14694
|
+
);
|
|
14695
|
+
for (const name of candidates) {
|
|
14696
|
+
const p2 = (0, import_path4.join)(workPath, name);
|
|
14697
|
+
if (await (0, import_fs_extra.pathExists)(p2)) {
|
|
14698
|
+
const stat = await import_fs5.default.promises.stat(p2);
|
|
14699
|
+
if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
|
|
14700
|
+
(0, import_build_utils.debug)(`Found Go binary: ${name}`);
|
|
14701
|
+
await (0, import_fs_extra.copy)(p2, destPath);
|
|
14702
|
+
return;
|
|
14703
|
+
}
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14706
|
+
const found = [];
|
|
14707
|
+
const entries = await import_fs5.default.promises.readdir(workPath);
|
|
14708
|
+
for (const entry of entries) {
|
|
14709
|
+
if (candidates.includes(entry))
|
|
14710
|
+
continue;
|
|
14711
|
+
const p2 = (0, import_path4.join)(workPath, entry);
|
|
14712
|
+
const stat = await import_fs5.default.promises.stat(p2);
|
|
14713
|
+
if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
|
|
14714
|
+
found.push(entry);
|
|
14715
|
+
}
|
|
14716
|
+
}
|
|
14717
|
+
const binDir = (0, import_path4.join)(workPath, "bin");
|
|
14718
|
+
if (await (0, import_fs_extra.pathExists)(binDir)) {
|
|
14719
|
+
const binEntries = await import_fs5.default.promises.readdir(binDir);
|
|
14720
|
+
for (const entry of binEntries) {
|
|
14721
|
+
const p2 = (0, import_path4.join)(binDir, entry);
|
|
14722
|
+
const stat = await import_fs5.default.promises.stat(p2);
|
|
14723
|
+
if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
|
|
14724
|
+
found.push((0, import_path4.join)("bin", entry));
|
|
14725
|
+
}
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
if (found.length === 1) {
|
|
14729
|
+
(0, import_build_utils.debug)(`Found Go binary: ${found[0]}`);
|
|
14730
|
+
await (0, import_fs_extra.copy)((0, import_path4.join)(workPath, found[0]), destPath);
|
|
14731
|
+
return;
|
|
14732
|
+
}
|
|
14733
|
+
if (found.length > 1) {
|
|
14734
|
+
throw new Error(
|
|
14735
|
+
`Found multiple ELF binaries after buildCommand: ${found.join(", ")}. Use \`go build -o $VERCEL_OUTPUT_FILE\` to specify which binary to deploy.`
|
|
14736
|
+
);
|
|
14737
|
+
}
|
|
14738
|
+
throw new Error(
|
|
14739
|
+
"No compiled Go binary found after buildCommand. Ensure your command produces a Linux binary (GOOS=linux is set), or use `go build -o $VERCEL_OUTPUT_FILE`."
|
|
14740
|
+
);
|
|
14741
|
+
}
|
|
14502
14742
|
function parseGoModVersion(content) {
|
|
14503
14743
|
const goMatches = /^\s*go\s+(\d+)\.(\d+)(?:\.(\d+))?\s*(?:\/\/.*)?$/gm.exec(
|
|
14504
14744
|
content
|
|
@@ -14566,7 +14806,93 @@ var detectEntrypoint = async ({ workPath }) => {
|
|
|
14566
14806
|
var import_child_process = require("child_process");
|
|
14567
14807
|
var import_path6 = require("path");
|
|
14568
14808
|
var import_fs_extra3 = __toESM(require_lib2());
|
|
14809
|
+
var import_build_utils4 = require("@vercel/build-utils");
|
|
14810
|
+
var import_ipc_proxy = __toESM(require_dist2());
|
|
14811
|
+
|
|
14812
|
+
// src/diagnostics.ts
|
|
14569
14813
|
var import_build_utils3 = require("@vercel/build-utils");
|
|
14814
|
+
function applyReplaces(goMod) {
|
|
14815
|
+
const requires = goMod.Require ?? [];
|
|
14816
|
+
const replaces = goMod.Replace ?? [];
|
|
14817
|
+
const result = [];
|
|
14818
|
+
for (const req of requires) {
|
|
14819
|
+
const specific = replaces.find(
|
|
14820
|
+
(r) => r.Old.Path === req.Path && r.Old.Version === req.Version
|
|
14821
|
+
);
|
|
14822
|
+
const wildcard = replaces.find(
|
|
14823
|
+
(r) => r.Old.Path === req.Path && r.Old.Version === void 0
|
|
14824
|
+
);
|
|
14825
|
+
const rule = specific ?? wildcard;
|
|
14826
|
+
const indirect = req.Indirect === true;
|
|
14827
|
+
if (!rule) {
|
|
14828
|
+
result.push({ name: req.Path, version: req.Version, indirect });
|
|
14829
|
+
continue;
|
|
14830
|
+
}
|
|
14831
|
+
if (rule.New.Version === void 0) {
|
|
14832
|
+
continue;
|
|
14833
|
+
}
|
|
14834
|
+
result.push({
|
|
14835
|
+
name: rule.New.Path,
|
|
14836
|
+
version: rule.New.Version,
|
|
14837
|
+
indirect
|
|
14838
|
+
});
|
|
14839
|
+
}
|
|
14840
|
+
return result;
|
|
14841
|
+
}
|
|
14842
|
+
async function generateProjectManifest({
|
|
14843
|
+
workPath,
|
|
14844
|
+
goModJson,
|
|
14845
|
+
resolvedGoVersion,
|
|
14846
|
+
framework,
|
|
14847
|
+
serviceType
|
|
14848
|
+
}) {
|
|
14849
|
+
try {
|
|
14850
|
+
if (!goModJson)
|
|
14851
|
+
return;
|
|
14852
|
+
const projectModule = goModJson.Module?.Path;
|
|
14853
|
+
const modules = applyReplaces(goModJson).filter(
|
|
14854
|
+
(m2) => m2.name !== projectModule
|
|
14855
|
+
);
|
|
14856
|
+
const requested = goModJson.Go;
|
|
14857
|
+
const directDeps = [];
|
|
14858
|
+
const transitiveDeps = [];
|
|
14859
|
+
for (const mod of modules) {
|
|
14860
|
+
const dep = {
|
|
14861
|
+
name: mod.name,
|
|
14862
|
+
type: mod.indirect ? "transitive" : "direct",
|
|
14863
|
+
scopes: ["prod"],
|
|
14864
|
+
requested: mod.version,
|
|
14865
|
+
resolved: mod.version,
|
|
14866
|
+
source: "registry",
|
|
14867
|
+
sourceUrl: "https://proxy.golang.org"
|
|
14868
|
+
};
|
|
14869
|
+
if (mod.indirect) {
|
|
14870
|
+
transitiveDeps.push(dep);
|
|
14871
|
+
} else {
|
|
14872
|
+
directDeps.push(dep);
|
|
14873
|
+
}
|
|
14874
|
+
}
|
|
14875
|
+
const manifest = {
|
|
14876
|
+
version: import_build_utils3.MANIFEST_VERSION,
|
|
14877
|
+
runtime: "go",
|
|
14878
|
+
...framework ? { framework } : {},
|
|
14879
|
+
...serviceType ? { serviceType } : {},
|
|
14880
|
+
runtimeVersion: {
|
|
14881
|
+
...requested ? { requested } : {},
|
|
14882
|
+
resolved: resolvedGoVersion
|
|
14883
|
+
},
|
|
14884
|
+
dependencies: [
|
|
14885
|
+
...directDeps.sort((a, b2) => a.name.localeCompare(b2.name)),
|
|
14886
|
+
...transitiveDeps.sort((a, b2) => a.name.localeCompare(b2.name))
|
|
14887
|
+
]
|
|
14888
|
+
};
|
|
14889
|
+
await (0, import_build_utils3.writeProjectManifest)(manifest, workPath, "go");
|
|
14890
|
+
} catch {
|
|
14891
|
+
}
|
|
14892
|
+
}
|
|
14893
|
+
var diagnostics = (0, import_build_utils3.createDiagnostics)("go");
|
|
14894
|
+
|
|
14895
|
+
// src/standalone-server.ts
|
|
14570
14896
|
async function findGoModPath(entrypointDir, workPath) {
|
|
14571
14897
|
let goModPath = void 0;
|
|
14572
14898
|
let isGoModInRootDir = false;
|
|
@@ -14576,7 +14902,7 @@ async function findGoModPath(entrypointDir, workPath) {
|
|
|
14576
14902
|
const goMod = (0, import_path6.join)(dir, "go.mod");
|
|
14577
14903
|
if (await (0, import_fs_extra3.pathExists)(goMod)) {
|
|
14578
14904
|
goModPath = goMod;
|
|
14579
|
-
(0,
|
|
14905
|
+
(0, import_build_utils4.debug)(`Found ${goModPath}"`);
|
|
14580
14906
|
break;
|
|
14581
14907
|
}
|
|
14582
14908
|
dir = (0, import_path6.dirname)(dir);
|
|
@@ -14591,16 +14917,18 @@ async function buildStandaloneServer({
|
|
|
14591
14917
|
entrypoint,
|
|
14592
14918
|
config,
|
|
14593
14919
|
workPath,
|
|
14594
|
-
meta = {}
|
|
14920
|
+
meta = {},
|
|
14921
|
+
registerPreDeploy,
|
|
14922
|
+
service
|
|
14595
14923
|
}) {
|
|
14596
|
-
(0,
|
|
14597
|
-
await (0,
|
|
14598
|
-
const lambdaOptions = await (0,
|
|
14924
|
+
(0, import_build_utils4.debug)(`Building standalone Go server: ${entrypoint}`);
|
|
14925
|
+
await (0, import_build_utils4.download)(files, workPath, meta);
|
|
14926
|
+
const lambdaOptions = await (0, import_build_utils4.getLambdaOptionsFromFunction)({
|
|
14599
14927
|
sourceFile: entrypoint,
|
|
14600
14928
|
config
|
|
14601
14929
|
});
|
|
14602
14930
|
const architecture = lambdaOptions?.architecture || "x86_64";
|
|
14603
|
-
const env = (0,
|
|
14931
|
+
const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
|
|
14604
14932
|
GOARCH: architecture === "arm64" ? "arm64" : "amd64",
|
|
14605
14933
|
GOOS: "linux",
|
|
14606
14934
|
CGO_ENABLED: "0"
|
|
@@ -14612,94 +14940,84 @@ async function buildStandaloneServer({
|
|
|
14612
14940
|
opts: { cwd: workPath, env },
|
|
14613
14941
|
workPath
|
|
14614
14942
|
});
|
|
14615
|
-
const outDir = await (0,
|
|
14943
|
+
const outDir = await (0, import_build_utils4.getWriteableDirectory)();
|
|
14616
14944
|
const userServerPath = (0, import_path6.join)(outDir, "user-server");
|
|
14617
|
-
const bootstrapPath = (0, import_path6.join)(outDir, "executable");
|
|
14618
14945
|
const vendorModulesPath = (0, import_path6.join)(workPath, "vendor", "modules.txt");
|
|
14619
14946
|
const isVendored = await (0, import_fs_extra3.pathExists)(vendorModulesPath);
|
|
14620
14947
|
if (isVendored) {
|
|
14621
|
-
(0,
|
|
14622
|
-
}
|
|
14623
|
-
const
|
|
14624
|
-
(
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
console.error(`Failed to build standalone Go server: ${buildTarget}`);
|
|
14631
|
-
throw err;
|
|
14632
|
-
}
|
|
14633
|
-
const bootstrapDir = (0, import_path6.join)(__dirname, "../bootstrap");
|
|
14634
|
-
const bootstrapSrc = (0, import_path6.join)(bootstrapDir, "vc-init.go");
|
|
14635
|
-
const utilsSrc = (0, import_path6.join)(bootstrapDir, "vc-utils.go");
|
|
14636
|
-
const bootstrapGoModSrc = (0, import_path6.join)(bootstrapDir, "go.mod");
|
|
14637
|
-
(0, import_build_utils3.debug)(`Building bootstrap wrapper: ${bootstrapSrc} -> ${bootstrapPath}`);
|
|
14638
|
-
try {
|
|
14639
|
-
const bootstrapBuildDir = await (0, import_build_utils3.getWriteableDirectory)();
|
|
14640
|
-
const bootstrapGoFile = (0, import_path6.join)(bootstrapBuildDir, "main.go");
|
|
14641
|
-
await (0, import_fs_extra3.copy)(bootstrapSrc, bootstrapGoFile);
|
|
14642
|
-
await (0, import_fs_extra3.copy)(utilsSrc, (0, import_path6.join)(bootstrapBuildDir, "vc-utils.go"));
|
|
14643
|
-
await (0, import_fs_extra3.copy)(bootstrapGoModSrc, (0, import_path6.join)(bootstrapBuildDir, "go.mod"));
|
|
14644
|
-
const bootstrapEnv = {
|
|
14645
|
-
PATH: process.env.PATH || "",
|
|
14646
|
-
HOME: process.env.HOME || "",
|
|
14647
|
-
TMPDIR: process.env.TMPDIR || "",
|
|
14648
|
-
GOARCH: architecture === "arm64" ? "arm64" : "amd64",
|
|
14649
|
-
GOOS: "linux",
|
|
14650
|
-
CGO_ENABLED: "0"
|
|
14651
|
-
};
|
|
14652
|
-
const bootstrapGo = await createGo({
|
|
14653
|
-
modulePath: bootstrapBuildDir,
|
|
14654
|
-
opts: { cwd: bootstrapBuildDir, env: bootstrapEnv },
|
|
14655
|
-
workPath: bootstrapBuildDir
|
|
14948
|
+
(0, import_build_utils4.debug)("Detected vendor directory, using -mod=vendor for build");
|
|
14949
|
+
}
|
|
14950
|
+
const buildCommand = config?.buildCommand ?? config?.projectSettings?.buildCommand ?? void 0;
|
|
14951
|
+
if (typeof buildCommand === "string") {
|
|
14952
|
+
(0, import_build_utils4.debug)(`Running custom build command: ${buildCommand}`);
|
|
14953
|
+
const buildStartTime = Date.now();
|
|
14954
|
+
await (0, import_build_utils4.execCommand)(buildCommand, {
|
|
14955
|
+
env: { ...go.getEnv(), VERCEL_OUTPUT_FILE: userServerPath },
|
|
14956
|
+
cwd: workPath
|
|
14656
14957
|
});
|
|
14657
|
-
await
|
|
14658
|
-
}
|
|
14659
|
-
|
|
14660
|
-
|
|
14958
|
+
await findGoBinary(workPath, userServerPath, goModPath, buildStartTime);
|
|
14959
|
+
} else {
|
|
14960
|
+
const buildTarget = entrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(entrypoint);
|
|
14961
|
+
(0, import_build_utils4.debug)(
|
|
14962
|
+
`Building user Go server (${architecture}): go build ${buildTarget} -> ${userServerPath}`
|
|
14963
|
+
);
|
|
14964
|
+
try {
|
|
14965
|
+
await go.build(buildTarget, userServerPath, { vendorMode: isVendored });
|
|
14966
|
+
} catch (err) {
|
|
14967
|
+
console.error(`Failed to build standalone Go server: ${buildTarget}`);
|
|
14968
|
+
throw err;
|
|
14969
|
+
}
|
|
14661
14970
|
}
|
|
14662
14971
|
const includedFiles = {};
|
|
14663
14972
|
if (config && config.includeFiles) {
|
|
14664
14973
|
const patterns = Array.isArray(config.includeFiles) ? config.includeFiles : [config.includeFiles];
|
|
14665
14974
|
for (const pattern of patterns) {
|
|
14666
|
-
const fsFiles = await (0,
|
|
14975
|
+
const fsFiles = await (0, import_build_utils4.glob)(pattern, workPath);
|
|
14667
14976
|
for (const [assetName, asset] of Object.entries(fsFiles)) {
|
|
14668
14977
|
includedFiles[assetName] = asset;
|
|
14669
14978
|
}
|
|
14670
14979
|
}
|
|
14671
14980
|
}
|
|
14672
|
-
const
|
|
14673
|
-
|
|
14674
|
-
(0, import_fs_extra3.readFile)(bootstrapPath)
|
|
14675
|
-
]);
|
|
14676
|
-
const lambda = new import_build_utils3.Lambda({
|
|
14677
|
-
...lambdaOptions,
|
|
14678
|
-
files: {
|
|
14679
|
-
...includedFiles,
|
|
14680
|
-
// Bootstrap is the main entrypoint (handles IPC protocol)
|
|
14681
|
-
executable: new import_build_utils3.FileBlob({ mode: 493, data: bootstrapData }),
|
|
14682
|
-
// User's server is spawned by bootstrap
|
|
14683
|
-
"user-server": new import_build_utils3.FileBlob({ mode: 493, data: userServerData })
|
|
14684
|
-
},
|
|
14685
|
-
handler: "executable",
|
|
14686
|
-
runtime: "executable",
|
|
14687
|
-
supportsResponseStreaming: true,
|
|
14981
|
+
const lambda = await (0, import_ipc_proxy.createStandaloneLambda)({
|
|
14982
|
+
userServerPath,
|
|
14688
14983
|
architecture,
|
|
14689
|
-
|
|
14984
|
+
lambdaOptions,
|
|
14985
|
+
includedFiles,
|
|
14986
|
+
runtimeLanguage: "go",
|
|
14987
|
+
supportsResponseStreaming: true
|
|
14988
|
+
});
|
|
14989
|
+
const preDeployCommand = config?.preDeployCommand;
|
|
14990
|
+
if (registerPreDeploy && typeof preDeployCommand === "string") {
|
|
14991
|
+
const capturedEnv = { ...env };
|
|
14992
|
+
const capturedCwd = workPath;
|
|
14993
|
+
registerPreDeploy(async () => {
|
|
14994
|
+
(0, import_build_utils4.debug)(`Running pre-deploy command: \`${preDeployCommand}\``);
|
|
14995
|
+
await (0, import_build_utils4.execCommand)(preDeployCommand, {
|
|
14996
|
+
env: capturedEnv,
|
|
14997
|
+
cwd: capturedCwd
|
|
14998
|
+
});
|
|
14999
|
+
});
|
|
15000
|
+
}
|
|
15001
|
+
const goModJson = goModPath ? await go.modEditJson(goModPath) : null;
|
|
15002
|
+
await generateProjectManifest({
|
|
15003
|
+
workPath,
|
|
15004
|
+
goModJson,
|
|
15005
|
+
resolvedGoVersion: go.resolvedVersion,
|
|
15006
|
+
framework: config.framework ?? void 0,
|
|
15007
|
+
serviceType: service ? (0, import_build_utils4.getReportedServiceType)(service) : void 0
|
|
14690
15008
|
});
|
|
14691
15009
|
return { output: lambda };
|
|
14692
15010
|
}
|
|
14693
15011
|
async function startStandaloneDevServer(opts, resolvedEntrypoint) {
|
|
14694
15012
|
const { workPath, meta = {} } = opts;
|
|
14695
15013
|
const port = Math.floor(Math.random() * (65535 - 49152) + 49152);
|
|
14696
|
-
const env = (0,
|
|
15014
|
+
const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
|
|
14697
15015
|
PORT: String(port)
|
|
14698
15016
|
});
|
|
14699
15017
|
const runTarget = resolvedEntrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(resolvedEntrypoint);
|
|
14700
15018
|
const devWrapper = (0, import_path6.join)(__dirname, "../bootstrap/vc-init-dev.go");
|
|
14701
|
-
const devUtils = (0, import_path6.join)(__dirname, "../bootstrap/
|
|
14702
|
-
(0,
|
|
15019
|
+
const devUtils = (0, import_path6.join)(__dirname, "../bootstrap/utils.go");
|
|
15020
|
+
(0, import_build_utils4.debug)(
|
|
14703
15021
|
`Starting standalone Go dev server wrapper: go run ${devWrapper} (target ${runTarget}, port ${port})`
|
|
14704
15022
|
);
|
|
14705
15023
|
const child = (0, import_child_process.spawn)("go", ["run", "-tags", "vcdev", devWrapper, devUtils], {
|
|
@@ -14769,31 +15087,38 @@ function getRenamedEntrypoint(entrypoint) {
|
|
|
14769
15087
|
const filename = (0, import_path7.basename)(entrypoint);
|
|
14770
15088
|
if (filename.startsWith("[")) {
|
|
14771
15089
|
const newEntrypoint = entrypoint.replace("/[", "/now-bracket[");
|
|
14772
|
-
(0,
|
|
15090
|
+
(0, import_build_utils5.debug)(`Renamed entrypoint from ${entrypoint} to ${newEntrypoint}`);
|
|
14773
15091
|
return newEntrypoint;
|
|
14774
15092
|
}
|
|
14775
15093
|
return void 0;
|
|
14776
15094
|
}
|
|
14777
15095
|
var version = 3;
|
|
14778
15096
|
async function build(options) {
|
|
14779
|
-
const {
|
|
15097
|
+
const {
|
|
15098
|
+
files,
|
|
15099
|
+
config,
|
|
15100
|
+
workPath,
|
|
15101
|
+
meta = {},
|
|
15102
|
+
service,
|
|
15103
|
+
registerPreDeploy
|
|
15104
|
+
} = options;
|
|
14780
15105
|
let { entrypoint } = options;
|
|
14781
|
-
const goPath = await (0,
|
|
15106
|
+
const goPath = await (0, import_build_utils5.getWriteableDirectory)();
|
|
14782
15107
|
const srcPath = (0, import_path7.join)(goPath, "src", "lambda");
|
|
14783
15108
|
const downloadPath = meta.skipDownload ? workPath : srcPath;
|
|
14784
|
-
await (0,
|
|
15109
|
+
await (0, import_build_utils5.download)(files, downloadPath, meta);
|
|
14785
15110
|
const undo = {
|
|
14786
15111
|
fileActions: [],
|
|
14787
15112
|
directoryCreation: [],
|
|
14788
15113
|
functionRenames: []
|
|
14789
15114
|
};
|
|
14790
|
-
const env = (0,
|
|
15115
|
+
const env = (0, import_build_utils5.cloneEnv)(process.env, meta.env, {
|
|
14791
15116
|
GOARCH: "amd64",
|
|
14792
15117
|
GOOS: "linux"
|
|
14793
15118
|
});
|
|
14794
15119
|
try {
|
|
14795
15120
|
if (env.GIT_CREDENTIALS) {
|
|
14796
|
-
(0,
|
|
15121
|
+
(0, import_build_utils5.debug)("Initialize Git credentials...");
|
|
14797
15122
|
await initPrivateGit(env.GIT_CREDENTIALS);
|
|
14798
15123
|
}
|
|
14799
15124
|
if (env.GO111MODULE) {
|
|
@@ -14815,7 +15140,7 @@ Manually assigning 'GO111MODULE' is not recommended.
|
|
|
14815
15140
|
`No Go entrypoint found. Expected one of: ${GO_CANDIDATE_ENTRYPOINTS.join(", ")}`
|
|
14816
15141
|
);
|
|
14817
15142
|
}
|
|
14818
|
-
(0,
|
|
15143
|
+
(0, import_build_utils5.debug)(`Using standalone Go server mode for ${resolvedEntrypoint}`);
|
|
14819
15144
|
return buildStandaloneServer({
|
|
14820
15145
|
...options,
|
|
14821
15146
|
entrypoint: resolvedEntrypoint
|
|
@@ -14868,7 +15193,7 @@ Manually assigning 'GO111MODULE' is not recommended.
|
|
|
14868
15193
|
if (config && config.includeFiles) {
|
|
14869
15194
|
const patterns = Array.isArray(config.includeFiles) ? config.includeFiles : [config.includeFiles];
|
|
14870
15195
|
for (const pattern of patterns) {
|
|
14871
|
-
const fsFiles = await (0,
|
|
15196
|
+
const fsFiles = await (0, import_build_utils5.glob)(pattern, entrypointDirname);
|
|
14872
15197
|
for (const [assetName, asset] of Object.entries(fsFiles)) {
|
|
14873
15198
|
includedFiles[assetName] = asset;
|
|
14874
15199
|
}
|
|
@@ -14883,7 +15208,15 @@ Manually assigning 'GO111MODULE' is not recommended.
|
|
|
14883
15208
|
},
|
|
14884
15209
|
workPath
|
|
14885
15210
|
});
|
|
14886
|
-
const
|
|
15211
|
+
const goModJson = goModPath ? await go.modEditJson(goModPath) : null;
|
|
15212
|
+
await generateProjectManifest({
|
|
15213
|
+
workPath,
|
|
15214
|
+
goModJson,
|
|
15215
|
+
resolvedGoVersion: go.resolvedVersion,
|
|
15216
|
+
framework: config.framework ?? void 0,
|
|
15217
|
+
serviceType: service ? (0, import_build_utils5.getReportedServiceType)(service) : void 0
|
|
15218
|
+
});
|
|
15219
|
+
const outDir = await (0, import_build_utils5.getWriteableDirectory)();
|
|
14887
15220
|
const buildOptions = {
|
|
14888
15221
|
downloadPath,
|
|
14889
15222
|
entrypoint,
|
|
@@ -14902,20 +15235,32 @@ Manually assigning 'GO111MODULE' is not recommended.
|
|
|
14902
15235
|
} else {
|
|
14903
15236
|
await buildHandlerWithGoMod(buildOptions);
|
|
14904
15237
|
}
|
|
14905
|
-
const runtime = await (0,
|
|
14906
|
-
const lambda = new
|
|
14907
|
-
files: { ...await (0,
|
|
15238
|
+
const runtime = await (0, import_build_utils5.getProvidedRuntime)();
|
|
15239
|
+
const lambda = new import_build_utils5.Lambda({
|
|
15240
|
+
files: { ...await (0, import_build_utils5.glob)("**", outDir), ...includedFiles },
|
|
14908
15241
|
handler: HANDLER_FILENAME,
|
|
14909
15242
|
runtime,
|
|
14910
15243
|
runtimeLanguage: "go",
|
|
14911
15244
|
supportsWrapper: true,
|
|
14912
15245
|
environment: {}
|
|
14913
15246
|
});
|
|
15247
|
+
const preDeployCommand = config?.preDeployCommand;
|
|
15248
|
+
if (registerPreDeploy && typeof preDeployCommand === "string") {
|
|
15249
|
+
const capturedEnv = { ...env };
|
|
15250
|
+
const capturedCwd = workPath;
|
|
15251
|
+
registerPreDeploy(async () => {
|
|
15252
|
+
(0, import_build_utils5.debug)(`Running pre-deploy command: \`${preDeployCommand}\``);
|
|
15253
|
+
await (0, import_build_utils5.execCommand)(preDeployCommand, {
|
|
15254
|
+
env: capturedEnv,
|
|
15255
|
+
cwd: capturedCwd
|
|
15256
|
+
});
|
|
15257
|
+
});
|
|
15258
|
+
}
|
|
14914
15259
|
return {
|
|
14915
15260
|
output: lambda
|
|
14916
15261
|
};
|
|
14917
15262
|
} catch (error) {
|
|
14918
|
-
(0,
|
|
15263
|
+
(0, import_build_utils5.debug)(`Go Builder Error: ${error}`);
|
|
14919
15264
|
throw error;
|
|
14920
15265
|
} finally {
|
|
14921
15266
|
try {
|
|
@@ -14924,7 +15269,7 @@ Manually assigning 'GO111MODULE' is not recommended.
|
|
|
14924
15269
|
if (error instanceof Error) {
|
|
14925
15270
|
console.error(`Build cleanup failed: ${error.message}`);
|
|
14926
15271
|
}
|
|
14927
|
-
(0,
|
|
15272
|
+
(0, import_build_utils5.debug)("Cleanup Error: " + error);
|
|
14928
15273
|
}
|
|
14929
15274
|
}
|
|
14930
15275
|
}
|
|
@@ -14941,7 +15286,7 @@ async function buildHandlerWithGoMod({
|
|
|
14941
15286
|
packageName,
|
|
14942
15287
|
undo
|
|
14943
15288
|
}) {
|
|
14944
|
-
(0,
|
|
15289
|
+
(0, import_build_utils5.debug)(
|
|
14945
15290
|
`Building Go handler as package "${packageName}" (with${goModPath ? "" : "out"} go.mod)`
|
|
14946
15291
|
);
|
|
14947
15292
|
let goModDirname;
|
|
@@ -14970,7 +15315,7 @@ async function buildHandlerWithGoMod({
|
|
|
14970
15315
|
);
|
|
14971
15316
|
const isVendored = await (0, import_fs_extra4.pathExists)(vendorModulesPath);
|
|
14972
15317
|
if (isVendored) {
|
|
14973
|
-
(0,
|
|
15318
|
+
(0, import_build_utils5.debug)("Detected vendor directory in project");
|
|
14974
15319
|
const vendorModulesBackup = vendorModulesPath + ".bak";
|
|
14975
15320
|
await (0, import_fs_extra4.copy)(vendorModulesPath, vendorModulesBackup);
|
|
14976
15321
|
undo.fileActions.push({
|
|
@@ -14987,13 +15332,13 @@ async function buildHandlerWithGoMod({
|
|
|
14987
15332
|
}
|
|
14988
15333
|
let mainGoFile;
|
|
14989
15334
|
if (goModPath && isGoModInRootDir) {
|
|
14990
|
-
(0,
|
|
15335
|
+
(0, import_build_utils5.debug)(`[mod-root] Write main file to ${downloadPath}`);
|
|
14991
15336
|
mainGoFile = (0, import_path7.join)(downloadPath, MAIN_GO_FILENAME);
|
|
14992
15337
|
} else if (goModDirname && !isGoModInRootDir) {
|
|
14993
|
-
(0,
|
|
15338
|
+
(0, import_build_utils5.debug)(`[mod-other] Write main file to ${goModDirname}`);
|
|
14994
15339
|
mainGoFile = (0, import_path7.join)(goModDirname, MAIN_GO_FILENAME);
|
|
14995
15340
|
} else {
|
|
14996
|
-
(0,
|
|
15341
|
+
(0, import_build_utils5.debug)(`[entrypoint] Write main file to ${entrypointDirname}`);
|
|
14997
15342
|
mainGoFile = (0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME);
|
|
14998
15343
|
}
|
|
14999
15344
|
await Promise.all([
|
|
@@ -15019,7 +15364,7 @@ async function buildHandlerWithGoMod({
|
|
|
15019
15364
|
);
|
|
15020
15365
|
}
|
|
15021
15366
|
if (!goModPath || (0, import_path7.dirname)(entrypointAbsolute) === (0, import_path7.dirname)(goModPath)) {
|
|
15022
|
-
(0,
|
|
15367
|
+
(0, import_build_utils5.debug)(
|
|
15023
15368
|
`moving entrypoint "${entrypointAbsolute}" to "${finalDestination}"`
|
|
15024
15369
|
);
|
|
15025
15370
|
await (0, import_fs_extra4.move)(entrypointAbsolute, finalDestination);
|
|
@@ -15041,7 +15386,7 @@ async function buildHandlerWithGoMod({
|
|
|
15041
15386
|
} else {
|
|
15042
15387
|
baseGoModPath = entrypointDirname;
|
|
15043
15388
|
}
|
|
15044
|
-
(0,
|
|
15389
|
+
(0, import_build_utils5.debug)("Tidy `go.mod` file...");
|
|
15045
15390
|
try {
|
|
15046
15391
|
await go.mod({ tolerateErrors: isVendored });
|
|
15047
15392
|
} catch (err) {
|
|
@@ -15049,7 +15394,7 @@ async function buildHandlerWithGoMod({
|
|
|
15049
15394
|
throw err;
|
|
15050
15395
|
}
|
|
15051
15396
|
if (isVendored) {
|
|
15052
|
-
(0,
|
|
15397
|
+
(0, import_build_utils5.debug)("Regenerating vendor directory after go.mod rewrite...");
|
|
15053
15398
|
try {
|
|
15054
15399
|
await go.vendor();
|
|
15055
15400
|
} catch (err) {
|
|
@@ -15057,7 +15402,7 @@ async function buildHandlerWithGoMod({
|
|
|
15057
15402
|
throw err;
|
|
15058
15403
|
}
|
|
15059
15404
|
}
|
|
15060
|
-
(0,
|
|
15405
|
+
(0, import_build_utils5.debug)("Running `go build`...");
|
|
15061
15406
|
const destPath = (0, import_path7.join)(outDir, HANDLER_FILENAME);
|
|
15062
15407
|
try {
|
|
15063
15408
|
const src = [(0, import_path7.join)(baseGoModPath, MAIN_GO_FILENAME)];
|
|
@@ -15075,7 +15420,7 @@ async function buildHandlerAsPackageMain({
|
|
|
15075
15420
|
outDir,
|
|
15076
15421
|
undo
|
|
15077
15422
|
}) {
|
|
15078
|
-
(0,
|
|
15423
|
+
(0, import_build_utils5.debug)('Building Go handler as package "main" (legacy)');
|
|
15079
15424
|
await writeEntrypoint(
|
|
15080
15425
|
(0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME),
|
|
15081
15426
|
"",
|
|
@@ -15086,14 +15431,14 @@ async function buildHandlerAsPackageMain({
|
|
|
15086
15431
|
// delete
|
|
15087
15432
|
from: (0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME)
|
|
15088
15433
|
});
|
|
15089
|
-
(0,
|
|
15434
|
+
(0, import_build_utils5.debug)("Running `go get`...");
|
|
15090
15435
|
try {
|
|
15091
15436
|
await go.get();
|
|
15092
15437
|
} catch (err) {
|
|
15093
15438
|
console.error("Failed to `go get`");
|
|
15094
15439
|
throw err;
|
|
15095
15440
|
}
|
|
15096
|
-
(0,
|
|
15441
|
+
(0, import_build_utils5.debug)("Running `go build`...");
|
|
15097
15442
|
const destPath = (0, import_path7.join)(outDir, HANDLER_FILENAME);
|
|
15098
15443
|
try {
|
|
15099
15444
|
const src = [
|
|
@@ -15123,10 +15468,10 @@ function getNewHandlerFunctionName(originalFunctionName, entrypoint) {
|
|
|
15123
15468
|
"Handler function renaming failed because entrypoint was empty."
|
|
15124
15469
|
);
|
|
15125
15470
|
}
|
|
15126
|
-
(0,
|
|
15471
|
+
(0, import_build_utils5.debug)(`Found exported function "${originalFunctionName}" in "${entrypoint}"`);
|
|
15127
15472
|
const pathSlug = entrypoint.replace(/(\s|\\|\/|\]|\[|-|\.)/g, "_");
|
|
15128
15473
|
const newHandlerName = `${originalFunctionName}_${pathSlug}`;
|
|
15129
|
-
(0,
|
|
15474
|
+
(0, import_build_utils5.debug)(
|
|
15130
15475
|
`Renaming handler function temporarily from "${originalFunctionName}" to "${newHandlerName}"`
|
|
15131
15476
|
);
|
|
15132
15477
|
return newHandlerName;
|
|
@@ -15164,7 +15509,7 @@ async function findGoModPath2(entrypointDir, workPath) {
|
|
|
15164
15509
|
const goMod = (0, import_path7.join)(dir, "go.mod");
|
|
15165
15510
|
if (await (0, import_fs_extra4.pathExists)(goMod)) {
|
|
15166
15511
|
goModPath = goMod;
|
|
15167
|
-
(0,
|
|
15512
|
+
(0, import_build_utils5.debug)(`Found ${goModPath}"`);
|
|
15168
15513
|
break;
|
|
15169
15514
|
}
|
|
15170
15515
|
dir = (0, import_path7.dirname)(dir);
|
|
@@ -15244,7 +15589,7 @@ async function writeGoMod({
|
|
|
15244
15589
|
}
|
|
15245
15590
|
}
|
|
15246
15591
|
const destGoModPath = (0, import_path7.join)(destDir, "go.mod");
|
|
15247
|
-
(0,
|
|
15592
|
+
(0, import_build_utils5.debug)(`Writing ${destGoModPath}`);
|
|
15248
15593
|
await (0, import_fs_extra4.writeFile)(destGoModPath, contents, "utf-8");
|
|
15249
15594
|
}
|
|
15250
15595
|
async function findGoWorkFile(goWorkDir, workPath) {
|
|
@@ -15361,7 +15706,7 @@ async function startDevServer(opts) {
|
|
|
15361
15706
|
TMP,
|
|
15362
15707
|
`vercel-dev-port-${Math.random().toString(32).substring(2)}`
|
|
15363
15708
|
);
|
|
15364
|
-
const env = (0,
|
|
15709
|
+
const env = (0, import_build_utils5.cloneEnv)(process.env, meta.env, {
|
|
15365
15710
|
VERCEL_DEV_PORT_FILE: portFile
|
|
15366
15711
|
});
|
|
15367
15712
|
const executable = `./vercel-dev-server-go${process.platform === "win32" ? ".exe" : ""}`;
|
|
@@ -15374,7 +15719,7 @@ async function startDevServer(opts) {
|
|
|
15374
15719
|
workPath
|
|
15375
15720
|
});
|
|
15376
15721
|
await go.build("./...", executable);
|
|
15377
|
-
(0,
|
|
15722
|
+
(0, import_build_utils5.debug)(`SPAWNING ${executable} CWD=${tmp}`);
|
|
15378
15723
|
const child = (0, import_child_process2.spawn)(executable, [], {
|
|
15379
15724
|
cwd: tmp,
|
|
15380
15725
|
env,
|
|
@@ -15462,11 +15807,11 @@ async function prepareCache({
|
|
|
15462
15807
|
const stat = await (0, import_fs_extra4.lstat)(goCacheDir);
|
|
15463
15808
|
if (stat.isSymbolicLink()) {
|
|
15464
15809
|
const goGlobalCacheDir = await (0, import_fs_extra4.readlink)(goCacheDir);
|
|
15465
|
-
(0,
|
|
15810
|
+
(0, import_build_utils5.debug)(`Preparing cache by moving ${goGlobalCacheDir} -> ${goCacheDir}`);
|
|
15466
15811
|
await (0, import_fs_extra4.unlink)(goCacheDir);
|
|
15467
15812
|
await (0, import_fs_extra4.move)(goGlobalCacheDir, goCacheDir);
|
|
15468
15813
|
}
|
|
15469
|
-
const cache = await (0,
|
|
15814
|
+
const cache = await (0, import_build_utils5.glob)(`${localCacheDir}/**`, workPath);
|
|
15470
15815
|
return cache;
|
|
15471
15816
|
}
|
|
15472
15817
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -15474,6 +15819,7 @@ async function prepareCache({
|
|
|
15474
15819
|
build,
|
|
15475
15820
|
detectEntrypoint,
|
|
15476
15821
|
detectGoEntrypoint,
|
|
15822
|
+
diagnostics,
|
|
15477
15823
|
getNewHandlerFunctionName,
|
|
15478
15824
|
prepareCache,
|
|
15479
15825
|
shouldServe,
|