Permalink
Browse files

fix(compiler): support `.` in import statements. (#20634)

fix #20363

PR Close #20634
  • Loading branch information...
mmlleevvyy authored and mhevery committed Nov 26, 2017
1 parent 39af314 commit d8f7b293d79e7a3f5e6fc330d6029c790f32988a
@@ -18,7 +18,7 @@ import {CompilerHost, CompilerOptions, LibrarySummary} from './api';
import {MetadataReaderHost, createMetadataReaderCache, readMetadata} from './metadata_reader';
import {DTS, GENERATED_FILES, isInRootDir, relativeToRootDirs} from './util';
const NODE_MODULES_PACKAGE_NAME = /node_modules\/((\w|-)+|(@(\w|-)+\/(\w|-)+))/;
const NODE_MODULES_PACKAGE_NAME = /node_modules\/((\w|-|\.)+|(@(\w|-|\.)+\/(\w|-|\.)+))/;
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
export function createCompilerHost(
@@ -65,6 +65,11 @@ describe('NgCompilerHost', () => {
.toBe('@angular/core');
});
it('should allow an import o a package whose name contains dot (e.g. @angular.io)', () => {
expect(host.fileNameToModuleName('/tmp/node_modules/@angular.io/core.d.ts', '/tmp/main.ts'))
.toBe('@angular.io/core');
});
it('should use a package import when accessing a package from another package', () => {
expect(host.fileNameToModuleName(
'/tmp/node_modules/mod1/index.d.ts', '/tmp/node_modules/mod2/index.d.ts'))

0 comments on commit d8f7b29

Please sign in to comment.