astro-accelerator-utils 0.1.22 → 0.2.1

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 CHANGED
@@ -1,12 +1,4 @@
1
- import { Authors } from "./lib/v1/authors.mjs";
2
- import { Cache } from "./lib/v1/cache.mjs";
3
- import { DateFormatter } from "./lib/v1/dates.mjs";
4
- import { Markdown } from "./lib/v1/markdown.mjs";
5
- import { Navigation } from "./lib/v1/navigation.mjs";
6
- import { Paging } from "./lib/v1/paging.mjs";
7
- import { Posts } from "./lib/v1/posts.mjs";
8
- import { Taxonomy } from "./lib/v1/taxonomy.mjs";
9
- import { UrlFormatter } from "./lib/v1/urls.mjs";
1
+ import { Factory } from "./lib/v1/_factory.mjs";
10
2
  import * as PostFiltering from "./lib/postFiltering.mjs";
11
3
  import * as PostOrdering from "./lib/postOrdering.mjs";
12
- export { Authors, Cache, DateFormatter, Markdown, Navigation, Paging, Posts, Taxonomy, UrlFormatter, PostFiltering, PostOrdering };
4
+ export { Factory, PostFiltering, PostOrdering };
package/index.mjs CHANGED
@@ -1,26 +1,10 @@
1
- import { Authors } from './lib/v1/authors.mjs';
2
- import { Cache } from './lib/v1/cache.mjs';
3
- import { DateFormatter } from './lib/v1/dates.mjs';
4
- import { Markdown } from './lib/v1/markdown.mjs';
5
- import { Navigation } from './lib/v1/navigation.mjs';
6
- import { Paging } from './lib/v1/paging.mjs';
7
- import { Posts } from './lib/v1/posts.mjs';
8
- import { Taxonomy } from './lib/v1/taxonomy.mjs';
9
- import { UrlFormatter } from './lib/v1/urls.mjs';
1
+ import { Factory } from './lib/v1/_factory.mjs';
10
2
 
11
3
  import * as PostFiltering from './lib/postFiltering.mjs';
12
4
  import * as PostOrdering from './lib/postOrdering.mjs';
13
5
 
14
6
  export {
15
- Authors,
16
- Cache,
17
- DateFormatter,
18
- Markdown,
19
- Navigation,
20
- Paging,
21
- Posts,
22
- Taxonomy,
23
- UrlFormatter,
7
+ Factory,
24
8
  PostFiltering,
25
9
  PostOrdering
26
10
  };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @typedef { import("../../types/Site").Site } Site
3
+ */
4
+ export class Factory {
5
+ /**
6
+ * @param {Site} site
7
+ */
8
+ constructor(site: Site);
9
+ cacheMaxAge: number;
10
+ dateOptions: Intl.DateTimeFormatOptions;
11
+ siteUrl: any;
12
+ get authors(): Authors;
13
+ get cache(): Cache;
14
+ get dateFormatter(): DateFormatter;
15
+ get markdown(): Markdown;
16
+ get navigation(): Navigation;
17
+ get paging(): Paging;
18
+ get posts(): Posts;
19
+ get taxonomy(): Taxonomy;
20
+ get urlFormatter(): UrlFormatter;
21
+ }
22
+ export type Site = import("../../types/Site").Site;
23
+ import { Authors } from "./authors.mjs";
24
+ import { Cache } from "./cache.mjs";
25
+ import { DateFormatter } from "./dates.mjs";
26
+ import { Markdown } from "./markdown.mjs";
27
+ import { Navigation } from "./navigation.mjs";
28
+ import { Paging } from "./paging.mjs";
29
+ import { Posts } from "./posts.mjs";
30
+ import { Taxonomy } from "./taxonomy.mjs";
31
+ import { UrlFormatter } from "./urls.mjs";
@@ -0,0 +1,60 @@
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
+
11
+ /**
12
+ * @typedef { import("../../types/Site").Site } Site
13
+ */
14
+
15
+ export class Factory {
16
+ /**
17
+ * @param {Site} site
18
+ */
19
+ constructor(site) {
20
+ this.cacheMaxAge = site.cacheMaxAge;
21
+ this.dateOptions = site.dateOptions;
22
+ this.siteUrl = site.siteUrl;
23
+ }
24
+
25
+ get authors() {
26
+ return new Authors(this.posts);
27
+ }
28
+
29
+ get cache() {
30
+ return new Cache(this.cacheMaxAge);
31
+ }
32
+
33
+ get dateFormatter() {
34
+ return new DateFormatter(this.dateOptions)
35
+ }
36
+
37
+ get markdown() {
38
+ return new Markdown();
39
+ }
40
+
41
+ get navigation() {
42
+ return new Navigation(this.posts, this.UrlFormatter);
43
+ }
44
+
45
+ get paging() {
46
+ return new Paging();
47
+ }
48
+
49
+ get posts() {
50
+ return new Posts(this.cache);
51
+ }
52
+
53
+ get taxonomy() {
54
+ return new Taxonomy(this.cache, this.posts, this.UrlFormatter);
55
+ }
56
+
57
+ get urlFormatter() {
58
+ return new UrlFormatter(this.siteUrl)
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-accelerator-utils",
3
- "version": "0.1.22",
3
+ "version": "0.2.1",
4
4
  "description": "Astro utilities for Astro Accelerator.",
5
5
  "main": "index.mjs",
6
6
  "type": "module",