astro-accelerator-utils 0.3.7 → 0.3.8
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.
- package/LICENSE +201 -201
- package/README.md +19 -19
- package/index.d.mts +4 -4
- package/index.mjs +9 -9
- package/lib/postFiltering.d.mts +48 -48
- package/lib/postFiltering.mjs +116 -116
- package/lib/postOrdering.d.mts +32 -32
- package/lib/postOrdering.mjs +51 -51
- package/lib/v1/accelerator.d.mts +36 -36
- package/lib/v1/accelerator.mjs +70 -70
- package/lib/v1/authors.d.mts +28 -28
- package/lib/v1/authors.mjs +71 -71
- package/lib/v1/cache.d.mts +43 -43
- package/lib/v1/cache.mjs +99 -99
- package/lib/v1/dates.d.mts +19 -19
- package/lib/v1/dates.mjs +26 -26
- package/lib/v1/markdown.d.mts +20 -20
- package/lib/v1/markdown.mjs +45 -45
- package/lib/v1/navigation.d.mts +111 -111
- package/lib/v1/navigation.mjs +446 -427
- package/lib/v1/paging.d.mts +15 -15
- package/lib/v1/paging.mjs +77 -77
- package/lib/v1/posts.d.mts +26 -26
- package/lib/v1/posts.mjs +47 -47
- package/lib/v1/statistics-stub.d.mts +5 -5
- package/lib/v1/statistics-stub.mjs +9 -9
- package/lib/v1/statistics.d.mts +39 -39
- package/lib/v1/statistics.mjs +78 -78
- package/lib/v1/taxonomy.d.mts +62 -62
- package/lib/v1/taxonomy.mjs +144 -144
- package/lib/v1/urls.d.mts +40 -40
- package/lib/v1/urls.mjs +104 -104
- package/package.json +3 -3
- package/types/Astro.d.ts +19 -19
- package/types/AuthorList.d.ts +8 -8
- package/types/BannerImage.d.ts +4 -4
- package/types/Frontmatter.d.ts +30 -30
- package/types/Link.d.ts +6 -6
- package/types/NavPage.d.ts +22 -22
- package/types/PagePredicate.d.ts +2 -2
- package/types/Site.d.ts +43 -43
- package/types/Taxonomy.d.ts +15 -15
package/lib/v1/taxonomy.d.mts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef { import("./cache.mjs").Cache } Cache
|
|
3
|
-
* @typedef { import("./posts.mjs").Posts } Posts
|
|
4
|
-
* @typedef { import("./urls.mjs").UrlFormatter } UrlFormatter
|
|
5
|
-
* @typedef { import("../../types/Site").Site } Site
|
|
6
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyList } TaxonomyList
|
|
7
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyEntry } TaxonomyEntry
|
|
8
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyLinks } TaxonomyLinks
|
|
9
|
-
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
10
|
-
*/
|
|
11
|
-
export class Taxonomy {
|
|
12
|
-
/**
|
|
13
|
-
* Constructor
|
|
14
|
-
* @param {Cache} cache
|
|
15
|
-
* @param {Posts} posts
|
|
16
|
-
* @param {UrlFormatter} urlFormatter
|
|
17
|
-
*/
|
|
18
|
-
constructor(cache: Cache, posts: Posts, urlFormatter: UrlFormatter);
|
|
19
|
-
cache: import("./cache.mjs").Cache;
|
|
20
|
-
posts: import("./posts.mjs").Posts;
|
|
21
|
-
urlFormatter: import("./urls.mjs").UrlFormatter;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @returns {TaxonomyList}
|
|
25
|
-
*/
|
|
26
|
-
all(): TaxonomyList;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* @param {any} translations
|
|
30
|
-
* @param {(entry: any) => string} lang
|
|
31
|
-
* @param {string} subfolder
|
|
32
|
-
* @returns {TaxonomyLinks}
|
|
33
|
-
*/
|
|
34
|
-
links(translations: any, lang: (entry: any) => string, subfolder: string): TaxonomyLinks;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @returns {TaxonomyList}
|
|
38
|
-
*/
|
|
39
|
-
getTaxonomy(): TaxonomyList;
|
|
40
|
-
/**
|
|
41
|
-
* Sorts taxonomy entries by title
|
|
42
|
-
* @param {TaxonomyEntry} a
|
|
43
|
-
* @param {TaxonomyEntry} b
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
sortByTitle(a: TaxonomyEntry, b: TaxonomyEntry): 0 | 1 | -1;
|
|
47
|
-
/**
|
|
48
|
-
* Sorts taxonomy entries by title
|
|
49
|
-
* @param {TaxonomyEntry} a
|
|
50
|
-
* @param {TaxonomyEntry} b
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
sortByVolume(a: TaxonomyEntry, b: TaxonomyEntry): number;
|
|
54
|
-
}
|
|
55
|
-
export type Cache = import("./cache.mjs").Cache;
|
|
56
|
-
export type Posts = import("./posts.mjs").Posts;
|
|
57
|
-
export type UrlFormatter = import("./urls.mjs").UrlFormatter;
|
|
58
|
-
export type Site = import("../../types/Site").Site;
|
|
59
|
-
export type TaxonomyList = import("../../types/Taxonomy").TaxonomyList;
|
|
60
|
-
export type TaxonomyEntry = import("../../types/Taxonomy").TaxonomyEntry;
|
|
61
|
-
export type TaxonomyLinks = import("../../types/Taxonomy").TaxonomyLinks;
|
|
62
|
-
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
1
|
+
/**
|
|
2
|
+
* @typedef { import("./cache.mjs").Cache } Cache
|
|
3
|
+
* @typedef { import("./posts.mjs").Posts } Posts
|
|
4
|
+
* @typedef { import("./urls.mjs").UrlFormatter } UrlFormatter
|
|
5
|
+
* @typedef { import("../../types/Site").Site } Site
|
|
6
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyList } TaxonomyList
|
|
7
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyEntry } TaxonomyEntry
|
|
8
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyLinks } TaxonomyLinks
|
|
9
|
+
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
10
|
+
*/
|
|
11
|
+
export class Taxonomy {
|
|
12
|
+
/**
|
|
13
|
+
* Constructor
|
|
14
|
+
* @param {Cache} cache
|
|
15
|
+
* @param {Posts} posts
|
|
16
|
+
* @param {UrlFormatter} urlFormatter
|
|
17
|
+
*/
|
|
18
|
+
constructor(cache: Cache, posts: Posts, urlFormatter: UrlFormatter);
|
|
19
|
+
cache: import("./cache.mjs").Cache;
|
|
20
|
+
posts: import("./posts.mjs").Posts;
|
|
21
|
+
urlFormatter: import("./urls.mjs").UrlFormatter;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @returns {TaxonomyList}
|
|
25
|
+
*/
|
|
26
|
+
all(): TaxonomyList;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {any} translations
|
|
30
|
+
* @param {(entry: any) => string} lang
|
|
31
|
+
* @param {string} subfolder
|
|
32
|
+
* @returns {TaxonomyLinks}
|
|
33
|
+
*/
|
|
34
|
+
links(translations: any, lang: (entry: any) => string, subfolder: string): TaxonomyLinks;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @returns {TaxonomyList}
|
|
38
|
+
*/
|
|
39
|
+
getTaxonomy(): TaxonomyList;
|
|
40
|
+
/**
|
|
41
|
+
* Sorts taxonomy entries by title
|
|
42
|
+
* @param {TaxonomyEntry} a
|
|
43
|
+
* @param {TaxonomyEntry} b
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
sortByTitle(a: TaxonomyEntry, b: TaxonomyEntry): 0 | 1 | -1;
|
|
47
|
+
/**
|
|
48
|
+
* Sorts taxonomy entries by title
|
|
49
|
+
* @param {TaxonomyEntry} a
|
|
50
|
+
* @param {TaxonomyEntry} b
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
sortByVolume(a: TaxonomyEntry, b: TaxonomyEntry): number;
|
|
54
|
+
}
|
|
55
|
+
export type Cache = import("./cache.mjs").Cache;
|
|
56
|
+
export type Posts = import("./posts.mjs").Posts;
|
|
57
|
+
export type UrlFormatter = import("./urls.mjs").UrlFormatter;
|
|
58
|
+
export type Site = import("../../types/Site").Site;
|
|
59
|
+
export type TaxonomyList = import("../../types/Taxonomy").TaxonomyList;
|
|
60
|
+
export type TaxonomyEntry = import("../../types/Taxonomy").TaxonomyEntry;
|
|
61
|
+
export type TaxonomyLinks = import("../../types/Taxonomy").TaxonomyLinks;
|
|
62
|
+
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
package/lib/v1/taxonomy.mjs
CHANGED
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import * as PostFiltering from '../postFiltering.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef { import("./cache.mjs").Cache } Cache
|
|
5
|
-
* @typedef { import("./posts.mjs").Posts } Posts
|
|
6
|
-
* @typedef { import("./urls.mjs").UrlFormatter } UrlFormatter
|
|
7
|
-
* @typedef { import("../../types/Site").Site } Site
|
|
8
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyList } TaxonomyList
|
|
9
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyEntry } TaxonomyEntry
|
|
10
|
-
* @typedef { import("../../types/Taxonomy").TaxonomyLinks } TaxonomyLinks
|
|
11
|
-
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export class Taxonomy {
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Constructor
|
|
18
|
-
* @param {Cache} cache
|
|
19
|
-
* @param {Posts} posts
|
|
20
|
-
* @param {UrlFormatter} urlFormatter
|
|
21
|
-
*/
|
|
22
|
-
constructor(cache, posts, urlFormatter) {
|
|
23
|
-
this.cache = cache;
|
|
24
|
-
this.posts = posts;
|
|
25
|
-
this.urlFormatter = urlFormatter;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @returns {TaxonomyList}
|
|
31
|
-
*/
|
|
32
|
-
all() {
|
|
33
|
-
const taxonomy = this.cache.get('v1_taxonomy.all', () => this.getTaxonomy());
|
|
34
|
-
return taxonomy;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param {any} translations
|
|
40
|
-
* @param {(entry: any) => string} lang
|
|
41
|
-
* @param {string} subfolder
|
|
42
|
-
* @returns {TaxonomyLinks}
|
|
43
|
-
*/
|
|
44
|
-
links(translations, lang, subfolder) {
|
|
45
|
-
const category = lang(translations.articles.category) ?? 'category';
|
|
46
|
-
const categoryLink = `${subfolder}/${category}/`;
|
|
47
|
-
|
|
48
|
-
const tag = lang(translations.articles.tag) ?? 'tag';
|
|
49
|
-
const tagLink = `${subfolder}/${tag}/`;
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
tag: tag,
|
|
53
|
-
category: category,
|
|
54
|
-
getCategoryLink: (category) => {
|
|
55
|
-
return this.urlFormatter.addSlashToAddress(categoryLink + category.toLowerCase().replace(/ /g, '-') + '/1/');
|
|
56
|
-
},
|
|
57
|
-
getTagLink: (tag) => {
|
|
58
|
-
return this.urlFormatter.addSlashToAddress(tagLink + tag.toLowerCase().replace(/ /g, '-') + '/1/');
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @returns {TaxonomyList}
|
|
66
|
-
*/
|
|
67
|
-
getTaxonomy() {
|
|
68
|
-
/** @type {MarkdownInstance[]} */
|
|
69
|
-
const allPages = this.posts.all().filter(PostFiltering.isListable);
|
|
70
|
-
|
|
71
|
-
/** @type {{ [key: string]: number }} */
|
|
72
|
-
const tags = {};
|
|
73
|
-
|
|
74
|
-
/** @type {{ [key: string]: number }} */
|
|
75
|
-
const cats = {};
|
|
76
|
-
|
|
77
|
-
// Get taxonomy and counts
|
|
78
|
-
allPages.forEach((p) => {
|
|
79
|
-
p.frontmatter.tags && (p.frontmatter.tags).forEach(t => {
|
|
80
|
-
tags[t] = (tags[t] ?? 0) + 1;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
p.frontmatter.categories && (p.frontmatter.categories).forEach(c => {
|
|
84
|
-
cats[c] = (cats[c] ?? 0) + 1;
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// Map into the taxonomy
|
|
89
|
-
const taxonomy = {
|
|
90
|
-
tags: Object.keys(tags).sort().map(x => {
|
|
91
|
-
return {
|
|
92
|
-
title: x,
|
|
93
|
-
count: tags[x]
|
|
94
|
-
};
|
|
95
|
-
}),
|
|
96
|
-
topTags: [],
|
|
97
|
-
categories: Object.keys(cats).sort().map(x => {
|
|
98
|
-
return {
|
|
99
|
-
title: x,
|
|
100
|
-
count: cats[x]
|
|
101
|
-
};
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Get a list of "top tags" by usage count
|
|
106
|
-
const length = Math.min(taxonomy.categories.length, taxonomy.tags.length);
|
|
107
|
-
taxonomy.topTags = taxonomy.tags
|
|
108
|
-
.sort(this.sortByVolume)
|
|
109
|
-
.slice(0, length);
|
|
110
|
-
|
|
111
|
-
taxonomy.categories = taxonomy.categories.sort(this.sortByTitle);
|
|
112
|
-
taxonomy.tags = taxonomy.tags.sort(this.sortByTitle);
|
|
113
|
-
taxonomy.topTags = taxonomy.topTags.sort(this.sortByTitle);
|
|
114
|
-
|
|
115
|
-
return taxonomy;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Sorts taxonomy entries by title
|
|
120
|
-
* @param {TaxonomyEntry} a
|
|
121
|
-
* @param {TaxonomyEntry} b
|
|
122
|
-
* @returns
|
|
123
|
-
*/
|
|
124
|
-
sortByTitle(a, b) {
|
|
125
|
-
if (a.title < b.title) {
|
|
126
|
-
return -1;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (a.title > b.title) {
|
|
130
|
-
return 1;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Sorts taxonomy entries by title
|
|
138
|
-
* @param {TaxonomyEntry} a
|
|
139
|
-
* @param {TaxonomyEntry} b
|
|
140
|
-
* @returns
|
|
141
|
-
*/
|
|
142
|
-
sortByVolume(a, b) {
|
|
143
|
-
return b.count - a.count;
|
|
144
|
-
}
|
|
1
|
+
import * as PostFiltering from '../postFiltering.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef { import("./cache.mjs").Cache } Cache
|
|
5
|
+
* @typedef { import("./posts.mjs").Posts } Posts
|
|
6
|
+
* @typedef { import("./urls.mjs").UrlFormatter } UrlFormatter
|
|
7
|
+
* @typedef { import("../../types/Site").Site } Site
|
|
8
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyList } TaxonomyList
|
|
9
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyEntry } TaxonomyEntry
|
|
10
|
+
* @typedef { import("../../types/Taxonomy").TaxonomyLinks } TaxonomyLinks
|
|
11
|
+
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export class Taxonomy {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param {Cache} cache
|
|
19
|
+
* @param {Posts} posts
|
|
20
|
+
* @param {UrlFormatter} urlFormatter
|
|
21
|
+
*/
|
|
22
|
+
constructor(cache, posts, urlFormatter) {
|
|
23
|
+
this.cache = cache;
|
|
24
|
+
this.posts = posts;
|
|
25
|
+
this.urlFormatter = urlFormatter;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @returns {TaxonomyList}
|
|
31
|
+
*/
|
|
32
|
+
all() {
|
|
33
|
+
const taxonomy = this.cache.get('v1_taxonomy.all', () => this.getTaxonomy());
|
|
34
|
+
return taxonomy;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {any} translations
|
|
40
|
+
* @param {(entry: any) => string} lang
|
|
41
|
+
* @param {string} subfolder
|
|
42
|
+
* @returns {TaxonomyLinks}
|
|
43
|
+
*/
|
|
44
|
+
links(translations, lang, subfolder) {
|
|
45
|
+
const category = lang(translations.articles.category) ?? 'category';
|
|
46
|
+
const categoryLink = `${subfolder}/${category}/`;
|
|
47
|
+
|
|
48
|
+
const tag = lang(translations.articles.tag) ?? 'tag';
|
|
49
|
+
const tagLink = `${subfolder}/${tag}/`;
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
tag: tag,
|
|
53
|
+
category: category,
|
|
54
|
+
getCategoryLink: (category) => {
|
|
55
|
+
return this.urlFormatter.addSlashToAddress(categoryLink + category.toLowerCase().replace(/ /g, '-') + '/1/');
|
|
56
|
+
},
|
|
57
|
+
getTagLink: (tag) => {
|
|
58
|
+
return this.urlFormatter.addSlashToAddress(tagLink + tag.toLowerCase().replace(/ /g, '-') + '/1/');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @returns {TaxonomyList}
|
|
66
|
+
*/
|
|
67
|
+
getTaxonomy() {
|
|
68
|
+
/** @type {MarkdownInstance[]} */
|
|
69
|
+
const allPages = this.posts.all().filter(PostFiltering.isListable);
|
|
70
|
+
|
|
71
|
+
/** @type {{ [key: string]: number }} */
|
|
72
|
+
const tags = {};
|
|
73
|
+
|
|
74
|
+
/** @type {{ [key: string]: number }} */
|
|
75
|
+
const cats = {};
|
|
76
|
+
|
|
77
|
+
// Get taxonomy and counts
|
|
78
|
+
allPages.forEach((p) => {
|
|
79
|
+
p.frontmatter.tags && (p.frontmatter.tags).forEach(t => {
|
|
80
|
+
tags[t] = (tags[t] ?? 0) + 1;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
p.frontmatter.categories && (p.frontmatter.categories).forEach(c => {
|
|
84
|
+
cats[c] = (cats[c] ?? 0) + 1;
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Map into the taxonomy
|
|
89
|
+
const taxonomy = {
|
|
90
|
+
tags: Object.keys(tags).sort().map(x => {
|
|
91
|
+
return {
|
|
92
|
+
title: x,
|
|
93
|
+
count: tags[x]
|
|
94
|
+
};
|
|
95
|
+
}),
|
|
96
|
+
topTags: [],
|
|
97
|
+
categories: Object.keys(cats).sort().map(x => {
|
|
98
|
+
return {
|
|
99
|
+
title: x,
|
|
100
|
+
count: cats[x]
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Get a list of "top tags" by usage count
|
|
106
|
+
const length = Math.min(taxonomy.categories.length, taxonomy.tags.length);
|
|
107
|
+
taxonomy.topTags = taxonomy.tags
|
|
108
|
+
.sort(this.sortByVolume)
|
|
109
|
+
.slice(0, length);
|
|
110
|
+
|
|
111
|
+
taxonomy.categories = taxonomy.categories.sort(this.sortByTitle);
|
|
112
|
+
taxonomy.tags = taxonomy.tags.sort(this.sortByTitle);
|
|
113
|
+
taxonomy.topTags = taxonomy.topTags.sort(this.sortByTitle);
|
|
114
|
+
|
|
115
|
+
return taxonomy;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Sorts taxonomy entries by title
|
|
120
|
+
* @param {TaxonomyEntry} a
|
|
121
|
+
* @param {TaxonomyEntry} b
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
sortByTitle(a, b) {
|
|
125
|
+
if (a.title < b.title) {
|
|
126
|
+
return -1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (a.title > b.title) {
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Sorts taxonomy entries by title
|
|
138
|
+
* @param {TaxonomyEntry} a
|
|
139
|
+
* @param {TaxonomyEntry} b
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
142
|
+
sortByVolume(a, b) {
|
|
143
|
+
return b.count - a.count;
|
|
144
|
+
}
|
|
145
145
|
}
|
package/lib/v1/urls.d.mts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
export class UrlFormatter {
|
|
2
|
-
/**
|
|
3
|
-
* Constructor
|
|
4
|
-
* @param {string} siteUrl
|
|
5
|
-
* @param {string} subfolder
|
|
6
|
-
* @param {boolean} useTrailingUrlSlash
|
|
7
|
-
*/
|
|
8
|
-
constructor(siteUrl: string, subfolder: string, useTrailingUrlSlash: boolean);
|
|
9
|
-
siteUrl: string;
|
|
10
|
-
subfolder: string;
|
|
11
|
-
useTrailingUrlSlash: boolean;
|
|
12
|
-
/** Uses config to decide whether to add or remove trailing slashes
|
|
13
|
-
* @param {URL} url
|
|
14
|
-
* @returns {URL}
|
|
15
|
-
*/
|
|
16
|
-
formatUrl(url: URL): URL;
|
|
17
|
-
/**
|
|
18
|
-
* Ensures trailing slash is used
|
|
19
|
-
* @param {string | undefined} address
|
|
20
|
-
* @returns {string}
|
|
21
|
-
*/
|
|
22
|
-
formatAddress(address: string | undefined): string;
|
|
23
|
-
/**
|
|
24
|
-
* Ensures trailing slash is used
|
|
25
|
-
* @param {URL} url
|
|
26
|
-
* @returns {URL}
|
|
27
|
-
*/
|
|
28
|
-
addSlashToUrl(url: URL): URL;
|
|
29
|
-
/**
|
|
30
|
-
* Ensures trailing slash is used
|
|
31
|
-
* @param {string | undefined} address
|
|
32
|
-
* @returns {string}
|
|
33
|
-
*/
|
|
34
|
-
addSlashToAddress(address: string | undefined): string;
|
|
35
|
-
/**
|
|
36
|
-
* Gets the author id from an address
|
|
37
|
-
* @param {URL} url
|
|
38
|
-
*/
|
|
39
|
-
getAuthorId(url: URL): string;
|
|
40
|
-
}
|
|
1
|
+
export class UrlFormatter {
|
|
2
|
+
/**
|
|
3
|
+
* Constructor
|
|
4
|
+
* @param {string} siteUrl
|
|
5
|
+
* @param {string} subfolder
|
|
6
|
+
* @param {boolean} useTrailingUrlSlash
|
|
7
|
+
*/
|
|
8
|
+
constructor(siteUrl: string, subfolder: string, useTrailingUrlSlash: boolean);
|
|
9
|
+
siteUrl: string;
|
|
10
|
+
subfolder: string;
|
|
11
|
+
useTrailingUrlSlash: boolean;
|
|
12
|
+
/** Uses config to decide whether to add or remove trailing slashes
|
|
13
|
+
* @param {URL} url
|
|
14
|
+
* @returns {URL}
|
|
15
|
+
*/
|
|
16
|
+
formatUrl(url: URL): URL;
|
|
17
|
+
/**
|
|
18
|
+
* Ensures trailing slash is used
|
|
19
|
+
* @param {string | undefined} address
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
formatAddress(address: string | undefined): string;
|
|
23
|
+
/**
|
|
24
|
+
* Ensures trailing slash is used
|
|
25
|
+
* @param {URL} url
|
|
26
|
+
* @returns {URL}
|
|
27
|
+
*/
|
|
28
|
+
addSlashToUrl(url: URL): URL;
|
|
29
|
+
/**
|
|
30
|
+
* Ensures trailing slash is used
|
|
31
|
+
* @param {string | undefined} address
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
addSlashToAddress(address: string | undefined): string;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the author id from an address
|
|
37
|
+
* @param {URL} url
|
|
38
|
+
*/
|
|
39
|
+
getAuthorId(url: URL): string;
|
|
40
|
+
}
|