()
| 1541 | } |
| 1542 | |
| 1543 | func (ctx *BuildContext) buildTypes() (ret *BuildMeta, err error) { |
| 1544 | // install the package |
| 1545 | ctx.status = "install" |
| 1546 | err = ctx.install() |
| 1547 | if err != nil { |
| 1548 | return |
| 1549 | } |
| 1550 | if err = ctx.checkCanceled(); err != nil { |
| 1551 | return |
| 1552 | } |
| 1553 | |
| 1554 | var dts string |
| 1555 | if endsWith(ctx.esmPath.SubPath, ".ts", ".mts", ".tsx", ".cts") { |
| 1556 | dts = "./" + ctx.esmPath.SubPath |
| 1557 | } else { |
| 1558 | entry := ctx.resolveEntry(ctx.esmPath) |
| 1559 | if entry.types == "" { |
| 1560 | err = errors.New("types not found") |
| 1561 | return |
| 1562 | } |
| 1563 | dts = entry.types |
| 1564 | } |
| 1565 | |
| 1566 | ctx.status = "build" |
| 1567 | err = ctx.transformDTS(dts) |
| 1568 | if err != nil { |
| 1569 | return |
| 1570 | } |
| 1571 | |
| 1572 | ret = &BuildMeta{Dts: "/" + ctx.esmPath.PackageId() + dts[1:]} |
| 1573 | return |
| 1574 | } |
| 1575 | |
| 1576 | func (ctx *BuildContext) install() (err error) { |
| 1577 | if ctx.wd == "" || ctx.pkgJson == nil { |
no test coverage detected