astro-accelerator-utils 0.3.97 → 0.3.99
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/index.d.mts +37 -37
- package/lib/v1/accelerator.d.mts +16 -16
- package/lib/v1/authors.d.mts +5 -5
- package/lib/v1/cache.d.mts +2 -2
- package/lib/v1/dates.d.mts +4 -4
- package/lib/v1/markdown.d.mts +1 -1
- package/lib/v1/navigation.d.mts +25 -13
- package/lib/v1/navigation.mjs +27 -2
- package/lib/v1/paging.d.mts +2 -2
- package/lib/v1/posts.d.mts +5 -5
- package/lib/v1/taxonomy.d.mts +13 -13
- package/lib/v1/urls.d.mts +4 -4
- package/package.json +3 -3
package/index.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Accelerator } from './lib/v1/accelerator.mjs';
|
|
2
|
+
export type PagePredicate = import("./types/PagePredicate").PagePredicate;
|
|
3
|
+
export type MarkdownInstance = import("./types/Astro").MarkdownInstance;
|
|
1
4
|
/**
|
|
2
5
|
* @typedef { import("./types/PagePredicate").PagePredicate } PagePredicate
|
|
3
6
|
* @typedef { import("./types/Astro").MarkdownInstance} MarkdownInstance
|
|
@@ -7,116 +10,113 @@
|
|
|
7
10
|
* @param {MarkdownInstance} p
|
|
8
11
|
* @returns {boolean}
|
|
9
12
|
*/
|
|
10
|
-
export function showInSitemap(p: MarkdownInstance): boolean;
|
|
13
|
+
export declare function showInSitemap(p: MarkdownInstance): boolean;
|
|
11
14
|
/**
|
|
12
15
|
* Predicate for whether a page should appear in the site search
|
|
13
16
|
* @param {MarkdownInstance} p
|
|
14
17
|
* @returns {boolean}
|
|
15
18
|
*/
|
|
16
|
-
export function showInSearch(p: MarkdownInstance): boolean;
|
|
19
|
+
export declare function showInSearch(p: MarkdownInstance): boolean;
|
|
17
20
|
/**
|
|
18
21
|
* Predicate for whether a page should appear in the navigation menu
|
|
19
22
|
* @param {MarkdownInstance} p
|
|
20
23
|
* @returns {boolean}
|
|
21
24
|
*/
|
|
22
|
-
export function showInMenu(p: MarkdownInstance): boolean;
|
|
25
|
+
export declare function showInMenu(p: MarkdownInstance): boolean;
|
|
23
26
|
/**
|
|
24
27
|
* Predicate for whether a page is an author page
|
|
25
28
|
* @param {MarkdownInstance} p
|
|
26
29
|
* @returns {boolean}
|
|
27
30
|
*/
|
|
28
|
-
export function isAuthor(p: MarkdownInstance): boolean;
|
|
31
|
+
export declare function isAuthor(p: MarkdownInstance): boolean;
|
|
29
32
|
/**
|
|
30
33
|
* Predicate for whether a page is an author page
|
|
31
34
|
* @param {MarkdownInstance} p
|
|
32
35
|
* @returns {boolean}
|
|
33
36
|
*/
|
|
34
|
-
export function notAuthor(p: MarkdownInstance): boolean;
|
|
37
|
+
export declare function notAuthor(p: MarkdownInstance): boolean;
|
|
35
38
|
/**
|
|
36
39
|
* Predicate for whether a page is a search page
|
|
37
40
|
* @param {MarkdownInstance} p
|
|
38
41
|
* @returns {boolean}
|
|
39
42
|
*/
|
|
40
|
-
export function isSearch(p: MarkdownInstance): boolean;
|
|
43
|
+
export declare function isSearch(p: MarkdownInstance): boolean;
|
|
41
44
|
/**
|
|
42
45
|
* Predicate for whether a page is an search page
|
|
43
46
|
* @param {MarkdownInstance} p
|
|
44
47
|
* @returns {boolean}
|
|
45
48
|
*/
|
|
46
|
-
export function notSearch(p: MarkdownInstance): boolean;
|
|
49
|
+
export declare function notSearch(p: MarkdownInstance): boolean;
|
|
47
50
|
/**
|
|
48
51
|
* Predicate for whether a page has a modified date
|
|
49
52
|
* @param {MarkdownInstance} p
|
|
50
53
|
* @returns {boolean}
|
|
51
54
|
*/
|
|
52
|
-
export function hasDate(p: MarkdownInstance): boolean;
|
|
55
|
+
export declare function hasDate(p: MarkdownInstance): boolean;
|
|
53
56
|
/**
|
|
54
57
|
* Predicate for whether a page has a modified date
|
|
55
58
|
* @param {MarkdownInstance} p
|
|
56
59
|
* @returns {boolean}
|
|
57
60
|
*/
|
|
58
|
-
export function hasModDate(p: MarkdownInstance): boolean;
|
|
61
|
+
export declare function hasModDate(p: MarkdownInstance): boolean;
|
|
59
62
|
/**
|
|
60
63
|
* Predicate for whether a page should be listed
|
|
61
64
|
* @param {MarkdownInstance<Record<string, any>>} p
|
|
62
65
|
* @returns {boolean}
|
|
63
66
|
*/
|
|
64
|
-
export function isListable(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
67
|
+
export declare function isListable(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
65
68
|
/**
|
|
66
69
|
* Predicate for whether a page should be used to create tag and category lists.
|
|
67
70
|
* Specifically, this allows future-dated posts to cause taxonomy pages to be created,
|
|
68
71
|
* @param {MarkdownInstance<Record<string, any>>} p
|
|
69
72
|
* @returns {boolean}
|
|
70
73
|
*/
|
|
71
|
-
export function forTaxonomy(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
74
|
+
export declare function forTaxonomy(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
72
75
|
/**
|
|
73
76
|
* Sorts by the pubDate field
|
|
74
77
|
* @param {MarkdownInstance} a
|
|
75
78
|
* @param {MarkdownInstance} b
|
|
76
79
|
* @returns {any}
|
|
77
80
|
*/
|
|
78
|
-
export function sortByPubDate(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
81
|
+
export declare function sortByPubDate(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
79
82
|
/**
|
|
80
83
|
* Sorts by the pubDate field in descending order
|
|
81
84
|
* @param {MarkdownInstance} a
|
|
82
85
|
* @param {MarkdownInstance} b
|
|
83
86
|
* @returns {any}
|
|
84
87
|
*/
|
|
85
|
-
export function sortByPubDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
88
|
+
export declare function sortByPubDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
86
89
|
/**
|
|
87
90
|
* Sorts by the modDate field
|
|
88
91
|
* @param {MarkdownInstance} a
|
|
89
92
|
* @param {MarkdownInstance} b
|
|
90
93
|
* @returns {any}
|
|
91
94
|
*/
|
|
92
|
-
export function sortByModDate(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
95
|
+
export declare function sortByModDate(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
93
96
|
/**
|
|
94
97
|
* Sorts by the modDate field
|
|
95
98
|
* @param {MarkdownInstance} a
|
|
96
99
|
* @param {MarkdownInstance} b
|
|
97
100
|
* @returns {any}
|
|
98
101
|
*/
|
|
99
|
-
export function sortByModDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
100
|
-
export
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
102
|
+
export declare function sortByModDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
103
|
+
export declare const PostFiltering: {
|
|
104
|
+
showInSitemap: typeof showInSitemap;
|
|
105
|
+
showInSearch: typeof showInSearch;
|
|
106
|
+
showInMenu: typeof showInMenu;
|
|
107
|
+
isAuthor: typeof isAuthor;
|
|
108
|
+
notAuthor: typeof notAuthor;
|
|
109
|
+
isSearch: typeof isSearch;
|
|
110
|
+
notSearch: typeof notSearch;
|
|
111
|
+
hasDate: typeof hasDate;
|
|
112
|
+
hasModDate: typeof hasModDate;
|
|
113
|
+
isListable: typeof isListable;
|
|
114
|
+
forTaxonomy: typeof forTaxonomy;
|
|
115
|
+
};
|
|
116
|
+
export declare const PostOrdering: {
|
|
117
|
+
sortByPubDate: typeof sortByPubDate;
|
|
118
|
+
sortByPubDateDesc: typeof sortByPubDateDesc;
|
|
119
|
+
sortByModDate: typeof sortByModDate;
|
|
120
|
+
sortByModDateDesc: typeof sortByModDateDesc;
|
|
121
|
+
};
|
|
119
122
|
export { Accelerator };
|
|
120
|
-
export type PagePredicate = import("./types/PagePredicate").PagePredicate;
|
|
121
|
-
export type MarkdownInstance = import("./types/Astro").MarkdownInstance;
|
|
122
|
-
import { Accelerator } from './lib/v1/accelerator.mjs';
|
package/lib/v1/accelerator.d.mts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { Authors } from './authors.mjs';
|
|
2
|
+
import { Cache } from './cache.mjs';
|
|
3
|
+
import { DateFormatter } from './dates.mjs';
|
|
4
|
+
import { Markdown } from './markdown.mjs';
|
|
5
|
+
import { Navigation } from './navigation.mjs';
|
|
6
|
+
import { Paging } from './paging.mjs';
|
|
7
|
+
import { Posts } from './posts.mjs';
|
|
8
|
+
import { Taxonomy } from './taxonomy.mjs';
|
|
9
|
+
import { UrlFormatter } from './urls.mjs';
|
|
10
|
+
import { StatisticsStub } from './statistics-stub.mjs';
|
|
11
|
+
export type Site = import("../../types/Site").Site;
|
|
1
12
|
/**
|
|
2
13
|
* @typedef { import("../../types/Site").Site } Site
|
|
3
14
|
*/
|
|
4
|
-
export class Accelerator {
|
|
5
|
-
/**
|
|
6
|
-
* @param {Site} site
|
|
7
|
-
*/
|
|
8
|
-
constructor(site: Site);
|
|
15
|
+
export declare class Accelerator {
|
|
9
16
|
cacheMaxAge: number;
|
|
10
17
|
dateOptions: Intl.DateTimeFormatOptions;
|
|
11
18
|
shortDateOptions: Intl.DateTimeFormatOptions;
|
|
@@ -13,6 +20,10 @@ export class Accelerator {
|
|
|
13
20
|
subfolder: string;
|
|
14
21
|
useTrailingUrlSlash: boolean | undefined;
|
|
15
22
|
captureStatistics: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Site} site
|
|
25
|
+
*/
|
|
26
|
+
constructor(site: Site);
|
|
16
27
|
get authors(): Authors;
|
|
17
28
|
get cache(): Cache;
|
|
18
29
|
get dateFormatter(): DateFormatter;
|
|
@@ -24,14 +35,3 @@ export class Accelerator {
|
|
|
24
35
|
get urlFormatter(): UrlFormatter;
|
|
25
36
|
get statistics(): typeof StatisticsStub;
|
|
26
37
|
}
|
|
27
|
-
export type Site = import("../../types/Site").Site;
|
|
28
|
-
import { Authors } from './authors.mjs';
|
|
29
|
-
import { Cache } from './cache.mjs';
|
|
30
|
-
import { DateFormatter } from './dates.mjs';
|
|
31
|
-
import { Markdown } from './markdown.mjs';
|
|
32
|
-
import { Navigation } from './navigation.mjs';
|
|
33
|
-
import { Paging } from './paging.mjs';
|
|
34
|
-
import { Posts } from './posts.mjs';
|
|
35
|
-
import { Taxonomy } from './taxonomy.mjs';
|
|
36
|
-
import { UrlFormatter } from './urls.mjs';
|
|
37
|
-
import { StatisticsStub } from './statistics-stub.mjs';
|
package/lib/v1/authors.d.mts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
export type AuthorList = import("../../types/AuthorList").AuthorList;
|
|
2
|
+
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
3
|
+
export type Frontmatter = import("../../types/Frontmatter").Frontmatter;
|
|
1
4
|
/**
|
|
2
5
|
* @typedef { import("../../types/AuthorList").AuthorList } AuthorList
|
|
3
6
|
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
4
7
|
* @typedef { import("../../types/Frontmatter").Frontmatter } Frontmatter
|
|
5
8
|
*/
|
|
6
|
-
export class Authors {
|
|
9
|
+
export declare class Authors {
|
|
10
|
+
posts: Posts;
|
|
7
11
|
/**
|
|
8
12
|
* Constructor
|
|
9
13
|
* @param {Posts} posts
|
|
10
14
|
*/
|
|
11
15
|
constructor(posts: Posts);
|
|
12
|
-
posts: Posts;
|
|
13
16
|
/**
|
|
14
17
|
* Gets a list of authors, and exposes main author and contributors
|
|
15
18
|
* @param {Frontmatter} frontmatter
|
|
@@ -23,6 +26,3 @@ export class Authors {
|
|
|
23
26
|
*/
|
|
24
27
|
info(slug: string): MarkdownInstance;
|
|
25
28
|
}
|
|
26
|
-
export type AuthorList = import("../../types/AuthorList").AuthorList;
|
|
27
|
-
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
28
|
-
export type Frontmatter = import("../../types/Frontmatter").Frontmatter;
|
package/lib/v1/cache.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export class Cache {
|
|
1
|
+
export declare class Cache {
|
|
2
|
+
maxAge: number;
|
|
2
3
|
/**
|
|
3
4
|
* Constructor
|
|
4
5
|
* @param {number} maxAge
|
|
5
6
|
*/
|
|
6
7
|
constructor(maxAge: number);
|
|
7
|
-
maxAge: number;
|
|
8
8
|
/**
|
|
9
9
|
* Gets an item from the cache, falls back to supplied function
|
|
10
10
|
* @param {string} key
|
package/lib/v1/dates.d.mts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef { import("../types/Site") } Site
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Site = import("../types/Site");
|
|
5
|
+
export declare class DateFormatter {
|
|
6
|
+
dateOptions: Intl.DateTimeFormatOptions;
|
|
7
|
+
shortDateOptions: Intl.DateTimeFormatOptions;
|
|
5
8
|
/**
|
|
6
9
|
* Constructor
|
|
7
10
|
* @param {Intl.DateTimeFormatOptions} dateOptions
|
|
8
11
|
* @param {Intl.DateTimeFormatOptions} shortDateOptions
|
|
9
12
|
*/
|
|
10
13
|
constructor(dateOptions: Intl.DateTimeFormatOptions, shortDateOptions: Intl.DateTimeFormatOptions);
|
|
11
|
-
dateOptions: Intl.DateTimeFormatOptions;
|
|
12
|
-
shortDateOptions: Intl.DateTimeFormatOptions;
|
|
13
14
|
/**
|
|
14
15
|
* Returns the formatted pubDate
|
|
15
16
|
* @param {string | Date} date
|
|
@@ -39,4 +40,3 @@ export class DateFormatter {
|
|
|
39
40
|
*/
|
|
40
41
|
formatShortDateWithoutDay(date: string | Date, lang: string): string;
|
|
41
42
|
}
|
|
42
|
-
export type Site = any;
|
package/lib/v1/markdown.d.mts
CHANGED
package/lib/v1/navigation.d.mts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Posts = import("./posts.mjs").Posts;
|
|
2
|
+
export type Taxonomy = import("./taxonomy.mjs").Taxonomy;
|
|
3
|
+
export type UrlFormatter = import("./urls.mjs").UrlFormatter;
|
|
4
|
+
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
5
|
+
export type NavPage = import("../../types/NavPage").NavPage;
|
|
6
|
+
export type MenuItem = import("../../types/NavPage").MenuItem;
|
|
7
|
+
export declare class Navigation {
|
|
8
|
+
posts: import("./posts.mjs").Posts;
|
|
9
|
+
urlFormatter: import("./urls.mjs").UrlFormatter;
|
|
10
|
+
taxonomy: import("./taxonomy.mjs").Taxonomy;
|
|
2
11
|
/**
|
|
3
12
|
* Constructor
|
|
4
13
|
* @param {Posts} posts
|
|
@@ -6,9 +15,6 @@ export class Navigation {
|
|
|
6
15
|
* @param {Taxonomy} taxonomy
|
|
7
16
|
*/
|
|
8
17
|
constructor(posts: Posts, urlFormatter: UrlFormatter, taxonomy: Taxonomy);
|
|
9
|
-
posts: import("./posts.mjs").Posts;
|
|
10
|
-
urlFormatter: import("./urls.mjs").UrlFormatter;
|
|
11
|
-
taxonomy: import("./taxonomy.mjs").Taxonomy;
|
|
12
18
|
/**
|
|
13
19
|
* Returns a list of breadcrumbs
|
|
14
20
|
* @param {URL} currentUrl
|
|
@@ -24,7 +30,7 @@ export class Navigation {
|
|
|
24
30
|
* @param {(MenuItem | 'auto')[]} menu
|
|
25
31
|
* @returns {NavPage[]}
|
|
26
32
|
*/
|
|
27
|
-
menu(currentUrl: URL, subfolder: string, menu: (MenuItem |
|
|
33
|
+
menu(currentUrl: URL, subfolder: string, menu: (MenuItem | 'auto')[]): NavPage[];
|
|
28
34
|
addMenuItem(pages: any, item: any, subfolder: any): void;
|
|
29
35
|
/**
|
|
30
36
|
*
|
|
@@ -47,7 +53,7 @@ export class Navigation {
|
|
|
47
53
|
* @param {(MenuItem | 'categories' | 'tags' | 'toptags')[]} menu
|
|
48
54
|
* @returns {NavPage[]}
|
|
49
55
|
*/
|
|
50
|
-
footer(currentUrl: URL, _: TranslationProvider, translations: any, subfolder: string, menu: (MenuItem |
|
|
56
|
+
footer(currentUrl: URL, _: TranslationProvider, translations: any, subfolder: string, menu: (MenuItem | 'categories' | 'tags' | 'toptags')[]): NavPage[];
|
|
51
57
|
addFooterItem(pages: any, item: any, links: any, _: any, translations: any, subfolder: any, entries: any): void;
|
|
52
58
|
/**
|
|
53
59
|
*
|
|
@@ -102,7 +108,19 @@ export class Navigation {
|
|
|
102
108
|
* @param {NavPage | 'auto' | 'tags' | 'toptags' | 'categories'} item
|
|
103
109
|
* @returns {item is NavPage}
|
|
104
110
|
*/
|
|
105
|
-
isNavPage(item: NavPage |
|
|
111
|
+
isNavPage(item: NavPage | 'auto' | 'tags' | 'toptags' | 'categories'): item is NavPage;
|
|
112
|
+
/**
|
|
113
|
+
* Counts non-empty path segments so trailing slashes do not affect depth
|
|
114
|
+
* @param {string | null | undefined} path
|
|
115
|
+
* @returns {number}
|
|
116
|
+
*/
|
|
117
|
+
pathDepth(path: string | null | undefined): number;
|
|
118
|
+
/**
|
|
119
|
+
* Normalizes a path for comparison by joining non-empty segments
|
|
120
|
+
* @param {string | null | undefined} path
|
|
121
|
+
* @returns {string}
|
|
122
|
+
*/
|
|
123
|
+
normalizePath(path: string | null | undefined): string;
|
|
106
124
|
/**
|
|
107
125
|
* Pops matching page from array
|
|
108
126
|
* @param {MarkdownInstance[]} allPages
|
|
@@ -111,9 +129,3 @@ export class Navigation {
|
|
|
111
129
|
*/
|
|
112
130
|
popMatchingPage(allPages: MarkdownInstance[], search: string): import("../../types/Astro").MarkdownInstance | null;
|
|
113
131
|
}
|
|
114
|
-
export type Posts = import("./posts.mjs").Posts;
|
|
115
|
-
export type Taxonomy = import("./taxonomy.mjs").Taxonomy;
|
|
116
|
-
export type UrlFormatter = import("./urls.mjs").UrlFormatter;
|
|
117
|
-
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
118
|
-
export type NavPage = import("../../types/NavPage").NavPage;
|
|
119
|
-
export type MenuItem = import("../../types/NavPage").MenuItem;
|
package/lib/v1/navigation.mjs
CHANGED
|
@@ -120,7 +120,7 @@ export class Navigation {
|
|
|
120
120
|
page.url != '/'
|
|
121
121
|
&& mp.url != page.url
|
|
122
122
|
&& mp.url.startsWith(page.url)
|
|
123
|
-
&& mp.url
|
|
123
|
+
&& this.pathDepth(mp.url) == (this.pathDepth(page.url) + 1)
|
|
124
124
|
)
|
|
125
125
|
.sort((mp) => mp.order);
|
|
126
126
|
|
|
@@ -458,6 +458,30 @@ export class Navigation {
|
|
|
458
458
|
return true;
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
+
/**
|
|
462
|
+
* Counts non-empty path segments so trailing slashes do not affect depth
|
|
463
|
+
* @param {string | null | undefined} path
|
|
464
|
+
* @returns {number}
|
|
465
|
+
*/
|
|
466
|
+
pathDepth(path) {
|
|
467
|
+
const url = path ?? '/';
|
|
468
|
+
return url.split('/').filter((segment) => segment.length > 0).length;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Normalizes a path for comparison by joining non-empty segments
|
|
473
|
+
* @param {string | null | undefined} path
|
|
474
|
+
* @returns {string}
|
|
475
|
+
*/
|
|
476
|
+
normalizePath(path) {
|
|
477
|
+
const depth = this.pathDepth(path);
|
|
478
|
+
if (depth === 0) {
|
|
479
|
+
return '/';
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return '/' + (path ?? '/').split('/').filter((segment) => segment.length > 0).join('/');
|
|
483
|
+
}
|
|
484
|
+
|
|
461
485
|
/**
|
|
462
486
|
* Pops matching page from array
|
|
463
487
|
* @param {MarkdownInstance[]} allPages
|
|
@@ -468,9 +492,10 @@ export class Navigation {
|
|
|
468
492
|
const numberToRemove = 1;
|
|
469
493
|
let indexToRemove = -1;
|
|
470
494
|
let match = null;
|
|
495
|
+
const normalizedSearch = this.normalizePath(search);
|
|
471
496
|
|
|
472
497
|
for (let i = 0; i < allPages.length; i++) {
|
|
473
|
-
if (allPages[i].url
|
|
498
|
+
if (this.normalizePath(allPages[i].url) === normalizedSearch) {
|
|
474
499
|
indexToRemove = i;
|
|
475
500
|
match = allPages[i];
|
|
476
501
|
}
|
package/lib/v1/paging.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef { import("../../types/Link").Link } Link
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Link = import("../../types/Link").Link;
|
|
5
|
+
export declare class Paging {
|
|
5
6
|
/**
|
|
6
7
|
* Provides a list of paging links, 1 ... 3 4 5 ... 7
|
|
7
8
|
* @param {number} limit
|
|
@@ -12,4 +13,3 @@ export class Paging {
|
|
|
12
13
|
*/
|
|
13
14
|
links(limit: number, numberOfPages: number, currentPage: number, url: string): Link[];
|
|
14
15
|
}
|
|
15
|
-
export type Link = import("../../types/Link").Link;
|
package/lib/v1/posts.d.mts
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
3
3
|
* @typedef { import("./cache.mjs").Cache } Cache
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
6
|
+
export type Cache = import("./cache.mjs").Cache;
|
|
7
|
+
export declare class Posts {
|
|
8
|
+
cache: import("./cache.mjs").Cache;
|
|
9
|
+
fetchAll: () => any;
|
|
6
10
|
/**
|
|
7
11
|
* Constructor
|
|
8
12
|
* @param {Cache} cache
|
|
9
13
|
* @param {() => MarkdownInstance[]} [fetchAll]
|
|
10
14
|
*/
|
|
11
15
|
constructor(cache: Cache, fetchAll?: () => MarkdownInstance[]);
|
|
12
|
-
cache: import("./cache.mjs").Cache;
|
|
13
|
-
fetchAll: () => any;
|
|
14
16
|
/**
|
|
15
17
|
* Gets all markdown posts in the site
|
|
16
18
|
* @returns {MarkdownInstance[]}
|
|
@@ -22,5 +24,3 @@ export class Posts {
|
|
|
22
24
|
*/
|
|
23
25
|
root(subfolder: any): MarkdownInstance[];
|
|
24
26
|
}
|
|
25
|
-
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
26
|
-
export type Cache = import("./cache.mjs").Cache;
|
package/lib/v1/taxonomy.d.mts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export type Cache = import("./cache.mjs").Cache;
|
|
2
|
+
export type Posts = import("./posts.mjs").Posts;
|
|
3
|
+
export type UrlFormatter = import("./urls.mjs").UrlFormatter;
|
|
4
|
+
export type Site = import("../../types/Site").Site;
|
|
5
|
+
export type TaxonomyList = import("../../types/Taxonomy").TaxonomyList;
|
|
6
|
+
export type TaxonomyEntry = import("../../types/Taxonomy").TaxonomyEntry;
|
|
7
|
+
export type TaxonomyLinks = import("../../types/Taxonomy").TaxonomyLinks;
|
|
8
|
+
export type MarkdownInstance = import("../../types/Astro").MarkdownInstance;
|
|
1
9
|
/**
|
|
2
10
|
* @typedef { import("./cache.mjs").Cache } Cache
|
|
3
11
|
* @typedef { import("./posts.mjs").Posts } Posts
|
|
@@ -8,7 +16,10 @@
|
|
|
8
16
|
* @typedef { import("../../types/Taxonomy").TaxonomyLinks } TaxonomyLinks
|
|
9
17
|
* @typedef { import("../../types/Astro").MarkdownInstance } MarkdownInstance
|
|
10
18
|
*/
|
|
11
|
-
export class Taxonomy {
|
|
19
|
+
export declare class Taxonomy {
|
|
20
|
+
cache: import("./cache.mjs").Cache;
|
|
21
|
+
posts: import("./posts.mjs").Posts;
|
|
22
|
+
urlFormatter: import("./urls.mjs").UrlFormatter;
|
|
12
23
|
/**
|
|
13
24
|
* Constructor
|
|
14
25
|
* @param {Cache} cache
|
|
@@ -16,9 +27,6 @@ export class Taxonomy {
|
|
|
16
27
|
* @param {UrlFormatter} urlFormatter
|
|
17
28
|
*/
|
|
18
29
|
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
30
|
/**
|
|
23
31
|
*
|
|
24
32
|
* @returns {TaxonomyList}
|
|
@@ -43,7 +51,7 @@ export class Taxonomy {
|
|
|
43
51
|
* @param {TaxonomyEntry} b
|
|
44
52
|
* @returns
|
|
45
53
|
*/
|
|
46
|
-
sortByTitle(a: TaxonomyEntry, b: TaxonomyEntry):
|
|
54
|
+
sortByTitle(a: TaxonomyEntry, b: TaxonomyEntry): -1 | 0 | 1;
|
|
47
55
|
/**
|
|
48
56
|
* Sorts taxonomy entries by title
|
|
49
57
|
* @param {TaxonomyEntry} a
|
|
@@ -52,11 +60,3 @@ export class Taxonomy {
|
|
|
52
60
|
*/
|
|
53
61
|
sortByVolume(a: TaxonomyEntry, b: TaxonomyEntry): number;
|
|
54
62
|
}
|
|
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/urls.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export class UrlFormatter {
|
|
1
|
+
export declare class UrlFormatter {
|
|
2
|
+
siteUrl: string;
|
|
3
|
+
subfolder: string;
|
|
4
|
+
useTrailingUrlSlash: boolean;
|
|
2
5
|
/**
|
|
3
6
|
* Constructor
|
|
4
7
|
* @param {string} siteUrl
|
|
@@ -6,9 +9,6 @@ export class UrlFormatter {
|
|
|
6
9
|
* @param {boolean} useTrailingUrlSlash
|
|
7
10
|
*/
|
|
8
11
|
constructor(siteUrl: string, subfolder: string, useTrailingUrlSlash: boolean);
|
|
9
|
-
siteUrl: string;
|
|
10
|
-
subfolder: string;
|
|
11
|
-
useTrailingUrlSlash: boolean;
|
|
12
12
|
/** Uses config to decide whether to add or remove trailing slashes
|
|
13
13
|
* @param {URL} url
|
|
14
14
|
* @returns {URL}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-accelerator-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.99",
|
|
4
4
|
"description": "Astro utilities for Astro Accelerator.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"homepage": "https://astro.stevefenton.co.uk/",
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@cucumber/cucumber": "^13.0.0",
|
|
40
|
-
"@types/node": "^26.1.
|
|
40
|
+
"@types/node": "^26.1.1",
|
|
41
41
|
"c8": "^11.0.0",
|
|
42
42
|
"cspell": "^10.0.1",
|
|
43
43
|
"rehype-stringify": "^10.0.1",
|
|
44
44
|
"remark-parse": "^11.0.0",
|
|
45
45
|
"remark-rehype": "^11.1.2",
|
|
46
|
-
"typescript": "^
|
|
46
|
+
"typescript": "^7.0.2",
|
|
47
47
|
"unified": "^11.0.5"
|
|
48
48
|
}
|
|
49
49
|
}
|