Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
fix(ts): set default export to file name
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 22, 2022
1 parent f8d7f4b commit 1b6dc91
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,31 @@ class ClassRepository(systemId: String, language: String, workspace: String) {
filePath: String,
clzFunctions: Array<CodeFunction>
) {
var sourceName = "${packageName}.${clzName}"
for (clz in imports) {
var importSource = clz.Source
for (import in imports) {
if (isJs()) {
var sourceName = "$packageName"

var importSource = import.Source
importSource = convertTypeScriptImport(importSource, filePath)

val mayBeAComponent = packageName.endsWith(".index") && clzName == "default"
if (mayBeAComponent) {
val functions = clzFunctions.filter { it.IsReturnHtml }
val isAComponent = functions.isNotEmpty()
if (isAComponent) {
sourceName = packageName.removeSuffix(".index") + "." + functions[0].Name
sourceName = packageName.removeSuffix(".index")
}
}

}
val clzDependenceId = saveOrGetDependentClass(importSource, DEFAULT_MODULE_NAME)
doSaveClassDependence(clzId, clzDependenceId, sourceName, importSource)
} else {
val sourceName = "${packageName}.${clzName}"

val clzDependenceId = saveOrGetDependentClass(importSource, DEFAULT_MODULE_NAME)
doSaveClassDependence(clzId, clzDependenceId, sourceName, importSource)
val importSource = import.Source
val clzDependenceId = saveOrGetDependentClass(importSource, DEFAULT_MODULE_NAME)
doSaveClassDependence(clzId, clzDependenceId, sourceName, importSource)
}
}
}

Expand Down

0 comments on commit 1b6dc91

Please sign in to comment.