hexo-component-inferno 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,7 @@ const PROVIDERS = {
12
12
  cdnjs: '[cdnjs]https://cdnjs.cloudflare.com/ajax/libs/${ package }/${ version }/${ filename }',
13
13
  loli: '[cdnjs]https://cdnjs.loli.net/ajax/libs/${ package }/${ version }/${ filename }',
14
14
  jsdelivr: 'https://cdn.jsdelivr.net/npm/${ package }@${ version }/${ filename }',
15
- unpkg: 'https://unpkg.com/${ package }@${ version }/${ filename }',
16
- bootcdn: '[cdnjs]https://cdn.bootcdn.net/ajax/libs/${ package }/${ version }/${ filename }',
17
- '75cdn': '[cdnjs]https://lib.baomitu.com/${ package }/${ version }/${ filename }'
15
+ unpkg: 'https://unpkg.com/${ package }@${ version }/${ filename }'
18
16
  },
19
17
  FONT: {
20
18
  google: 'https://fonts.googleapis.com/${ type }?family=${ fontname }',
@@ -23,10 +21,8 @@ const PROVIDERS = {
23
21
  ustc: 'https://fonts.lug.ustc.edu.cn/${ type }?family=${ fontname }'
24
22
  },
25
23
  ICON: {
26
- loli: 'https://cdnjs.loli.net/ajax/libs/font-awesome/5.15.2/css/all.min.css',
27
- fontawesome: 'https://use.fontawesome.com/releases/v5.15.2/css/all.css',
28
- bootcdn: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css',
29
- '75cdn': 'https://lib.baomitu.com/font-awesome/5.12.1/css/all.min.css'
24
+ loli: 'https://cdnjs.loli.net/ajax/libs/font-awesome/6.0.0/css/all.min.css',
25
+ fontawesome: 'https://use.fontawesome.com/releases/v6.0.0/css/all.css'
30
26
  }
31
27
  };
32
28
  /**
@@ -45,8 +41,6 @@ const CDNJS_FIXTURES = {
45
41
  katex: (ver, fname) => ['KaTeX', ver, fname],
46
42
  'pace-js': (ver, fname) => ['pace', ver, fname],
47
43
  clipboard: (ver, fname) => ['clipboard.js', ver, fname],
48
- // disqusjs is not hosted on CDN.js
49
- disqusjs: (ver, fname) => [],
50
44
  cookieconsent: (ver, fname) => ['cookieconsent', ver, fname.startsWith('build/') ? fname.substr(6) : fname],
51
45
  '@waline/client': (ver, fname) => ['waline', ver, fname]
52
46
  };
@@ -17,59 +17,45 @@ describe('Get JavaScript library URL', () => {
17
17
  let cases;
18
18
  beforeEach(async () => {
19
19
  const cdn = hexo.extend.helper.get('cdn').bind(hexo);
20
- cases = [() => cdn('jquery', '3.0.0', 'dist/jquery.min.js'), () => cdn('moment', '2.24.0', 'min/moment.min.js'), () => cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.js'), () => cdn('highlight.js', '9.18.1', 'styles/a11y-dark.css'), () => cdn('mathjax', '2.7.6', 'unpacked/MathJax.min.js'), () => cdn('pace-js', '1.0.2', 'pace.min.js'), () => cdn('katex', '0.11.1', 'dist/katex.min.js'), () => cdn('clipboard', '2.0.6', 'dist/clipboard.min.js'), () => cdn('disqusjs', '1.2.6', 'dist/disqus.min.js'), () => cdn('algoliasearch', '4.0.3', 'dist/algoliasearch-lite.umd.js'), () => cdn('instantsearch.js', '4.3.1', 'dist/instantsearch.production.min.js'), () => cdn('cookieconsent', '3.1.1', 'build/cookieconsent.min.js'), () => cdn('@waline/client', '1.5.4', 'dist/Waline.min.js'), () => cdn('example', '1.0.0', 'example.js')];
20
+ cases = [() => cdn('jquery', '3.0.0', 'dist/jquery.min.js'), () => cdn('moment', '2.24.0', 'min/moment.min.js'), () => cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.js'), () => cdn('highlight.js', '9.18.1', 'styles/a11y-dark.css'), () => cdn('mathjax', '2.7.6', 'unpacked/MathJax.min.js'), () => cdn('pace-js', '1.0.2', 'pace.min.js'), () => cdn('katex', '0.11.1', 'dist/katex.min.js'), () => cdn('clipboard', '2.0.6', 'dist/clipboard.min.js'), () => cdn('disqusjs', '1.3.0', 'dist/disqus.min.js'), () => cdn('algoliasearch', '4.0.3', 'dist/algoliasearch-lite.umd.js'), () => cdn('instantsearch.js', '4.3.1', 'dist/instantsearch.production.min.js'), () => cdn('cookieconsent', '3.1.1', 'build/cookieconsent.min.js'), () => cdn('@waline/client', '2.6.3', 'dist/waline.js'), () => cdn('twikoo', '1.6.6', 'dist/twikoo.all.min.js'), () => cdn('example', '1.0.0', 'example.js')];
21
21
  });
22
22
  test('jsdelivr', () => {
23
- const expected = ['https://cdn.jsdelivr.net/npm/jquery@3.0.0/dist/jquery.min.js', 'https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment.min.js', 'https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://cdn.jsdelivr.net/npm/highlight.js@9.18.1/styles/a11y-dark.css', 'https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.min.js', 'https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js', 'https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js', 'https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://cdn.jsdelivr.net/npm/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://cdn.jsdelivr.net/npm/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://cdn.jsdelivr.net/npm/@waline/client@1.5.4/dist/Waline.min.js', 'https://cdn.jsdelivr.net/npm/example@1.0.0/example.js'];
23
+ const expected = ['https://cdn.jsdelivr.net/npm/jquery@3.0.0/dist/jquery.min.js', 'https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment.min.js', 'https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://cdn.jsdelivr.net/npm/highlight.js@9.18.1/styles/a11y-dark.css', 'https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.min.js', 'https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js', 'https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js', 'https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.3.0/dist/disqus.min.js', 'https://cdn.jsdelivr.net/npm/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://cdn.jsdelivr.net/npm/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://cdn.jsdelivr.net/npm/@waline/client@2.6.3/dist/waline.js', 'https://cdn.jsdelivr.net/npm/twikoo@1.6.6/dist/twikoo.all.min.js', 'https://cdn.jsdelivr.net/npm/example@1.0.0/example.js'];
24
24
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
25
25
  });
26
26
  test('unpkg', () => {
27
27
  hexo.config.providers = {
28
28
  cdn: 'unpkg'
29
29
  };
30
- const expected = ['https://unpkg.com/jquery@3.0.0/dist/jquery.min.js', 'https://unpkg.com/moment@2.24.0/min/moment.min.js', 'https://unpkg.com/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://unpkg.com/highlight.js@9.18.1/styles/a11y-dark.css', 'https://unpkg.com/mathjax@2.7.6/unpacked/MathJax.js', 'https://unpkg.com/pace-js@1.0.2/pace.min.js', 'https://unpkg.com/katex@0.11.1/dist/katex.min.js', 'https://unpkg.com/clipboard@2.0.6/dist/clipboard.min.js', 'https://unpkg.com/disqusjs@1.2.6/dist/disqus.js', 'https://unpkg.com/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://unpkg.com/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://unpkg.com/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://unpkg.com/@waline/client@1.5.4/dist/Waline.min.js', 'https://unpkg.com/example@1.0.0/example.js'];
30
+ const expected = ['https://unpkg.com/jquery@3.0.0/dist/jquery.min.js', 'https://unpkg.com/moment@2.24.0/min/moment.min.js', 'https://unpkg.com/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://unpkg.com/highlight.js@9.18.1/styles/a11y-dark.css', 'https://unpkg.com/mathjax@2.7.6/unpacked/MathJax.js', 'https://unpkg.com/pace-js@1.0.2/pace.min.js', 'https://unpkg.com/katex@0.11.1/dist/katex.min.js', 'https://unpkg.com/clipboard@2.0.6/dist/clipboard.min.js', 'https://unpkg.com/disqusjs@1.3.0/dist/disqus.js', 'https://unpkg.com/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://unpkg.com/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://unpkg.com/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://unpkg.com/@waline/client@2.6.3/dist/waline.js', 'https://unpkg.com/twikoo@1.6.6/dist/twikoo.all.min.js', 'https://unpkg.com/example@1.0.0/example.js'];
31
31
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
32
32
  });
33
33
  test('cdnjs', () => {
34
34
  hexo.config.providers = {
35
35
  cdn: 'cdnjs'
36
36
  };
37
- const expected = ['https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://cdnjs.cloudflare.com/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/waline/1.5.4/Waline.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/example/1.0.0/example.js'];
37
+ const expected = ['https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/disqusjs/1.3.0/disqus.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://cdnjs.cloudflare.com/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/waline/2.6.3/waline.js', 'https://cdnjs.cloudflare.com/ajax/libs/twikoo/1.6.6/twikoo.all.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/example/1.0.0/example.js'];
38
38
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
39
39
  });
40
40
  test('loli', () => {
41
41
  hexo.config.providers = {
42
42
  cdn: 'loli'
43
43
  };
44
- const expected = ['https://cdnjs.loli.net/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://cdnjs.loli.net/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://cdnjs.loli.net/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://cdnjs.loli.net/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://cdnjs.loli.net/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://cdnjs.loli.net/ajax/libs/pace/1.0.2/pace.min.js', 'https://cdnjs.loli.net/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://cdnjs.loli.net/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://cdnjs.loli.net/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://cdnjs.loli.net/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://cdnjs.loli.net/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://cdnjs.loli.net/ajax/libs/waline/1.5.4/Waline.min.js', 'https://cdnjs.loli.net/ajax/libs/example/1.0.0/example.js'];
45
- cases.forEach((func, i) => expect(func()).toBe(expected[i]));
46
- });
47
- test('bootcdn', () => {
48
- hexo.config.providers = {
49
- cdn: 'bootcdn'
50
- };
51
- const expected = ['https://cdn.bootcdn.net/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://cdn.bootcdn.net/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://cdn.bootcdn.net/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://cdn.bootcdn.net/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://cdn.bootcdn.net/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://cdn.bootcdn.net/ajax/libs/pace/1.0.2/pace.min.js', 'https://cdn.bootcdn.net/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://cdn.bootcdn.net/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://cdn.bootcdn.net/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://cdn.bootcdn.net/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://cdn.bootcdn.net/ajax/libs/waline/1.5.4/Waline.min.js', 'https://cdn.bootcdn.net/ajax/libs/example/1.0.0/example.js'];
52
- cases.forEach((func, i) => expect(func()).toBe(expected[i]));
53
- });
54
- test('75cdn', () => {
55
- hexo.config.providers = {
56
- cdn: '75cdn'
57
- };
58
- const expected = ['https://lib.baomitu.com/jquery/3.0.0/jquery.min.js', 'https://lib.baomitu.com/moment.js/2.24.0/moment.min.js', 'https://lib.baomitu.com/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://lib.baomitu.com/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://lib.baomitu.com/mathjax/2.7.6/MathJax.js', 'https://lib.baomitu.com/pace/1.0.2/pace.min.js', 'https://lib.baomitu.com/KaTeX/0.11.1/katex.min.js', 'https://lib.baomitu.com/clipboard.js/2.0.6/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://lib.baomitu.com/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://lib.baomitu.com/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://lib.baomitu.com/cookieconsent/3.1.1/cookieconsent.min.js', 'https://lib.baomitu.com/waline/1.5.4/Waline.min.js', 'https://lib.baomitu.com/example/1.0.0/example.js'];
44
+ const expected = ['https://cdnjs.loli.net/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://cdnjs.loli.net/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://cdnjs.loli.net/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://cdnjs.loli.net/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://cdnjs.loli.net/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://cdnjs.loli.net/ajax/libs/pace/1.0.2/pace.min.js', 'https://cdnjs.loli.net/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://cdnjs.loli.net/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdnjs.loli.net/ajax/libs/disqusjs/1.3.0/disqus.min.js', 'https://cdnjs.loli.net/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://cdnjs.loli.net/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://cdnjs.loli.net/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://cdnjs.loli.net/ajax/libs/waline/2.6.3/waline.js', 'https://cdnjs.loli.net/ajax/libs/twikoo/1.6.6/twikoo.all.min.js', 'https://cdnjs.loli.net/ajax/libs/example/1.0.0/example.js'];
59
45
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
60
46
  });
61
47
  test('Custom CDN', () => {
62
48
  hexo.config.providers = {
63
49
  cdn: 'https://my.cdn/${ package }@${ version }/${ filename }'
64
50
  };
65
- const expected = ['https://my.cdn/jquery@3.0.0/dist/jquery.min.js', 'https://my.cdn/moment@2.24.0/min/moment.min.js', 'https://my.cdn/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://my.cdn/highlight.js@9.18.1/styles/a11y-dark.css', 'https://my.cdn/mathjax@2.7.6/unpacked/MathJax.min.js', 'https://my.cdn/pace-js@1.0.2/pace.min.js', 'https://my.cdn/katex@0.11.1/dist/katex.min.js', 'https://my.cdn/clipboard@2.0.6/dist/clipboard.min.js', 'https://my.cdn/disqusjs@1.2.6/dist/disqus.min.js', 'https://my.cdn/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://my.cdn/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://my.cdn/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://my.cdn/@waline/client@1.5.4/dist/Waline.min.js', 'https://my.cdn/example@1.0.0/example.js'];
51
+ const expected = ['https://my.cdn/jquery@3.0.0/dist/jquery.min.js', 'https://my.cdn/moment@2.24.0/min/moment.min.js', 'https://my.cdn/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js', 'https://my.cdn/highlight.js@9.18.1/styles/a11y-dark.css', 'https://my.cdn/mathjax@2.7.6/unpacked/MathJax.min.js', 'https://my.cdn/pace-js@1.0.2/pace.min.js', 'https://my.cdn/katex@0.11.1/dist/katex.min.js', 'https://my.cdn/clipboard@2.0.6/dist/clipboard.min.js', 'https://my.cdn/disqusjs@1.3.0/dist/disqus.min.js', 'https://my.cdn/algoliasearch@4.0.3/dist/algoliasearch-lite.umd.js', 'https://my.cdn/instantsearch.js@4.3.1/dist/instantsearch.production.min.js', 'https://my.cdn/cookieconsent@3.1.1/build/cookieconsent.min.js', 'https://my.cdn/@waline/client@2.6.3/dist/waline.js', 'https://my.cdn/twikoo@1.6.6/dist/twikoo.all.min.js', 'https://my.cdn/example@1.0.0/example.js'];
66
52
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
67
53
  });
68
54
  test('Custom CDN.js-style CDN', () => {
69
55
  hexo.config.providers = {
70
56
  cdn: '[cdnjs]https://my.cdn/ajax/libs/${ package }/${ version }/${ filename }'
71
57
  };
72
- const expected = ['https://my.cdn/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://my.cdn/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://my.cdn/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://my.cdn/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://my.cdn/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://my.cdn/ajax/libs/pace/1.0.2/pace.min.js', 'https://my.cdn/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://my.cdn/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://cdn.jsdelivr.net/npm/disqusjs@1.2.6/dist/disqus.min.js', 'https://my.cdn/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://my.cdn/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://my.cdn/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://my.cdn/ajax/libs/waline/1.5.4/Waline.min.js', 'https://my.cdn/ajax/libs/example/1.0.0/example.js'];
58
+ const expected = ['https://my.cdn/ajax/libs/jquery/3.0.0/jquery.min.js', 'https://my.cdn/ajax/libs/moment.js/2.24.0/moment.min.js', 'https://my.cdn/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.js', 'https://my.cdn/ajax/libs/highlight.js/9.18.1/styles/a11y-dark.min.css', 'https://my.cdn/ajax/libs/mathjax/2.7.6/MathJax.js', 'https://my.cdn/ajax/libs/pace/1.0.2/pace.min.js', 'https://my.cdn/ajax/libs/KaTeX/0.11.1/katex.min.js', 'https://my.cdn/ajax/libs/clipboard.js/2.0.6/clipboard.min.js', 'https://my.cdn/ajax/libs/disqusjs/1.3.0/disqus.min.js', 'https://my.cdn/ajax/libs/algoliasearch/4.0.3/algoliasearch-lite.umd.js', 'https://my.cdn/ajax/libs/instantsearch.js/4.3.1/instantsearch.production.min.js', 'https://my.cdn/ajax/libs/cookieconsent/3.1.1/cookieconsent.min.js', 'https://my.cdn/ajax/libs/waline/2.6.3/waline.js', 'https://my.cdn/ajax/libs/twikoo/1.6.6/twikoo.all.min.js', 'https://my.cdn/ajax/libs/example/1.0.0/example.js'];
73
59
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
74
60
  });
75
61
  });
@@ -125,28 +111,14 @@ describe('Get icon font URL', () => {
125
111
  hexo.config.providers = {
126
112
  iconcdn: 'fontawesome'
127
113
  };
128
- const expected = ['https://use.fontawesome.com/releases/v5.15.2/css/all.css'];
114
+ const expected = ['https://use.fontawesome.com/releases/v6.0.0/css/all.css'];
129
115
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
130
116
  });
131
117
  test('loli', () => {
132
118
  hexo.config.providers = {
133
119
  iconcdn: 'loli'
134
120
  };
135
- const expected = ['https://cdnjs.loli.net/ajax/libs/font-awesome/5.15.2/css/all.min.css'];
136
- cases.forEach((func, i) => expect(func()).toBe(expected[i]));
137
- });
138
- test('bootcdn', () => {
139
- hexo.config.providers = {
140
- iconcdn: 'bootcdn'
141
- };
142
- const expected = ['https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css'];
143
- cases.forEach((func, i) => expect(func()).toBe(expected[i]));
144
- });
145
- test('75cdn', () => {
146
- hexo.config.providers = {
147
- iconcdn: '75cdn'
148
- };
149
- const expected = ['https://lib.baomitu.com/font-awesome/5.12.1/css/all.min.css'];
121
+ const expected = ['https://cdnjs.loli.net/ajax/libs/font-awesome/6.0.0/css/all.min.css'];
150
122
  cases.forEach((func, i) => expect(func()).toBe(expected[i]));
151
123
  });
152
124
  test('Custom web font CDN', () => {
@@ -6,6 +6,10 @@ const Hexo = require('hexo');
6
6
 
7
7
  const cheerio = require('cheerio');
8
8
 
9
+ const {
10
+ minify
11
+ } = require('html-minifier');
12
+
9
13
  const register = require('./message');
10
14
 
11
15
  const rootDir = join(__dirname, '../../../fixture/site');
@@ -17,6 +21,11 @@ const cheerioOptions = {
17
21
  normalizeWhitespace: true
18
22
  }
19
23
  };
24
+ const minifierOptions = {
25
+ collapseWhitespace: true,
26
+ conservativeCollapse: true,
27
+ keepClosingSlash: true
28
+ };
20
29
  beforeAll(async () => {
21
30
  await hexo.init();
22
31
  await hexo.load();
@@ -27,10 +36,10 @@ test('create default message', async () => {
27
36
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
28
37
  let source = '{% message %}**content**{% endmessage %}';
29
38
  let actual = cheerio.load(await render(source), cheerioOptions, false).html();
30
- expect(actual).toEqual('<article class="message"> <div class="message-body"> ' + '<p><strong>content</strong></p> </div> </article>');
39
+ expect(minify(actual, minifierOptions)).toEqual('<article class="message"> <div class="message-body"> ' + '<p><strong>content</strong></p> </div> </article>');
31
40
  source = '{% message %}\n# title\n{% endmessage %}';
32
41
  actual = cheerio.load(await render(source), cheerioOptions, false).html();
33
- expect(actual).toEqual('<article class="message"> <div class="message-body"> ' + '<h1 id="title"><a href="#title" class="headerlink" title="title"/>title</h1> ' + '</div> </article>');
42
+ expect(minify(actual, minifierOptions)).toEqual('<article class="message"> <div class="message-body"> ' + '<h1 id="title"><a href="#title" class="headerlink" title="title"/>title</h1> ' + '</div> </article>');
34
43
  });
35
44
  test('create message with different colors', async () => {
36
45
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
@@ -38,7 +47,7 @@ test('create message with different colors', async () => {
38
47
  for (const color of ['dark', 'primary', 'link', 'info', 'success', 'warning', 'danger']) {
39
48
  const source = `{% message color:${color} %}content{% endmessage %}`;
40
49
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
41
- expect(actual).toEqual(`<article class="message is-${color}"> <div class="message-body"> <p>content</p> ` + '</div> </article>');
50
+ expect(minify(actual, minifierOptions)).toEqual(`<article class="message is-${color}"> <div class="message-body"> <p>content</p> ` + '</div> </article>');
42
51
  }
43
52
  });
44
53
  test('create message with different sizes', async () => {
@@ -47,24 +56,24 @@ test('create message with different sizes', async () => {
47
56
  for (const size of ['small', 'medium', 'large']) {
48
57
  const source = `{% message size:${size} %}content{% endmessage %}`;
49
58
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
50
- expect(actual).toEqual(`<article class="message is-${size}"> <div class="message-body"> <p>content</p> ` + '</div> </article>');
59
+ expect(minify(actual, minifierOptions)).toEqual(`<article class="message is-${size}"> <div class="message-body"> <p>content</p> ` + '</div> </article>');
51
60
  }
52
61
  });
53
62
  test('create message with an icon', async () => {
54
63
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
55
64
  const source = '{% message "icon:fas fas-file" %}content{% endmessage %}';
56
65
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
57
- expect(actual).toEqual('<article class="message"> <div class="message-header"><p>' + '<i class="fas fas-file mr-2"/></p> </div> <div class="message-body"> <p>content</p> ' + '</div> </article>');
66
+ expect(minify(actual, minifierOptions)).toEqual('<article class="message"> <div class="message-header"><p>' + '<i class="fas fas-file mr-2"/></p> </div> <div class="message-body"> <p>content</p> ' + '</div> </article>');
58
67
  });
59
68
  test('create message with a title', async () => {
60
69
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
61
70
  const source = '{% message "title:*message title*" %}content{% endmessage %}';
62
71
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
63
- expect(actual).toEqual('<article class="message"> <div class="message-header"><p>' + '<em>message title</em></p> </div> <div class="message-body"> <p>content</p> ' + '</div> </article>');
72
+ expect(minify(actual, minifierOptions)).toEqual('<article class="message"> <div class="message-header"><p>' + '<em>message title</em></p> </div> <div class="message-body"> <p>content</p> ' + '</div> </article>');
64
73
  });
65
74
  test('create message with all properties', async () => {
66
75
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
67
76
  const source = '{% message color:success size:small "icon:fas fas-file" ' + '"title:*message title*" %}content{% endmessage %}';
68
77
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
69
- expect(actual).toEqual('<article class="message is-success is-small"> <div class="message-header"><p>' + '<i class="fas fas-file mr-2"/><em>message title</em></p> </div> ' + '<div class="message-body"> <p>content</p> </div> </article>');
78
+ expect(minify(actual, minifierOptions)).toEqual('<article class="message is-success is-small"> <div class="message-header"><p>' + '<i class="fas fas-file mr-2"/><em>message title</em></p> </div> ' + '<div class="message-body"> <p>content</p> </div> </article>');
70
79
  });
@@ -4,6 +4,10 @@ const {
4
4
 
5
5
  const Hexo = require('hexo');
6
6
 
7
+ const {
8
+ minify
9
+ } = require('html-minifier');
10
+
7
11
  const cheerio = require('cheerio');
8
12
 
9
13
  const register = require('./tabs');
@@ -17,6 +21,11 @@ const cheerioOptions = {
17
21
  normalizeWhitespace: true
18
22
  }
19
23
  };
24
+ const minifierOptions = {
25
+ collapseWhitespace: true,
26
+ conservativeCollapse: true,
27
+ keepClosingSlash: true
28
+ };
20
29
  beforeAll(async () => {
21
30
  await hexo.init();
22
31
  await hexo.load();
@@ -27,7 +36,7 @@ test('create default tabs', async () => {
27
36
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
28
37
  let source = '{% tabs %}<!--tab id:tab1-->**content**<!--endtab-->{% endtabs %}';
29
38
  let actual = cheerio.load(await render(source), cheerioOptions, false).html();
30
- expect(actual).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> </li> </ul> ' + '</div> <div id="tab1" class="tab-content is-hidden"> <p><strong>content</strong></p> </div>');
39
+ expect(minify(actual, minifierOptions)).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> </li> </ul> ' + '</div> <div id="tab1" class="tab-content is-hidden"> <p><strong>content</strong></p> </div>');
31
40
  source = `{% tabs %}
32
41
  <!-- tab --># title 1<!-- endtab -->
33
42
  <!-- tab --># title 2<!-- endtab -->
@@ -35,7 +44,7 @@ test('create default tabs', async () => {
35
44
  const $ = cheerio.load(await render(source), cheerioOptions, false);
36
45
  const [tabId1, tabId2] = $('.tab-content').get().map(element => $(element).attr('id'));
37
46
  actual = $.html();
38
- expect(actual).toEqual(`<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#${tabId1}"> </a> ` + `</li><li> <a href="#${tabId2}"> </a> </li> </ul> </div> ` + `<div id="${tabId1}" class="tab-content is-hidden"> <h1 id="title-1">` + '<a href="#title-1" class="headerlink" title="title 1"/>title 1</h1> </div>' + `<div id="${tabId2}" class="tab-content is-hidden"> <h1 id="title-2">` + '<a href="#title-2" class="headerlink" title="title 2"/>title 2</h1> </div>');
47
+ expect(minify(actual, minifierOptions)).toEqual(`<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#${tabId1}"> </a> ` + `</li><li> <a href="#${tabId2}"> </a> </li> </ul> </div> ` + `<div id="${tabId1}" class="tab-content is-hidden"> <h1 id="title-1">` + '<a href="#title-1" class="headerlink" title="title 1"/>title 1</h1> </div>' + `<div id="${tabId2}" class="tab-content is-hidden"> <h1 id="title-2">` + '<a href="#title-2" class="headerlink" title="title 2"/>title 2</h1> </div>');
39
48
  });
40
49
  test('create tabs with different alignment', async () => {
41
50
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
@@ -43,7 +52,7 @@ test('create tabs with different alignment', async () => {
43
52
  for (const align of ['left', 'centered', 'right', 'fullwidth']) {
44
53
  const source = `{% tabs align:${align} %}<!--tab id:tab1-->content<!--endtab-->{% endtabs %}`;
45
54
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
46
- expect(actual).toEqual(`<div class="tabs my-3 is-${align}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
55
+ expect(minify(actual, minifierOptions)).toEqual(`<div class="tabs my-3 is-${align}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
47
56
  }
48
57
  });
49
58
  test('create tabs with different sizes', async () => {
@@ -52,7 +61,7 @@ test('create tabs with different sizes', async () => {
52
61
  for (const size of ['small', 'medium', 'large']) {
53
62
  const source = `{% tabs size:${size} %}<!--tab id:tab1-->content<!--endtab-->{% endtabs %}`;
54
63
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
55
- expect(actual).toEqual(`<div class="tabs my-3 is-${size}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
64
+ expect(minify(actual, minifierOptions)).toEqual(`<div class="tabs my-3 is-${size}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
56
65
  }
57
66
  });
58
67
  test('create tabs with different styles', async () => {
@@ -62,7 +71,7 @@ test('create tabs with different styles', async () => {
62
71
  const source = `{% tabs style:${style} %}<!--tab id:tab1-->content<!--endtab-->{% endtabs %}`;
63
72
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
64
73
  const classname = style === 'toggle-rounded' ? 'toggle is-toggle-rounded' : style;
65
- expect(actual).toEqual(`<div class="tabs my-3 is-${classname}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
74
+ expect(minify(actual, minifierOptions)).toEqual(`<div class="tabs my-3 is-${classname}"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ` + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>content</p> </div>');
66
75
  }
67
76
  });
68
77
  test('create tabs with active status', async () => {
@@ -72,19 +81,19 @@ test('create tabs with active status', async () => {
72
81
  <!-- tab id:tab2 active -->tab 2<!-- endtab -->
73
82
  {% endtabs %}`;
74
83
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
75
- expect(actual).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ' + '</li><li class="is-active"> <a href="#tab2"> </a> </li> </ul> </div> ' + '<div id="tab1" class="tab-content is-hidden"> <p>tab 1</p> </div>' + '<div id="tab2" class="tab-content"> <p>tab 2</p> </div>');
84
+ expect(minify(actual, minifierOptions)).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> </a> ' + '</li><li class="is-active"> <a href="#tab2"> </a> </li> </ul> </div> ' + '<div id="tab1" class="tab-content is-hidden"> <p>tab 1</p> </div>' + '<div id="tab2" class="tab-content"> <p>tab 2</p> </div>');
76
85
  });
77
86
  test('create tabs with a title', async () => {
78
87
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
79
88
  const source = '{% tabs %}<!--tab id:tab1 "title:Tab Title"-->tab<!--endtab-->{% endtabs %}';
80
89
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
81
- expect(actual).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> <p>Tab Title</p> </a> ' + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> <p>tab</p> </div>');
90
+ expect(minify(actual, minifierOptions)).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> <p>Tab Title</p> </a> ' + '</li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> <p>tab</p> </div>');
82
91
  });
83
92
  test('create tabs with an icon', async () => {
84
93
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
85
94
  const source = '{% tabs %}<!--tab id:tab1 "icon:fab fa-github"-->tab<!--endtab-->{% endtabs %}';
86
95
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
87
- expect(actual).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> ' + '<span class="icon is-small ml-0"> <i class="fab fa-github" aria-hidden="true"/> ' + '</span> </a> </li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>tab</p> </div>');
96
+ expect(minify(actual, minifierOptions)).toEqual('<div class="tabs my-3"> <ul class="mx-0 my-0"> <li> <a href="#tab1"> ' + '<span class="icon is-small ml-0"> <i class="fab fa-github" aria-hidden="true"/> ' + '</span> </a> </li> </ul> </div> <div id="tab1" class="tab-content is-hidden"> ' + '<p>tab</p> </div>');
88
97
  });
89
98
  test('create tabs with all properties', async () => {
90
99
  const render = hexo.extend.tag.render.bind(hexo.extend.tag);
@@ -93,5 +102,5 @@ test('create tabs with all properties', async () => {
93
102
  <!-- tab id:tab2 active 'title:Tim\\'s Tab' -->tab 2<!-- endtab -->
94
103
  {% endtabs %}`;
95
104
  const actual = cheerio.load(await render(source), cheerioOptions, false).html();
96
- expect(actual).toEqual('<div class="tabs my-3 is-fullwidth is-large is-boxed"> <ul class="mx-0 my-0"> <li> ' + '<a href="#tab1"> <span class="icon is-small ml-0"> ' + '<i class="fas\\ fa-file" aria-hidden="true"/> </span> </a> </li><li class="is-active"> ' + '<a href="#tab2"> <p>Tim&apos;s Tab</p> </a> </li> </ul> </div> ' + '<div id="tab1" class="tab-content is-hidden"> <p>tab 1</p> </div>' + '<div id="tab2" class="tab-content"> <p>tab 2</p> </div>');
105
+ expect(minify(actual, minifierOptions)).toEqual('<div class="tabs my-3 is-fullwidth is-large is-boxed"> <ul class="mx-0 my-0"> <li> ' + '<a href="#tab1"> <span class="icon is-small ml-0"> ' + '<i class="fas\\ fa-file" aria-hidden="true"/> </span> </a> </li><li class="is-active"> ' + '<a href="#tab2"> <p>Tim&apos;s Tab</p> </a> </li> </ul> </div> ' + '<div id="tab1" class="tab-content is-hidden"> <p>tab 1</p> </div>' + '<div id="tab2" class="tab-content"> <p>tab 2</p> </div>');
97
106
  });
@@ -10,7 +10,18 @@
10
10
  },
11
11
  "env_id": {
12
12
  "type": "string",
13
- "description": "envId from Tencent CloudBase"
13
+ "description": "envId from Tencent CloudBase or Vercel URL"
14
+ },
15
+ "region": {
16
+ "type": "string",
17
+ "description": "Region of Tencent CloudBase",
18
+ "nullable": true
19
+ },
20
+ "lang": {
21
+ "type": "string",
22
+ "description": "i18n support",
23
+ "default": "zh-CN",
24
+ "nullable": true
14
25
  }
15
26
  },
16
27
  "required": ["type", "env_id"]
@@ -14,19 +14,18 @@
14
14
  },
15
15
  "path": {
16
16
  "type": "string",
17
- "description": "Article path id. Used to distinguish different article pages to ensure loading the correct comment list under the article page."
17
+ "description": "Article path id."
18
18
  },
19
19
  "lang": {
20
20
  "type": "string",
21
21
  "description": "Display language.",
22
- "enum": ["zh", "zh-CN", "zh-TW", "en", "en-US", "jp", "jp-JP"],
22
+ "enum": ["zh", "zh-CN", "zh-TW", "en", "en-US", "jp", "jp-JP", "pt-BR", "ru", "ru-RU"],
23
23
  "default": "zh-CN",
24
24
  "nullable": true
25
25
  },
26
- "visitor": {
27
- "type": "boolean",
28
- "description": "Show visitor count",
29
- "default": false,
26
+ "locale": {
27
+ "type": "object",
28
+ "description": "I18n configurations",
30
29
  "nullable": true
31
30
  },
32
31
  "emoji": {
@@ -73,11 +72,11 @@
73
72
  ]
74
73
  },
75
74
  "description": "Emoji settings.",
76
- "default": ["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"],
75
+ "default": ["//unpkg.com/@waline/emojis@1.0.1/weibo"],
77
76
  "nullable": true
78
77
  },
79
78
  "dark": {
80
- "type": "string",
79
+ "type": ["string", "boolean"],
81
80
  "description": "Darkmode support.",
82
81
  "nullable": true
83
82
  },
@@ -126,25 +125,43 @@
126
125
  },
127
126
  "page_size": {
128
127
  "type": "number",
129
- "description": "number of comments per page.",
128
+ "description": "Number of comments per page.",
130
129
  "default": 10,
131
130
  "nullable": true
132
131
  },
133
- "upload_image": {
132
+ "image_uploader": {
134
133
  "type": "boolean",
135
- "description": "If you set it to false, image upload feature will be disabled.",
136
- "default": true,
134
+ "description": "Whether to disable the image upload feature.",
135
+ "default": false,
137
136
  "nullable": true
138
137
  },
139
- "highlight": {
138
+ "highlighter": {
140
139
  "type": "boolean",
141
- "description": "Code highlighting, it's enabled by default, please close it selectively.",
142
- "default": true,
140
+ "description": "Whether to disable the code highlight feature.",
141
+ "default": false,
143
142
  "nullable": true
144
143
  },
145
- "math": {
144
+ "tex_renderer": {
146
145
  "type": "boolean",
147
- "description": "If you set it to 'false', math preview feature will be disabled.",
146
+ "description": "Whether to disable TeX rendering.",
147
+ "default": false,
148
+ "nullable": true
149
+ },
150
+ "search": {
151
+ "type": "boolean",
152
+ "description": "Whether to disable the search feature.",
153
+ "default": false,
154
+ "nullable": true
155
+ },
156
+ "pageview": {
157
+ "type": ["string", "boolean"],
158
+ "description": "Whether to show page view count. It can also be a CSS selector to page view count container.",
159
+ "default": false,
160
+ "nullable": true
161
+ },
162
+ "comment": {
163
+ "type": ["string", "boolean"],
164
+ "description": "Whether to show comment count. It can also be a CSS selector to comment count container.",
148
165
  "default": false,
149
166
  "nullable": true
150
167
  },
@@ -153,11 +170,6 @@
153
170
  "description": "Whether show copyright and version in footer.",
154
171
  "default": true,
155
172
  "nullable": true
156
- },
157
- "locale": {
158
- "type": "object",
159
- "description": "I18n configurations",
160
- "nullable": true
161
173
  }
162
174
  },
163
175
  "required": ["type", "server_url"]
@@ -10,7 +10,18 @@
10
10
  },
11
11
  "env_id": {
12
12
  "type": "string",
13
- "description": "envId from Tencent CloudBase"
13
+ "description": "envId from Tencent CloudBase or Vercel URL"
14
+ },
15
+ "region": {
16
+ "type": "string",
17
+ "description": "Region of Tencent CloudBase",
18
+ "nullable": true
19
+ },
20
+ "lang": {
21
+ "type": "string",
22
+ "description": "i18n support",
23
+ "default": "zh-CN",
24
+ "nullable": true
14
25
  }
15
26
  },
16
27
  "required": ["type", "env_id"]
@@ -14,19 +14,18 @@
14
14
  },
15
15
  "path": {
16
16
  "type": "string",
17
- "description": "Article path id. Used to distinguish different article pages to ensure loading the correct comment list under the article page."
17
+ "description": "Article path id."
18
18
  },
19
19
  "lang": {
20
20
  "type": "string",
21
21
  "description": "Display language.",
22
- "enum": ["zh", "zh-CN", "zh-TW", "en", "en-US", "jp", "jp-JP"],
22
+ "enum": ["zh", "zh-CN", "zh-TW", "en", "en-US", "jp", "jp-JP", "pt-BR", "ru", "ru-RU"],
23
23
  "default": "zh-CN",
24
24
  "nullable": true
25
25
  },
26
- "visitor": {
27
- "type": "boolean",
28
- "description": "Show visitor count",
29
- "default": false,
26
+ "locale": {
27
+ "type": "object",
28
+ "description": "I18n configurations",
30
29
  "nullable": true
31
30
  },
32
31
  "emoji": {
@@ -73,11 +72,11 @@
73
72
  ]
74
73
  },
75
74
  "description": "Emoji settings.",
76
- "default": ["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"],
75
+ "default": ["//unpkg.com/@waline/emojis@1.0.1/weibo"],
77
76
  "nullable": true
78
77
  },
79
78
  "dark": {
80
- "type": "string",
79
+ "type": ["string", "boolean"],
81
80
  "description": "Darkmode support.",
82
81
  "nullable": true
83
82
  },
@@ -126,25 +125,43 @@
126
125
  },
127
126
  "page_size": {
128
127
  "type": "number",
129
- "description": "number of comments per page.",
128
+ "description": "Number of comments per page.",
130
129
  "default": 10,
131
130
  "nullable": true
132
131
  },
133
- "upload_image": {
132
+ "image_uploader": {
134
133
  "type": "boolean",
135
- "description": "If you set it to false, image upload feature will be disabled.",
136
- "default": true,
134
+ "description": "Whether to disable the image upload feature.",
135
+ "default": false,
137
136
  "nullable": true
138
137
  },
139
- "highlight": {
138
+ "highlighter": {
140
139
  "type": "boolean",
141
- "description": "Code highlighting, it's enabled by default, please close it selectively.",
142
- "default": true,
140
+ "description": "Whether to disable the code highlight feature.",
141
+ "default": false,
143
142
  "nullable": true
144
143
  },
145
- "math": {
144
+ "tex_renderer": {
146
145
  "type": "boolean",
147
- "description": "If you set it to 'false', math preview feature will be disabled.",
146
+ "description": "Whether to disable TeX rendering.",
147
+ "default": false,
148
+ "nullable": true
149
+ },
150
+ "search": {
151
+ "type": "boolean",
152
+ "description": "Whether to disable the search feature.",
153
+ "default": false,
154
+ "nullable": true
155
+ },
156
+ "pageview": {
157
+ "type": ["string", "boolean"],
158
+ "description": "Whether to show page view count. It can also be a CSS selector to page view count container.",
159
+ "default": false,
160
+ "nullable": true
161
+ },
162
+ "comment": {
163
+ "type": ["string", "boolean"],
164
+ "description": "Whether to show comment count. It can also be a CSS selector to comment count container.",
148
165
  "default": false,
149
166
  "nullable": true
150
167
  },
@@ -153,11 +170,6 @@
153
170
  "description": "Whether show copyright and version in footer.",
154
171
  "default": true,
155
172
  "nullable": true
156
- },
157
- "locale": {
158
- "type": "object",
159
- "description": "I18n configurations",
160
- "nullable": true
161
173
  }
162
174
  },
163
175
  "required": ["type", "server_url"]
@@ -7,6 +7,12 @@
7
7
  "type": {
8
8
  "type": "string",
9
9
  "const": "insight"
10
+ },
11
+ "index_pages": {
12
+ "type": "boolean",
13
+ "description": "Whether to include pages in the search results",
14
+ "default": true,
15
+ "nullable": true
10
16
  }
11
17
  },
12
18
  "required": ["type"]
@@ -7,6 +7,12 @@
7
7
  "type": {
8
8
  "type": "string",
9
9
  "const": "insight"
10
+ },
11
+ "index_pages": {
12
+ "type": "boolean",
13
+ "description": "Whether to include pages in the search results",
14
+ "default": true,
15
+ "nullable": true
10
16
  }
11
17
  },
12
18
  "required": ["type"]
@@ -40,7 +40,9 @@ var _require2 = require('../../util/cache'),
40
40
  * @see https://twikoo.js.org/quick-start.html
41
41
  * @example
42
42
  * <Twikoo
43
- * env_id="Vercel Domain"
43
+ * envId="env_id"
44
+ * region="ap-guangzhou"
45
+ * lang="zh-CN"
44
46
  * jsUrl="/path/to/Twikoo.js" />
45
47
  */
46
48
 
@@ -60,9 +62,11 @@ var Twikoo = /*#__PURE__*/function (_Component) {
60
62
  key: "render",
61
63
  value: function render() {
62
64
  var _this$props = this.props,
63
- env_id = _this$props.env_id,
65
+ envId = _this$props.envId,
66
+ region = _this$props.region,
67
+ lang = _this$props.lang,
64
68
  jsUrl = _this$props.jsUrl;
65
- var js = "Twikoo.init({\n env_id: '".concat(env_id, "'\n });");
69
+ var js = "twikoo.init({\n envId: '".concat(envId, "',\n ").concat(region ? "region: ".concat(JSON.stringify(region), ",") : '', "\n ").concat(lang ? "lang: ".concat(JSON.stringify(lang), ",") : '', "\n });");
66
70
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "content twikoo", null, 1, {
67
71
  "id": "twikoo"
68
72
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
@@ -87,16 +91,23 @@ var Twikoo = /*#__PURE__*/function (_Component) {
87
91
  * @example
88
92
  * <Twikoo.Cacheable
89
93
  * comment={{
90
- * env_id: "https://path/to/vercel/domain"
91
- * }}
94
+ * env_id: "env_id",
95
+ * region: "ap-guangzhou",
96
+ * lang: "zh-CN",
97
+ * }} />
92
98
  */
93
99
 
94
100
 
95
101
  Twikoo.Cacheable = cacheComponent(Twikoo, 'comment.twikoo', function (props) {
96
- var comment = props.comment;
102
+ var comment = props.comment,
103
+ helper = props.helper,
104
+ page = props.page,
105
+ config = props.config;
97
106
  return {
98
- env_id: comment.env_id,
99
- jsUrl: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/twikoo/1.4.18/twikoo.all.min.js'
107
+ envId: comment.env_id,
108
+ region: comment.region,
109
+ lang: comment.lang || page.lang || page.language || config.language || 'zh-CN',
110
+ jsUrl: helper.cdn('twikoo', '1.6.6', 'dist/twikoo.all.min.js')
100
111
  };
101
112
  });
102
113
  module.exports = Twikoo;
@@ -117,7 +117,7 @@ var Utterances = /*#__PURE__*/function (_Component) {
117
117
  * @example
118
118
  * <Utterances.Cacheable
119
119
  * comment={{
120
- * repo: '******',
120
+ * repo: "******",
121
121
  * issue_term: "******"
122
122
  * issue_number: {123}
123
123
  * label: "******"
@@ -141,7 +141,7 @@ var Valine = /*#__PURE__*/function (_Component) {
141
141
  * placeholder: "******"
142
142
  * avatar: "mm"
143
143
  * avatar_force: false
144
- * meta: ['nick', 'mail', 'link']
144
+ * meta: ["nick", "mail", "link"]
145
145
  * page_size: 10
146
146
  * lang: "zh-CN"
147
147
  * visitor: false
@@ -42,19 +42,22 @@ var _require2 = require('../../util/cache'),
42
42
  * serverURL="https://path/to/waline/server"
43
43
  * path="window.location.pathname"
44
44
  * lang="zh-CN"
45
- * visitor={false}
46
- * emoji={['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']}
47
- * dark=""
48
- * meta={['nick', 'mail', 'link']}
45
+ * locale={{placeholder: "", ...}}
46
+ * emoji={["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"]}
47
+ * dark="auto"
48
+ * meta={["nick", "mail", "link"]}
49
49
  * requiredMeta={[]}
50
50
  * login="enable"
51
51
  * wordLimit={0},
52
52
  * pageSize={10}
53
- * uploadImage={true}
54
- * highlight={true}
55
- * math={false}
53
+ * imageUploader={true}
54
+ * highlighter={true}
55
+ * texRenderer={false}
56
+ * search={true}
57
+ * visitor={false}
58
+ * pageview={false}
59
+ * comment={false}
56
60
  * copyright={true}
57
- * locale={{placeholder: '', ...}}
58
61
  * jsUrl="/path/to/Waline.js" />
59
62
  */
60
63
 
@@ -79,8 +82,7 @@ var Waline = /*#__PURE__*/function (_Component) {
79
82
  path = _this$props$path === void 0 ? 'window.location.pathname' : _this$props$path,
80
83
  _this$props$lang = _this$props.lang,
81
84
  lang = _this$props$lang === void 0 ? 'zh-CN' : _this$props$lang,
82
- _this$props$visitor = _this$props.visitor,
83
- visitor = _this$props$visitor === void 0 ? false : _this$props$visitor,
85
+ locale = _this$props.locale,
84
86
  _this$props$emoji = _this$props.emoji,
85
87
  emoji = _this$props$emoji === void 0 ? ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo'] : _this$props$emoji,
86
88
  _this$props$dark = _this$props.dark,
@@ -95,24 +97,33 @@ var Waline = /*#__PURE__*/function (_Component) {
95
97
  wordLimit = _this$props$wordLimit === void 0 ? 0 : _this$props$wordLimit,
96
98
  _this$props$pageSize = _this$props.pageSize,
97
99
  pageSize = _this$props$pageSize === void 0 ? 10 : _this$props$pageSize,
98
- _this$props$uploadIma = _this$props.uploadImage,
99
- uploadImage = _this$props$uploadIma === void 0 ? true : _this$props$uploadIma,
100
- _this$props$highlight = _this$props.highlight,
101
- highlight = _this$props$highlight === void 0 ? true : _this$props$highlight,
102
- _this$props$math = _this$props.math,
103
- math = _this$props$math === void 0 ? false : _this$props$math,
100
+ _this$props$imageUplo = _this$props.imageUploader,
101
+ imageUploader = _this$props$imageUplo === void 0 ? false : _this$props$imageUplo,
102
+ _this$props$highlight = _this$props.highlighter,
103
+ highlighter = _this$props$highlight === void 0 ? false : _this$props$highlight,
104
+ _this$props$texRender = _this$props.texRenderer,
105
+ texRenderer = _this$props$texRender === void 0 ? false : _this$props$texRender,
106
+ _this$props$search = _this$props.search,
107
+ search = _this$props$search === void 0 ? false : _this$props$search,
108
+ _this$props$pageview = _this$props.pageview,
109
+ pageview = _this$props$pageview === void 0 ? false : _this$props$pageview,
110
+ _this$props$comment = _this$props.comment,
111
+ comment = _this$props$comment === void 0 ? false : _this$props$comment,
104
112
  _this$props$copyright = _this$props.copyright,
105
113
  copyright = _this$props$copyright === void 0 ? true : _this$props$copyright,
106
- locale = _this$props.locale,
107
- jsUrl = _this$props.jsUrl;
114
+ jsUrl = _this$props.jsUrl,
115
+ cssUrl = _this$props.cssUrl;
108
116
 
109
117
  if (!serverURL) {
110
118
  return (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You forgot to set the "), (0, _inferno.createVNode)(1, "code", null, "server_url", 16), (0, _inferno.createTextVNode)(" for Waline. Please set it in"), (0, _inferno.createTextVNode)(' '), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 0);
111
119
  }
112
120
 
113
- var js = "Waline({\n el: '#waline-thread',\n serverURL: ".concat(JSON.stringify(serverURL), ",\n path: ").concat(path, ",\n ").concat(lang ? "lang: ".concat(JSON.stringify(lang), ",") : '', "\n ", "visitor: ".concat(JSON.stringify(visitor), ","), "\n ").concat(emoji ? "emoji: ".concat(JSON.stringify(emoji), ",") : '', "\n ").concat(dark ? "dark: ".concat(JSON.stringify(dark), ",") : '', "\n ").concat(meta ? "meta: ".concat(JSON.stringify(meta), ",") : '', "\n ").concat(Array.isArray(requiredMeta) ? "requiredMeta: ".concat(JSON.stringify(requiredMeta), ",") : '', "\n ").concat(login ? "login: ".concat(JSON.stringify(login), ",") : '', "\n ").concat(wordLimit ? "wordLimit: ".concat(JSON.stringify(wordLimit), ",") : '', "\n ").concat(pageSize ? "pageSize: ".concat(JSON.stringify(pageSize), ",") : '', "\n ").concat(uploadImage === false ? "uploadImage: false," : '', "\n ").concat(highlight === false ? "highlight: false," : '', "\n ").concat(math === false ? "math: false," : '', "\n ", "copyright: ".concat(JSON.stringify(copyright), ","), "\n ").concat(locale ? "locale: ".concat(JSON.stringify(locale), ",") : '', "\n });");
121
+ var js = "Waline.init({\n el: '#waline-thread',\n serverURL: ".concat(JSON.stringify(serverURL), ",\n path: ").concat(path, ",\n ").concat(lang ? "lang: ".concat(JSON.stringify(lang), ",") : '', "\n ").concat(locale ? "locale: ".concat(JSON.stringify(locale), ",") : '', "\n ").concat(emoji ? "emoji: ".concat(JSON.stringify(emoji), ",") : '', "\n ").concat(dark ? "dark: ".concat(JSON.stringify(dark), ",") : '', "\n ").concat(meta ? "meta: ".concat(JSON.stringify(meta), ",") : '', "\n ").concat(Array.isArray(requiredMeta) ? "requiredMeta: ".concat(JSON.stringify(requiredMeta), ",") : '', "\n ").concat(login ? "login: ".concat(JSON.stringify(login), ",") : '', "\n ").concat(wordLimit ? "wordLimit: ".concat(JSON.stringify(wordLimit), ",") : '', "\n ").concat(pageSize ? "pageSize: ".concat(JSON.stringify(pageSize), ",") : '', "\n ").concat(imageUploader === false ? "imageUploader: false," : '', "\n ").concat(highlighter === false ? "highlighter: false," : '', "\n ").concat(texRenderer === false ? "texRenderer: false," : '', "\n ").concat(search === false ? "search: false," : '', "\n ").concat(typeof pageview !== 'undefined' ? "pageview: ".concat(JSON.stringify(pageview), ",") : '', "\n ").concat(typeof comment !== 'undefined' ? "comment: ".concat(JSON.stringify(comment), ",") : '', "\n ", "copyright: ".concat(JSON.stringify(copyright), ","), "\n });");
114
122
  return (0, _inferno.createFragment)([(0, _inferno.createVNode)(1, "div", "content", null, 1, {
115
123
  "id": "waline-thread"
124
+ }), (0, _inferno.createVNode)(1, "link", null, null, 1, {
125
+ "rel": "stylesheet",
126
+ "href": cssUrl
116
127
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
117
128
  "src": jsUrl
118
129
  }), (0, _inferno.createVNode)(1, "script", null, null, 1, {
@@ -138,19 +149,21 @@ var Waline = /*#__PURE__*/function (_Component) {
138
149
  * server_url: "https://path/to/waline/server",
139
150
  * path: "window.location.pathname",
140
151
  * lang: "zh-CN",
141
- * visitor: false,
152
+ * locale: {placeholder: "", ...},
142
153
  * emoji: "https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo",
143
154
  * dark: "",
144
- * meta: ['nick', 'mail', 'link'],
155
+ * meta: ["nick", "mail", "link"],
145
156
  * required_meta: [],
146
157
  * login: false,
147
158
  * word_limit: 0,
148
159
  * page_size: 10,
149
- * upload_image: true,
150
- * highlight: true,
151
- * math: false,
160
+ * image_uploader: true,
161
+ * highlighter: true,
162
+ * tex_renderer: false,
163
+ * search: true,
164
+ * pageview: false,
165
+ * comment: false,
152
166
  * copyright: true,
153
- * locale: {placeholder: '', ...}
154
167
  * }}
155
168
  * helper={{ cdn: function() {...} }} />
156
169
  */
@@ -165,7 +178,7 @@ Waline.Cacheable = cacheComponent(Waline, 'comment.waline', function (props) {
165
178
  serverURL: comment.server_url,
166
179
  path: comment.path,
167
180
  lang: comment.lang || page.lang || page.language || config.language || 'zh-CN',
168
- visitor: comment.visitor,
181
+ locale: comment.locale,
169
182
  emoji: comment.emoji,
170
183
  dark: comment.dark,
171
184
  meta: comment.meta,
@@ -173,12 +186,15 @@ Waline.Cacheable = cacheComponent(Waline, 'comment.waline', function (props) {
173
186
  login: comment.login,
174
187
  wordLimit: comment.word_limit,
175
188
  pageSize: comment.page_size,
176
- uploadImage: comment.upload_image,
177
- highlight: comment.highlight,
178
- math: comment.math,
189
+ imageUploader: comment.image_uploader,
190
+ highlighter: comment.highlighter,
191
+ texRenderer: comment.tex_renderer,
192
+ search: comment.search,
193
+ pageview: comment.pageview,
194
+ comment: comment.comment,
179
195
  copyright: comment.copyright,
180
- locale: comment.locale,
181
- jsUrl: helper.cdn('@waline/client', '1.5.4', 'dist/Waline.min.js')
196
+ jsUrl: helper.cdn('@waline/client', '2.6.3', 'dist/waline.js'),
197
+ cssUrl: helper.cdn('@waline/client', '2.6.3', 'dist/waline.css')
182
198
  };
183
199
  });
184
200
  module.exports = Waline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-component-inferno",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "A collection of Inferno.js layout components and utility scripts for Hexo",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/ppoffice/hexo-component-inferno",
@@ -44,6 +44,7 @@
44
44
  "eslint-plugin-json": "^3.1.0",
45
45
  "eslint-plugin-react": "^7.18.0",
46
46
  "hexo-renderer-marked": "^5.0.0",
47
+ "html-minifier": "^4.0.0",
47
48
  "inferno-server": "^7.4.1",
48
49
  "jest": "^27.4.7",
49
50
  "jsdoc": "^3.6.3",