当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript module-resolver.ModuleResolver类代码示例

本文整理汇总了TypeScript中@angular/cli/utilities/module-resolver.ModuleResolver的典型用法代码示例。如果您正苦于以下问题:TypeScript ModuleResolver类的具体用法?TypeScript ModuleResolver怎么用?TypeScript ModuleResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModuleResolver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('when there is no index.ts in oldPath', () => {
   let oldFilePath = path.join(rootPath, 'bar/baz/baz.component.ts');
   let newFilePath = path.join(rootPath, 'foo');
   let resolver = new ModuleResolver(oldFilePath, newFilePath, rootPath);
   return resolver.resolveDependentFiles()
     .then((changes) => resolver.applySortedChangePromise(changes))
     .then(() => dependentFilesUtils.createTsSourceFile(barFile))
     .then((tsFileBar: ts.SourceFile) => {
       let contentsBar = dependentFilesUtils.getImportClauses(tsFileBar);
       let bazExpectedContent = path.normalize('../foo/baz.component');
       expect(contentsBar[0].specifierText).to.equal(bazExpectedContent);
     })
     .then(() => dependentFilesUtils.createTsSourceFile(fooFile))
     .then((tsFileFoo: ts.SourceFile) => {
       let contentsFoo = dependentFilesUtils.getImportClauses(tsFileFoo);
       let bazExpectedContent = './baz.component'.replace('/', path.sep);
       expect(contentsFoo[0].specifierText).to.equal(bazExpectedContent);
     })
     .then(() => resolver.resolveOwnImports())
     .then((changes) => resolver.applySortedChangePromise(changes))
     .then(() => dependentFilesUtils.createTsSourceFile(bazFile))
     .then((tsFileBaz: ts.SourceFile) => {
       let contentsBaz = dependentFilesUtils.getImportClauses(tsFileBaz);
       let barExpectedContent = path.normalize('../bar/bar.component');
       let fooBarExpectedContent = path.normalize('../foo-baz/qux/quux/foobar/foobar.component');
       expect(contentsBaz[0].specifierText).to.equal(barExpectedContent);
       expect(contentsBaz[1].specifierText).to.equal(fooBarExpectedContent);
     });
 });
开发者ID:Percyman,项目名称:angular-cli,代码行数:29,代码来源:module-resolver.spec.ts

示例2: it

 it('when oldPath and newPath both do not have index.ts', (done) => {
   let oldFilePath = path.join(rootPath, 'bar/baz/baz.component.ts');
   let newFilePath = path.join(rootPath, 'foo-baz');
   let resolver = new ModuleResolver(oldFilePath, newFilePath, rootPath);
   return resolver.resolveDependentFiles()
     .then((changes) => resolver.applySortedChangePromise(changes))
     .then(() => dependentFilesUtils.createTsSourceFile(barFile))
     .then((tsFileBar: ts.SourceFile) => {
       let contentsBar = dependentFilesUtils.getImportClauses(tsFileBar);
       let bazExpectedContent = path.normalize('../foo-baz/baz.component');
       expect(contentsBar[0].specifierText).toBe(bazExpectedContent);
     })
     .then(() => dependentFilesUtils.createTsSourceFile(fooFile))
     .then((tsFileFoo: ts.SourceFile) => {
       let contentsFoo = dependentFilesUtils.getImportClauses(tsFileFoo);
       let bazExpectedContent = path.normalize('../foo-baz/baz.component');
       expect(contentsFoo[0].specifierText).toBe(bazExpectedContent);
     })
     .then(() => resolver.resolveOwnImports())
     .then((changes) => resolver.applySortedChangePromise(changes))
     .then(() => dependentFilesUtils.createTsSourceFile(bazFile))
     .then((tsFile: ts.SourceFile) => {
       let contentsBaz = dependentFilesUtils.getImportClauses(tsFile);
       let barExpectedContent = path.normalize('../bar/bar.component');
       let fooBarExpectedContent =
         `.${path.sep}qux${path.sep}quux${path.sep}foobar${path.sep}foobar.component`;
       expect(contentsBaz[0].specifierText).toBe(barExpectedContent);
       expect(contentsBaz[1].specifierText).toBe(fooBarExpectedContent);
     })
     .then(done, done.fail);
 });
开发者ID:germanomarques,项目名称:angular-cli,代码行数:31,代码来源:module-resolver.spec.ts

示例3:

 .then(() => resolver.resolveOwnImports())
开发者ID:Percyman,项目名称:angular-cli,代码行数:1,代码来源:module-resolver.spec.ts


注:本文中的@angular/cli/utilities/module-resolver.ModuleResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。