Skip to content

Commit 0e8c370

Browse files
authored
1 parent 4013379 commit 0e8c370

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface AliasNode {
4242
export interface ImportNode {
4343
clauses: string[];
4444
absPathNode: string[];
45+
absPathString: string;
4546
isNodeModule: boolean;
4647
}
4748

src/tsStructureParser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ export function parseStruct(content: string, modules: {[path: string]: Module},
6060
if ( x.kind === ts.SyntaxKind.ImportDeclaration ) {
6161
var impDec = <ts.ImportDeclaration>x;
6262
var localMod = parse(x.getText());
63-
var localImport = { clauses: [] , absPathNode: [], isNodeModule: false};
63+
var localImport = { clauses: [] , absPathNode: [], absPathString: "", isNodeModule: false};
6464
var localNamedImports: string[];
6565
var localAbsPath: string[];
66+
var localAbsPathString: string;
6667
var localNodeModule: boolean = false;
6768
var pth = require("path");
6869
tsm.Matching.visit(localMod, y => {
@@ -79,11 +80,14 @@ export function parseStruct(content: string, modules: {[path: string]: Module},
7980
if ( localPath[0] === "." ) {
8081
var localP = fsUtil.resolve( fsUtil.dirname( mpth) + "/", localPath).split( process.cwd()).join(".");
8182
localAbsPath = localP.split(pth.sep);
83+
localAbsPathString = localP;
8284
} else {
8385
localAbsPath = localPath.split(pth.sep);
86+
localAbsPathString = localPath;
8487
localNodeModule = true;
8588
}
8689
localImport.absPathNode = localAbsPath;
90+
localImport.absPathString = localAbsPathString;
8791
localImport.isNodeModule = localNodeModule;
8892
}
8993
});

test/src/model/hero/hero.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
"decorator",
284284
"decorator"
285285
],
286+
"absPathString": "./test/src/model/decorator/decorator",
286287
"clauses": [
287288
"ClassDecorator",
288289
"ClassDecoratorWithParam"
@@ -298,6 +299,7 @@
298299
"decorator",
299300
"decorator"
300301
],
302+
"absPathString": "./test/src/model/decorator/decorator",
301303
"clauses": [
302304
"FieldDecorator",
303305
"FieldDecoratorWithParam",
@@ -316,6 +318,7 @@
316318
"hero",
317319
"testFunction"
318320
],
321+
"absPathString": "./test/src/model/hero/testFunction",
319322
"clauses": [
320323
"testFunction",
321324
"TestClassWithFunc"
@@ -326,6 +329,7 @@
326329
"absPathNode": [
327330
"grunt"
328331
],
332+
"absPathString": "grunt",
329333
"clauses": [
330334
""
331335
],

0 commit comments

Comments
 (0)