Skip to content

Commit e7c11ec

Browse files
authored
fix: include export statements when resolving imports (#3140)
1 parent 4b1969f commit e7c11ec

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
import * from '../nested/index.ts';
1+
import * as _ from "../nested/index.ts";
2+
3+
export * from "./mod.ts";

internal/functions/deploy/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func writeForm(form *multipart.Writer, meta api.FunctionDeployMetadata, fsys afe
162162
}
163163

164164
// Ref: https://regex101.com/r/DfBdJA/1
165-
var importPathPattern = regexp.MustCompile(`(?i)import\s+(?:{[^{}]+}|.*?)\s*(?:from)?\s*['"](.*?)['"]|import\(\s*['"](.*?)['"]\)`)
165+
var importPathPattern = regexp.MustCompile(`(?i)(?:import|export)\s+(?:{[^{}]+}|.*?)\s*(?:from)?\s*['"](.*?)['"]|import\(\s*['"](.*?)['"]\)`)
166166

167167
func walkImportPaths(srcPath string, importMap utils.ImportMap, readFile func(curr string, w io.Writer) error) error {
168168
seen := map[string]struct{}{}

internal/functions/deploy/upload_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func TestImportPaths(t *testing.T) {
6666
fsys.On("ReadFile", "testdata/modules/imports.ts").Once()
6767
fsys.On("ReadFile", "testdata/geometries/Geometries.js").Once()
6868
fsys.On("ReadFile", "testdata/shared/whatever.ts").Once()
69+
fsys.On("ReadFile", "testdata/shared/mod.ts").Once()
6970
fsys.On("ReadFile", "testdata/nested/index.ts").Once()
7071
// Run test
7172
im := utils.ImportMap{Imports: map[string]string{

0 commit comments

Comments
 (0)