diff --git a/internal/functions/deploy/testdata/shared/whatever.ts b/internal/functions/deploy/testdata/shared/whatever.ts index aad3bc023..879e79cb3 100644 --- a/internal/functions/deploy/testdata/shared/whatever.ts +++ b/internal/functions/deploy/testdata/shared/whatever.ts @@ -1 +1,3 @@ -import * from '../nested/index.ts'; +import * as _ from "../nested/index.ts"; + +export * from "./mod.ts"; diff --git a/internal/functions/deploy/upload.go b/internal/functions/deploy/upload.go index e9a425b88..3e38855ed 100644 --- a/internal/functions/deploy/upload.go +++ b/internal/functions/deploy/upload.go @@ -162,7 +162,7 @@ func writeForm(form *multipart.Writer, meta api.FunctionDeployMetadata, fsys afe } // Ref: https://regex101.com/r/DfBdJA/1 -var importPathPattern = regexp.MustCompile(`(?i)import\s+(?:{[^{}]+}|.*?)\s*(?:from)?\s*['"](.*?)['"]|import\(\s*['"](.*?)['"]\)`) +var importPathPattern = regexp.MustCompile(`(?i)(?:import|export)\s+(?:{[^{}]+}|.*?)\s*(?:from)?\s*['"](.*?)['"]|import\(\s*['"](.*?)['"]\)`) func walkImportPaths(srcPath string, importMap utils.ImportMap, readFile func(curr string, w io.Writer) error) error { seen := map[string]struct{}{} diff --git a/internal/functions/deploy/upload_test.go b/internal/functions/deploy/upload_test.go index cbd549459..1698e0bd6 100644 --- a/internal/functions/deploy/upload_test.go +++ b/internal/functions/deploy/upload_test.go @@ -66,6 +66,7 @@ func TestImportPaths(t *testing.T) { fsys.On("ReadFile", "testdata/modules/imports.ts").Once() fsys.On("ReadFile", "testdata/geometries/Geometries.js").Once() fsys.On("ReadFile", "testdata/shared/whatever.ts").Once() + fsys.On("ReadFile", "testdata/shared/mod.ts").Once() fsys.On("ReadFile", "testdata/nested/index.ts").Once() // Run test im := utils.ImportMap{Imports: map[string]string{