@vercel/go 2.2.0 → 2.2.3
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/analyze.go +4 -2
- package/dist/index.js +8 -2
- package/package.json +3 -3
package/dist/analyze.go
CHANGED
|
@@ -197,7 +197,9 @@ func main() {
|
|
|
197
197
|
// find a valid `http.HandlerFunc` handler function
|
|
198
198
|
params := rf[fn.Type.Params.Pos()-offset : fn.Type.Params.End()-offset]
|
|
199
199
|
validHandlerFunc := (strings.Contains(string(params), "http.ResponseWriter") &&
|
|
200
|
-
strings.Contains(string(params), "*http.Request") &&
|
|
200
|
+
strings.Contains(string(params), "*http.Request") &&
|
|
201
|
+
len(fn.Type.Params.List) == 2 &&
|
|
202
|
+
(fn.Recv == nil || len(fn.Recv.List) == 0))
|
|
201
203
|
|
|
202
204
|
if validHandlerFunc {
|
|
203
205
|
// we found the first exported function with `http.HandlerFunc`
|
|
@@ -223,7 +225,7 @@ func main() {
|
|
|
223
225
|
if fn.Name.IsExported() == true {
|
|
224
226
|
for _, param := range fn.Type.Params.List {
|
|
225
227
|
paramStr := fmt.Sprintf("%s", param.Type)
|
|
226
|
-
if strings.Contains(string(paramStr), "http ResponseWriter") && len(fn.Type.Params.List) == 2 {
|
|
228
|
+
if strings.Contains(string(paramStr), "http ResponseWriter") && len(fn.Type.Params.List) == 2 && (fn.Recv == nil || len(fn.Recv.List) == 0) {
|
|
227
229
|
analyzed := analyze{
|
|
228
230
|
PackageName: parsed.Name.Name,
|
|
229
231
|
FuncName: fn.Name.Name,
|
package/dist/index.js
CHANGED
|
@@ -18074,8 +18074,14 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
|
|
|
18074
18074
|
exports.build = build;
|
|
18075
18075
|
async function renameHandlerFunction(fsPath, from, to) {
|
|
18076
18076
|
let fileContents = await fs_extra_1.readFile(fsPath, 'utf8');
|
|
18077
|
-
|
|
18078
|
-
|
|
18077
|
+
// This regex has to walk a fine line where it replaces the most-likely occurrences
|
|
18078
|
+
// of the handler's identifier without clobbering other syntax.
|
|
18079
|
+
// Left-hand Side: A single space was chosen because it can catch `func Handler`
|
|
18080
|
+
// as well as `var _ http.HandlerFunc = Index`.
|
|
18081
|
+
// Right-hand Side: a word boundary was chosen because this can be an end of line
|
|
18082
|
+
// or an open paren (as in `func Handler(`).
|
|
18083
|
+
const fromRegex = new RegExp(String.raw ` ${from}\b`, 'g');
|
|
18084
|
+
fileContents = fileContents.replace(fromRegex, ` ${to}`);
|
|
18079
18085
|
await fs_extra_1.writeFile(fsPath, fileContents);
|
|
18080
18086
|
}
|
|
18081
18087
|
function getNewHandlerFunctionName(originalFunctionName, entrypoint) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/go",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/jest": "28.1.6",
|
|
36
36
|
"@types/node-fetch": "^2.3.0",
|
|
37
37
|
"@types/tar": "^4.0.0",
|
|
38
|
-
"@vercel/build-utils": "5.
|
|
38
|
+
"@vercel/build-utils": "5.4.0",
|
|
39
39
|
"@vercel/ncc": "0.24.0",
|
|
40
40
|
"async-retry": "1.3.1",
|
|
41
41
|
"execa": "^1.0.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"tar": "4.4.6",
|
|
46
46
|
"typescript": "4.3.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e7e0a55b72bc73c26661f7b2a3caa0884a5d1764"
|
|
49
49
|
}
|