MCPcopy
hub / github.com/esm-dev/esm.sh / buildTypes

Method buildTypes

server/build.go:1543–1574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1541}
1542
1543func (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
1576func (ctx *BuildContext) install() (err error) {
1577 if ctx.wd == "" || ctx.pkgJson == nil {

Callers 1

BuildMethod · 0.95

Calls 6

installMethod · 0.95
checkCanceledMethod · 0.95
resolveEntryMethod · 0.95
transformDTSMethod · 0.95
endsWithFunction · 0.85
PackageIdMethod · 0.80

Tested by

no test coverage detected