(subPath string)
| 1160 | } |
| 1161 | |
| 1162 | func (ctx *BuildContext) resloveSubModule(subPath string) (string, bool) { |
| 1163 | if subPath != "" { |
| 1164 | if ctx.existsPkgFile(subPath) { |
| 1165 | return subPath, true |
| 1166 | } |
| 1167 | preferExt := ".mjs" |
| 1168 | if ctx.pkgJson.Type == "commonjs" { |
| 1169 | preferExt = ".cjs" |
| 1170 | } |
| 1171 | for _, ext := range []string{preferExt, "js", "mts", "ts", "cts"} { |
| 1172 | if ctx.existsPkgFile(subPath + "." + ext) { |
| 1173 | return subPath + "." + ext, true |
| 1174 | } |
| 1175 | if ctx.existsPkgFile(subPath + "/index." + ext) { |
| 1176 | return subPath + "/index." + ext, true |
| 1177 | } |
| 1178 | } |
| 1179 | } |
| 1180 | return "", false |
| 1181 | } |
| 1182 | |
| 1183 | func (ctx *BuildContext) resolveDependency(specifier string, isDts bool) (esm EsmPath, packageJson *npm.PackageJSON, err error) { |
| 1184 | pkgName, version, subPath := splitEsmPath(specifier) |
no test coverage detected