@vercel/go 2.2.8 → 2.2.9
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 +0 -81
- package/dist/index.js +0 -9
- package/package.json +3 -3
package/dist/analyze.go
CHANGED
|
@@ -2,7 +2,6 @@ package main
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"encoding/json"
|
|
5
|
-
"flag"
|
|
6
5
|
"fmt"
|
|
7
6
|
"go/ast"
|
|
8
7
|
"go/parser"
|
|
@@ -104,84 +103,6 @@ func main() {
|
|
|
104
103
|
if err != nil {
|
|
105
104
|
log.Fatal(err)
|
|
106
105
|
}
|
|
107
|
-
se := string(rf)
|
|
108
|
-
|
|
109
|
-
var files []string
|
|
110
|
-
var relatedFiles []string
|
|
111
|
-
|
|
112
|
-
// Add entrypoint to watchlist
|
|
113
|
-
relFileName, err := filepath.Rel(filepath.Dir(fileName), fileName)
|
|
114
|
-
if err != nil {
|
|
115
|
-
log.Fatal(err)
|
|
116
|
-
}
|
|
117
|
-
relatedFiles = append(relatedFiles, relFileName)
|
|
118
|
-
|
|
119
|
-
// looking for all go files that have export func
|
|
120
|
-
// using in entrypoint
|
|
121
|
-
err = filepath.Walk(filepath.Dir(fileName), visit(&files))
|
|
122
|
-
if err != nil {
|
|
123
|
-
log.Fatal(err)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// looking related packages
|
|
127
|
-
var modPath string
|
|
128
|
-
flag.StringVar(&modPath, "modpath", "", "module path")
|
|
129
|
-
flag.Parse()
|
|
130
|
-
if len(modPath) > 1 {
|
|
131
|
-
err = filepath.Walk(modPath, visit(&files))
|
|
132
|
-
if err != nil {
|
|
133
|
-
log.Fatal(err)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
for _, file := range files {
|
|
138
|
-
absFileName, _ := filepath.Abs(fileName)
|
|
139
|
-
absFile, _ := filepath.Abs(file)
|
|
140
|
-
// if it isn't entrypoint
|
|
141
|
-
if absFileName != absFile {
|
|
142
|
-
// find all export structs and functions
|
|
143
|
-
pf := parse(file)
|
|
144
|
-
var exportedDecl []string
|
|
145
|
-
|
|
146
|
-
ast.Inspect(pf, func(n ast.Node) bool {
|
|
147
|
-
switch t := n.(type) {
|
|
148
|
-
case *ast.FuncDecl:
|
|
149
|
-
if t.Name.IsExported() {
|
|
150
|
-
exportedDecl = append(exportedDecl, t.Name.Name)
|
|
151
|
-
}
|
|
152
|
-
// find variable declarations
|
|
153
|
-
case *ast.TypeSpec:
|
|
154
|
-
// which are public
|
|
155
|
-
if t.Name.IsExported() {
|
|
156
|
-
switch t.Type.(type) {
|
|
157
|
-
// and are interfaces
|
|
158
|
-
case *ast.StructType:
|
|
159
|
-
exportedDecl = append(exportedDecl, t.Name.Name)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return true
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
for _, ed := range exportedDecl {
|
|
167
|
-
if strings.Contains(se, ed) {
|
|
168
|
-
// find relative path of related file
|
|
169
|
-
var basePath string
|
|
170
|
-
if modPath == "" {
|
|
171
|
-
basePath = filepath.Dir(fileName)
|
|
172
|
-
} else {
|
|
173
|
-
basePath = modPath
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
rel, err := filepath.Rel(basePath, file)
|
|
177
|
-
if err != nil {
|
|
178
|
-
log.Fatal(err)
|
|
179
|
-
}
|
|
180
|
-
relatedFiles = append(relatedFiles, rel)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
106
|
|
|
186
107
|
parsed := parse(fileName)
|
|
187
108
|
offset := parsed.Pos()
|
|
@@ -207,7 +128,6 @@ func main() {
|
|
|
207
128
|
analyzed := analyze{
|
|
208
129
|
PackageName: parsed.Name.Name,
|
|
209
130
|
FuncName: fn.Name.Name,
|
|
210
|
-
Watch: unique(relatedFiles),
|
|
211
131
|
}
|
|
212
132
|
analyzedJSON, _ := json.Marshal(analyzed)
|
|
213
133
|
fmt.Print(string(analyzedJSON))
|
|
@@ -229,7 +149,6 @@ func main() {
|
|
|
229
149
|
analyzed := analyze{
|
|
230
150
|
PackageName: parsed.Name.Name,
|
|
231
151
|
FuncName: fn.Name.Name,
|
|
232
|
-
Watch: unique(relatedFiles),
|
|
233
152
|
}
|
|
234
153
|
analyzedJSON, _ := json.Marshal(analyzed)
|
|
235
154
|
fmt.Print(string(analyzedJSON))
|
package/dist/index.js
CHANGED
|
@@ -18044,17 +18044,8 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
|
|
|
18044
18044
|
supportsWrapper: true,
|
|
18045
18045
|
environment: {},
|
|
18046
18046
|
});
|
|
18047
|
-
const watch = parsedAnalyzed.watch;
|
|
18048
|
-
let watchSub = [];
|
|
18049
|
-
// if `entrypoint` located in subdirectory
|
|
18050
|
-
// we will need to concat it with return watch array
|
|
18051
|
-
if (entrypointArr.length > 1) {
|
|
18052
|
-
entrypointArr.pop();
|
|
18053
|
-
watchSub = parsedAnalyzed.watch.map(file => path_1.join(...entrypointArr, file));
|
|
18054
|
-
}
|
|
18055
18047
|
return {
|
|
18056
18048
|
output: lambda,
|
|
18057
|
-
watch: watch.concat(watchSub),
|
|
18058
18049
|
};
|
|
18059
18050
|
}
|
|
18060
18051
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/go",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9",
|
|
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.5.
|
|
38
|
+
"@vercel/build-utils": "5.5.1",
|
|
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": "bf5cfa9a41f8c1f9e2a3d3fc30735708ca72ad09"
|
|
49
49
|
}
|