Skip to content

Commit 98130d6

Browse files
committed
Utilized the new ISourceFile.getProjectPath() in FileProcessor class
1 parent 0a99edc commit 98130d6

File tree

1 file changed

+6
-11
lines changed
  • rocket-chatter-ingestion-server/src/process/prepare/processor

1 file changed

+6
-11
lines changed

rocket-chatter-ingestion-server/src/process/prepare/processor/file.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,15 @@ export class FileProcessor implements IFileProcessor {
5757
for (const i of imports) {
5858
const importName = (i as any).specifiers[0].local.name
5959

60-
const sourceFileAbsolutePath = path
61-
.resolve(sourceFile.getFullPath())
62-
.replace(/\\/g, "/")
63-
const projectPath = sourceFileAbsolutePath.slice(
64-
0,
65-
sourceFileAbsolutePath.indexOf(sourceFile.getFullPath())
66-
)
67-
68-
const targetFileRelativePath = path
60+
const projectPath = sourceFile.getProjectPath()
61+
const targetFileAbsolutePath = path
6962
.resolve(path.join(sourceFile.getFullPath(), (i as any).source.value))
7063
.replace(/\\/g, "/")
71-
const absolutePath = targetFileRelativePath.slice(projectPath.length)
64+
const targetFileRelativePath = targetFileAbsolutePath.slice(
65+
projectPath.length
66+
)
7267

73-
parsedImports.set(importName, absolutePath)
68+
parsedImports.set(importName, targetFileRelativePath)
7469
}
7570
}
7671

0 commit comments

Comments
 (0)