astro-accelerator-utils 0.3.52 → 0.3.54
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/lib/v1/accelerator.d.mts +1 -0
- package/lib/v1/accelerator.mjs +3 -1
- package/lib/v1/dates.d.mts +10 -1
- package/lib/v1/dates.mjs +17 -1
- package/package.json +3 -3
- package/types/Frontmatter.d.ts +1 -0
package/lib/v1/accelerator.d.mts
CHANGED
package/lib/v1/accelerator.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { Taxonomy } from './taxonomy.mjs';
|
|
|
9
9
|
import { UrlFormatter } from './urls.mjs';
|
|
10
10
|
import { Statistics } from './statistics.mjs';
|
|
11
11
|
import { StatisticsStub } from './statistics-stub.mjs';
|
|
12
|
+
import { getTextOfJSDocComment } from 'typescript';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @typedef { import("../../types/Site").Site } Site
|
|
@@ -21,6 +22,7 @@ export class Accelerator {
|
|
|
21
22
|
constructor(site) {
|
|
22
23
|
this.cacheMaxAge = site.cacheMaxAge;
|
|
23
24
|
this.dateOptions = site.dateOptions;
|
|
25
|
+
this.shortDateOptions = site.shortDateOptions;
|
|
24
26
|
this.siteUrl = site.url;
|
|
25
27
|
this.subfolder = site.subfolder;
|
|
26
28
|
this.useTrailingUrlSlash = site.useTrailingUrlSlash;
|
|
@@ -36,7 +38,7 @@ export class Accelerator {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
get dateFormatter() {
|
|
39
|
-
return new DateFormatter(this.dateOptions)
|
|
41
|
+
return new DateFormatter(this.dateOptions, this.shortDateOptions)
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
get markdown() {
|
package/lib/v1/dates.d.mts
CHANGED
|
@@ -5,9 +5,11 @@ export class DateFormatter {
|
|
|
5
5
|
/**
|
|
6
6
|
* Constructor
|
|
7
7
|
* @param {Intl.DateTimeFormatOptions} dateOptions
|
|
8
|
+
* @param {Intl.DateTimeFormatOptions} shortDateOptions
|
|
8
9
|
*/
|
|
9
|
-
constructor(dateOptions: Intl.DateTimeFormatOptions);
|
|
10
|
+
constructor(dateOptions: Intl.DateTimeFormatOptions, shortDateOptions: Intl.DateTimeFormatOptions);
|
|
10
11
|
dateOptions: Intl.DateTimeFormatOptions;
|
|
12
|
+
shortDateOptions: Intl.DateTimeFormatOptions;
|
|
11
13
|
/**
|
|
12
14
|
* Returns the formatted pubDate
|
|
13
15
|
* @param {string | Date} date
|
|
@@ -15,5 +17,12 @@ export class DateFormatter {
|
|
|
15
17
|
* @returns {string}
|
|
16
18
|
*/
|
|
17
19
|
formatDate(date: string | Date, lang: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the formatted pubDate
|
|
22
|
+
* @param {string | Date} date
|
|
23
|
+
* @param {string} lang
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
formatShortDate(date: string | Date, lang: string): string;
|
|
18
27
|
}
|
|
19
28
|
export type Site = any;
|
package/lib/v1/dates.mjs
CHANGED
|
@@ -6,9 +6,11 @@ export class DateFormatter {
|
|
|
6
6
|
/**
|
|
7
7
|
* Constructor
|
|
8
8
|
* @param {Intl.DateTimeFormatOptions} dateOptions
|
|
9
|
+
* @param {Intl.DateTimeFormatOptions} shortDateOptions
|
|
9
10
|
*/
|
|
10
|
-
constructor(dateOptions) {
|
|
11
|
+
constructor(dateOptions, shortDateOptions) {
|
|
11
12
|
this.dateOptions = dateOptions;
|
|
13
|
+
this.shortDateOptions = shortDateOptions;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -24,4 +26,18 @@ export class DateFormatter {
|
|
|
24
26
|
|
|
25
27
|
return '';
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the formatted pubDate
|
|
32
|
+
* @param {string | Date} date
|
|
33
|
+
* @param {string} lang
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
formatShortDate(date, lang) {
|
|
37
|
+
if (date) {
|
|
38
|
+
return new Date(date).toLocaleDateString(lang, this.shortDateOptions);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
27
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-accelerator-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.54",
|
|
4
4
|
"description": "Astro utilities for Astro Accelerator.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://astro.stevefenton.co.uk/",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"jest": "^
|
|
36
|
+
"@types/node": "^24.3.1",
|
|
37
|
+
"jest": "^30.1.3",
|
|
38
38
|
"jest-spec": "^0.0.6",
|
|
39
39
|
"rehype-stringify": "^10.0.1",
|
|
40
40
|
"remark-parse": "^11.0.0",
|