astro-accelerator-utils 0.0.44 → 0.0.45

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
@@ -3,11 +3,10 @@ import * as PostFiltering from "./lib/postFiltering.mjs";
3
3
  import * as PostOrdering from "./lib/postOrdering.mjs";
4
4
  import * as PostPaging from "./lib/postPaging.mjs";
5
5
  import * as Cache from "./lib/cache.mjs";
6
- import * as Config from "./lib/config.mjs";
7
6
  import * as Dates from "./lib/dates.mjs";
8
7
  import * as FooterMenu from "./lib/footerMenu.mjs";
9
8
  import * as Markdown from "./lib/markdown.mjs";
10
9
  import * as Navigation from "./lib/navigation.mjs";
11
10
  import * as Taxonomy from "./lib/taxonomy.mjs";
12
11
  import * as Urls from "./lib/urls.mjs";
13
- export { PostQueries, PostFiltering, PostOrdering, PostPaging, Cache, Config, Dates, FooterMenu, Markdown, Navigation, Taxonomy, Urls };
12
+ export { PostQueries, PostFiltering, PostOrdering, PostPaging, Cache, Dates, FooterMenu, Markdown, Navigation, Taxonomy, Urls };
package/index.mjs CHANGED
@@ -3,7 +3,6 @@ import * as PostFiltering from './lib/postFiltering.mjs';
3
3
  import * as PostOrdering from './lib/postOrdering.mjs';
4
4
  import * as PostPaging from './lib/postPaging.mjs';
5
5
  import * as Cache from './lib/cache.mjs';
6
- import * as Config from './lib/config.mjs';
7
6
  import * as Dates from './lib/dates.mjs';
8
7
  import * as FooterMenu from './lib/footerMenu.mjs';
9
8
  import * as Markdown from './lib/markdown.mjs';
@@ -17,7 +16,6 @@ export {
17
16
  PostOrdering,
18
17
  PostPaging,
19
18
  Cache,
20
- Config,
21
19
  Dates,
22
20
  FooterMenu,
23
21
  Markdown,
package/lib/cache.d.mts CHANGED
@@ -22,4 +22,9 @@ export function getItem(key: string): Promise<any>;
22
22
  * @returns {Promise<void>}
23
23
  */
24
24
  export function setItem(key: string, value: any): Promise<void>;
25
+ /**
26
+ * Clears the cache
27
+ * @returns {Promise<void>}
28
+ */
29
+ export function clear(): Promise<void>;
25
30
  export const maxAge: 200;
package/lib/cache.mjs CHANGED
@@ -58,3 +58,16 @@ export async function setItem (key, value) {
58
58
  const itemPath = await getItemPath(key);
59
59
  await fs.promises.writeFile(itemPath, JSON.stringify(value));
60
60
  }
61
+
62
+ /**
63
+ * Clears the cache
64
+ * @returns {Promise<void>}
65
+ */
66
+ export async function clear() {
67
+ const path = await getCachePath();
68
+ const files = await fs.promises.readdir(path);
69
+
70
+ for(const file of files) {
71
+ await fs.promises.unlink(path.join(path, file));
72
+ }
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-accelerator-utils",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "Astro utilities for Astro Accelerator.",
5
5
  "main": "index.mjs",
6
6
  "files": [
package/lib/config.d.mts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * @typedef { import("../types/Site").Site } Site
3
- */
4
- /**
5
- * Gets default configuration
6
- * @returns {Site}
7
- */
8
- export function getDefault(): Site;
9
- export type Site = import("../types/Site").Site;
package/lib/config.mjs DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * @typedef { import("../types/Site").Site } Site
3
- */
4
-
5
- /**
6
- * Gets default configuration
7
- * @returns {Site}
8
- */
9
- export function getDefault() {
10
- return {
11
- owner: '',
12
- url: '',
13
- feedUrl: '',
14
- title: '',
15
- description: '',
16
- themeColor: '#222255',
17
- subfolder: '',
18
- defaultLanguage: 'en',
19
- default: {
20
- lang: 'en',
21
- locale: 'en-US',
22
- dir: 'ltr'
23
- },
24
- search: {
25
- fallbackUrl: 'https://www.google.com/search',
26
- fallbackSite: 'q',
27
- fallbackQuery: 'q',
28
- },
29
- pageSize: 12,
30
- pageLinks: 3,
31
- rssLimit: 20,
32
- dateOptions: {
33
- weekday: 'long',
34
- year: 'numeric',
35
- month: 'long',
36
- day: 'numeric',
37
- },
38
- featureFlags: {
39
- codeBlocks: ['copy'],
40
- figures: ['enlarge'],
41
- youTubeLinks: ['embed'],
42
- },
43
- images: {
44
- contentSize: '(max-width: 860px) 100vw, 620px',
45
- listerSize: '(max-width: 860px) 90vw, 350px',
46
- authorSize: '50px',
47
- }
48
- };
49
- }