Skip to content

Commit

Permalink
Fix dts build
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Apr 5, 2023
1 parent 7182b46 commit b058371
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ func (task *BuildTask) build() (esm *ESMBuild, err error) {
}

if task.Target == "types" {
var dts string
if endsWith(task.Pkg.FullSubmodule, ".d.ts", ".d.mts") && !endsWith(task.Pkg.FullSubmodule, "~.d.ts") {
dts = npm.Name + "@" + npm.Version + path.Join("/", task.Pkg.FullSubmodule)
} else if npm.Types != "" {
dts = npm.Name + "@" + npm.Version + path.Join("/", npm.Types)
}
if dts != "" {
if npm.Types != "" {
dts := npm.Name + "@" + npm.Version + path.Join("/", npm.Types)
task.stage = "transform-dts"
task.buildDTS(dts)
}
Expand Down
2 changes: 1 addition & 1 deletion server/build_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (task *BuildTask) analyze() (esm *ESMBuild, npm NpmPackage, reexport string
}

if pkg.Submodule != "" {
if strings.HasSuffix(pkg.Submodule, ".d.ts") {
if endsWith(pkg.Submodule, ".d.ts", ".d.mts") {
if strings.HasSuffix(pkg.Submodule, "~.d.ts") {
submodule := strings.TrimSuffix(pkg.Submodule, "~.d.ts")
subDir := path.Join(wd, "node_modules", npm.Name, submodule)
Expand Down

0 comments on commit b058371

Please sign in to comment.