|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import {ConstantPool, CssSelector, Expression, R3ComponentMetadata, R3DirectiveMetadata, SelectorMatcher, Statement, TmplAstNode, WrappedNodeExpr, compileComponentFromMetadata, makeBindingParser, parseTemplate} from '@angular/compiler'; |
10 | | -import * as path from 'path'; |
| 10 | +import * as path from 'canonical-path'; |
11 | 11 | import * as ts from 'typescript'; |
12 | 12 |
|
13 | 13 | import {ErrorCode, FatalDiagnosticError} from '../../diagnostics'; |
@@ -62,7 +62,7 @@ export class ComponentDecoratorHandler implements |
62 | 62 | throw new FatalDiagnosticError( |
63 | 63 | ErrorCode.VALUE_HAS_WRONG_TYPE, templateUrlExpr, 'templateUrl must be a string'); |
64 | 64 | } |
65 | | - const url = path.posix.resolve(path.dirname(node.getSourceFile().fileName), templateUrl); |
| 65 | + const url = path.resolve(path.dirname(node.getSourceFile().fileName), templateUrl); |
66 | 66 | return this.resourceLoader.preload(url); |
67 | 67 | } |
68 | 68 | return undefined; |
@@ -94,7 +94,7 @@ export class ComponentDecoratorHandler implements |
94 | 94 | throw new FatalDiagnosticError( |
95 | 95 | ErrorCode.VALUE_HAS_WRONG_TYPE, templateUrlExpr, 'templateUrl must be a string'); |
96 | 96 | } |
97 | | - const url = path.posix.resolve(path.dirname(node.getSourceFile().fileName), templateUrl); |
| 97 | + const url = path.resolve(path.dirname(node.getSourceFile().fileName), templateUrl); |
98 | 98 | templateStr = this.resourceLoader.load(url); |
99 | 99 | } else if (component.has('template')) { |
100 | 100 | const templateExpr = component.get('template') !; |
@@ -128,7 +128,7 @@ export class ComponentDecoratorHandler implements |
128 | 128 | // relative path representation. |
129 | 129 | const filePath = node.getSourceFile().fileName; |
130 | 130 | const relativeFilePath = this.rootDirs.reduce<string|undefined>((previous, rootDir) => { |
131 | | - const candidate = path.posix.relative(rootDir, filePath); |
| 131 | + const candidate = path.relative(rootDir, filePath); |
132 | 132 | if (previous === undefined || candidate.length < previous.length) { |
133 | 133 | return candidate; |
134 | 134 | } else { |
|
0 commit comments