當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript polymer-analyzer.FsUrlResolver類代碼示例

本文整理匯總了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;未經允許,請勿轉載。