
committed by
Victor Berchet

parent
4a44832114
commit
6c77d7182a
@ -16,7 +16,7 @@ import {StaticReflectorHost, StaticSymbol} from './static_reflector';
|
||||
|
||||
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
|
||||
const DTS = /\.d\.ts$/;
|
||||
const NODE_MODULES = path.sep + 'node_modules' + path.sep;
|
||||
const NODE_MODULES = '/node_modules/';
|
||||
const IS_GENERATED = /\.(ngfactory|css(\.shim)?)$/;
|
||||
|
||||
export interface ReflectorHostContext {
|
||||
@ -36,8 +36,8 @@ export class ReflectorHost implements StaticReflectorHost, ImportGenerator {
|
||||
protected program: ts.Program, protected compilerHost: ts.CompilerHost,
|
||||
protected options: AngularCompilerOptions, context?: ReflectorHostContext) {
|
||||
// normalize the path so that it never ends with '/'.
|
||||
this.basePath = path.normalize(path.join(this.options.basePath, '.'));
|
||||
this.genDir = path.normalize(path.join(this.options.genDir, '.'));
|
||||
this.basePath = path.normalize(path.join(this.options.basePath, '.')).replace(/\\/g, '/');
|
||||
this.genDir = path.normalize(path.join(this.options.genDir, '.')).replace(/\\/g, '/');
|
||||
|
||||
this.context = context || new NodeReflectorHostContext();
|
||||
var genPath: string = path.relative(this.basePath, this.genDir);
|
||||
@ -60,7 +60,8 @@ export class ReflectorHost implements StaticReflectorHost, ImportGenerator {
|
||||
|
||||
protected resolve(m: string, containingFile: string) {
|
||||
const resolved =
|
||||
ts.resolveModuleName(m, containingFile, this.options, this.context).resolvedModule;
|
||||
ts.resolveModuleName(m, containingFile.replace(/\\/g, '/'), this.options, this.context)
|
||||
.resolvedModule;
|
||||
return resolved ? resolved.resolvedFileName : null;
|
||||
};
|
||||
|
||||
@ -139,7 +140,7 @@ export class ReflectorHost implements StaticReflectorHost, ImportGenerator {
|
||||
}
|
||||
|
||||
private dotRelative(from: string, to: string): string {
|
||||
var rPath: string = path.relative(from, to);
|
||||
var rPath: string = path.relative(from, to).replace(/\\/g, '/');
|
||||
return rPath.startsWith('.') ? rPath : './' + rPath;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user