@vercel/go 2.2.30 → 2.3.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/dist/index.js +95 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9319,7 +9319,7 @@ module.exports = function(fn) {
|
|
|
9319
9319
|
|
|
9320
9320
|
/***/ }),
|
|
9321
9321
|
|
|
9322
|
-
/***/
|
|
9322
|
+
/***/ 779:
|
|
9323
9323
|
/***/ ((module, exports, __webpack_require__) => {
|
|
9324
9324
|
|
|
9325
9325
|
"use strict";
|
|
@@ -10742,6 +10742,20 @@ const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original)
|
|
|
10742
10742
|
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
|
10743
10743
|
};
|
|
10744
10744
|
|
|
10745
|
+
/**
|
|
10746
|
+
* isSameProtocol reports whether the two provided URLs use the same protocol.
|
|
10747
|
+
*
|
|
10748
|
+
* Both domains must already be in canonical form.
|
|
10749
|
+
* @param {string|URL} original
|
|
10750
|
+
* @param {string|URL} destination
|
|
10751
|
+
*/
|
|
10752
|
+
const isSameProtocol = function isSameProtocol(destination, original) {
|
|
10753
|
+
const orig = new URL$1(original).protocol;
|
|
10754
|
+
const dest = new URL$1(destination).protocol;
|
|
10755
|
+
|
|
10756
|
+
return orig === dest;
|
|
10757
|
+
};
|
|
10758
|
+
|
|
10745
10759
|
/**
|
|
10746
10760
|
* Fetch function
|
|
10747
10761
|
*
|
|
@@ -10773,7 +10787,7 @@ function fetch(url, opts) {
|
|
|
10773
10787
|
let error = new AbortError('The user aborted a request.');
|
|
10774
10788
|
reject(error);
|
|
10775
10789
|
if (request.body && request.body instanceof Stream.Readable) {
|
|
10776
|
-
request.body
|
|
10790
|
+
destroyStream(request.body, error);
|
|
10777
10791
|
}
|
|
10778
10792
|
if (!response || !response.body) return;
|
|
10779
10793
|
response.body.emit('error', error);
|
|
@@ -10814,9 +10828,41 @@ function fetch(url, opts) {
|
|
|
10814
10828
|
|
|
10815
10829
|
req.on('error', function (err) {
|
|
10816
10830
|
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
|
10831
|
+
|
|
10832
|
+
if (response && response.body) {
|
|
10833
|
+
destroyStream(response.body, err);
|
|
10834
|
+
}
|
|
10835
|
+
|
|
10817
10836
|
finalize();
|
|
10818
10837
|
});
|
|
10819
10838
|
|
|
10839
|
+
fixResponseChunkedTransferBadEnding(req, function (err) {
|
|
10840
|
+
if (signal && signal.aborted) {
|
|
10841
|
+
return;
|
|
10842
|
+
}
|
|
10843
|
+
|
|
10844
|
+
destroyStream(response.body, err);
|
|
10845
|
+
});
|
|
10846
|
+
|
|
10847
|
+
/* c8 ignore next 18 */
|
|
10848
|
+
if (parseInt(process.version.substring(1)) < 14) {
|
|
10849
|
+
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
|
|
10850
|
+
// properly handle when the socket close/end events are out of order.
|
|
10851
|
+
req.on('socket', function (s) {
|
|
10852
|
+
s.addListener('close', function (hadError) {
|
|
10853
|
+
// if a data listener is still present we didn't end cleanly
|
|
10854
|
+
const hasDataListener = s.listenerCount('data') > 0;
|
|
10855
|
+
|
|
10856
|
+
// if end happened before close but the socket didn't emit an error, do it now
|
|
10857
|
+
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
|
|
10858
|
+
const err = new Error('Premature close');
|
|
10859
|
+
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
|
10860
|
+
response.body.emit('error', err);
|
|
10861
|
+
}
|
|
10862
|
+
});
|
|
10863
|
+
});
|
|
10864
|
+
}
|
|
10865
|
+
|
|
10820
10866
|
req.on('response', function (res) {
|
|
10821
10867
|
clearTimeout(reqTimeout);
|
|
10822
10868
|
|
|
@@ -10888,7 +10934,7 @@ function fetch(url, opts) {
|
|
|
10888
10934
|
size: request.size
|
|
10889
10935
|
};
|
|
10890
10936
|
|
|
10891
|
-
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
|
10937
|
+
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
|
10892
10938
|
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
|
10893
10939
|
requestOpts.headers.delete(name);
|
|
10894
10940
|
}
|
|
@@ -10981,6 +11027,13 @@ function fetch(url, opts) {
|
|
|
10981
11027
|
response = new Response(body, response_options);
|
|
10982
11028
|
resolve(response);
|
|
10983
11029
|
});
|
|
11030
|
+
raw.on('end', function () {
|
|
11031
|
+
// some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
|
|
11032
|
+
if (!response) {
|
|
11033
|
+
response = new Response(body, response_options);
|
|
11034
|
+
resolve(response);
|
|
11035
|
+
}
|
|
11036
|
+
});
|
|
10984
11037
|
return;
|
|
10985
11038
|
}
|
|
10986
11039
|
|
|
@@ -11000,6 +11053,41 @@ function fetch(url, opts) {
|
|
|
11000
11053
|
writeToStream(req, request);
|
|
11001
11054
|
});
|
|
11002
11055
|
}
|
|
11056
|
+
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
11057
|
+
let socket;
|
|
11058
|
+
|
|
11059
|
+
request.on('socket', function (s) {
|
|
11060
|
+
socket = s;
|
|
11061
|
+
});
|
|
11062
|
+
|
|
11063
|
+
request.on('response', function (response) {
|
|
11064
|
+
const headers = response.headers;
|
|
11065
|
+
|
|
11066
|
+
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
|
|
11067
|
+
response.once('close', function (hadError) {
|
|
11068
|
+
// if a data listener is still present we didn't end cleanly
|
|
11069
|
+
const hasDataListener = socket.listenerCount('data') > 0;
|
|
11070
|
+
|
|
11071
|
+
if (hasDataListener && !hadError) {
|
|
11072
|
+
const err = new Error('Premature close');
|
|
11073
|
+
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
|
11074
|
+
errorCallback(err);
|
|
11075
|
+
}
|
|
11076
|
+
});
|
|
11077
|
+
}
|
|
11078
|
+
});
|
|
11079
|
+
}
|
|
11080
|
+
|
|
11081
|
+
function destroyStream(stream, err) {
|
|
11082
|
+
if (stream.destroy) {
|
|
11083
|
+
stream.destroy(err);
|
|
11084
|
+
} else {
|
|
11085
|
+
// node < 8
|
|
11086
|
+
stream.emit('error', err);
|
|
11087
|
+
stream.end();
|
|
11088
|
+
}
|
|
11089
|
+
}
|
|
11090
|
+
|
|
11003
11091
|
/**
|
|
11004
11092
|
* Redirect code matching
|
|
11005
11093
|
*
|
|
@@ -20003,12 +20091,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
20003
20091
|
exports.downloadGo = exports.createGo = exports.getAnalyzedEntrypoint = exports.OUT_EXTENSION = exports.cacheDir = void 0;
|
|
20004
20092
|
const tar_1 = __importDefault(__webpack_require__(6758));
|
|
20005
20093
|
const execa_1 = __importDefault(__webpack_require__(389));
|
|
20006
|
-
const node_fetch_1 = __importDefault(__webpack_require__(
|
|
20094
|
+
const node_fetch_1 = __importDefault(__webpack_require__(779));
|
|
20007
20095
|
const fs_extra_1 = __webpack_require__(7692);
|
|
20008
20096
|
const path_1 = __webpack_require__(5622);
|
|
20009
20097
|
const string_argv_1 = __importDefault(__webpack_require__(2534));
|
|
20010
20098
|
const build_utils_1 = __webpack_require__(3445);
|
|
20011
20099
|
const versionMap = new Map([
|
|
20100
|
+
['1.19', '1.19.5'],
|
|
20012
20101
|
['1.18', '1.18.1'],
|
|
20013
20102
|
['1.17', '1.17.3'],
|
|
20014
20103
|
['1.16', '1.16.10'],
|
|
@@ -20678,9 +20767,10 @@ Learn more: https://vercel.com/docs/runtimes#official-runtimes/go`);
|
|
|
20678
20767
|
});
|
|
20679
20768
|
const executable = `./vercel-dev-server-go${process.platform === 'win32' ? '.exe' : ''}`;
|
|
20680
20769
|
build_utils_1.debug(`SPAWNING go build -o ${executable} ./... CWD=${tmp}`);
|
|
20681
|
-
child_process_1.
|
|
20770
|
+
child_process_1.execFileSync('go', ['build', '-o', executable, './...'], {
|
|
20682
20771
|
cwd: tmp,
|
|
20683
20772
|
env,
|
|
20773
|
+
stdio: 'inherit',
|
|
20684
20774
|
});
|
|
20685
20775
|
build_utils_1.debug(`SPAWNING ${executable} CWD=${tmp}`);
|
|
20686
20776
|
const child = child_process_1.spawn(executable, [], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/go",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/node": "14.18.33",
|
|
37
37
|
"@types/node-fetch": "^2.3.0",
|
|
38
38
|
"@types/tar": "^4.0.0",
|
|
39
|
-
"@vercel/build-utils": "
|
|
39
|
+
"@vercel/build-utils": "6.0.1",
|
|
40
40
|
"@vercel/ncc": "0.24.0",
|
|
41
41
|
"async-retry": "1.3.1",
|
|
42
42
|
"execa": "^1.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"tar": "4.4.6",
|
|
47
47
|
"typescript": "4.3.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ada9a48d57be8f4375494a369aaa98cee1f5eae2"
|
|
50
50
|
}
|