• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript polymer-analyzer.FsUrlResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: suite

  suite('createLinks', () => {
    const urlResolver = new FsUrlResolver('');
    const html = '<html><body>foo</body></html>';
    const htmlWithBase = '<html><base href="/base/"><body>foo</body></html>';
    const deps = new Set([
      'bower_components/polymer/polymer.html',
      'src/my-icons.html',
    ].map((u) => urlResolver.resolve(u as PackageRelativeUrl)!));

    test('with no base tag and absolute true', () => {
      const url = 'index.html' as PackageRelativeUrl;
      const expected =
          ('<html>' +
           '<link rel="prefetch" href="/bower_components/polymer/polymer.html">' +
           '<link rel="prefetch" href="/src/my-icons.html">' +
           '<body>foo</body></html>');
      const actual =
          createLinks(urlResolver, html, urlResolver.resolve(url)!, deps, true);
      assert.equal(actual, expected);
    });

    test('with a base tag and absolute true', () => {
      const url = 'index.html' as PackageRelativeUrl;
      const expected =
          ('<html><base href="/base/">' +
           '<link rel="prefetch" href="bower_components/polymer/polymer.html">' +
           '<link rel="prefetch" href="src/my-icons.html">' +
           '<body>foo</body></html>');
      const actual = createLinks(
          urlResolver, htmlWithBase, urlResolver.resolve(url)!, deps, true);
      assert.equal(actual, expected);
    });
  });
开发者ID:MehdiRaash,项目名称:tools,代码行数:33,代码来源:prefetch-links_test.ts


示例2: test

 test('urlMapper: fn(), applies bundle url mapper function', async () => {
   const urlResolver = new FsUrlResolver(projectOptions.root);
   await setupTest(projectOptions, {
     urlMapper: (bundles: Bundle[]) => {
       const map = new Map<ResolvedUrl, Bundle>();
       for (const bundle of bundles) {
         map.set(
             urlResolver.resolve(
                 `bundled/${
                         [...bundle.entrypoints]
                             .map((u) => urlResolver.relative(u))
                             .join()}` as PackageRelativeUrl)!,
             bundle);
       }
       return map;
     }
   });
   assert.isOk(getFile('bundled/shell.html'));
 });
开发者ID:MehdiRaash,项目名称:tools,代码行数:19,代码来源:bundle_test.ts


示例3: test

 test('with a base tag and absolute true', () => {
   const url = 'index.html' as PackageRelativeUrl;
   const expected =
       ('<html><base href="/base/">' +
        '<link rel="prefetch" href="bower_components/polymer/polymer.html">' +
        '<link rel="prefetch" href="src/my-icons.html">' +
        '<body>foo</body></html>');
   const actual = createLinks(
       urlResolver, htmlWithBase, urlResolver.resolve(url)!, deps, true);
   assert.equal(actual, expected);
 });
开发者ID:MehdiRaash,项目名称:tools,代码行数:11,代码来源:prefetch-links_test.ts


示例4:

 urlMapper: (bundles: Bundle[]) => {
   const map = new Map<ResolvedUrl, Bundle>();
   for (const bundle of bundles) {
     map.set(
         urlResolver.resolve(
             `bundled/${
                     [...bundle.entrypoints]
                         .map((u) => urlResolver.relative(u))
                         .join()}` as PackageRelativeUrl)!,
         bundle);
   }
   return map;
 }
开发者ID:MehdiRaash,项目名称:tools,代码行数:13,代码来源:bundle_test.ts


示例5:

 ].map((u) => urlResolver.resolve(u as PackageRelativeUrl)!));
开发者ID:MehdiRaash,项目名称:tools,代码行数:1,代码来源:prefetch-links_test.ts


示例6:

 .map((redirect: string) => {
   const [prefix, path] = redirect.split('|');
   const resolvedPrefix = urlResolver.resolve(prefix as any);
   return {prefix: resolvedPrefix, path};
 })
开发者ID:Polymer,项目名称:vulcanize,代码行数:5,代码来源:polymer-bundler.ts


示例7:

 ].map((u: any) => urlResolver.resolve(u)!));
开发者ID:Polymer,项目名称:polymer-build,代码行数:1,代码来源:prefetch-links_test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript polymer-analyzer.PackageUrlResolver类代码示例发布时间:2022-05-25
下一篇:
TypeScript polymer-analyzer.Document类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap