@jam-comments/astro 2.1.0 → 2.3.0

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@jam-comments/astro",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",
5
5
  "license": "GPL-2.0",
6
6
  "description": "Easily add performant, SEO-friendly comments to your Astro blog with JamComments.",
7
- "main": "./src/index.astro",
7
+ "main": "./src/component.astro",
8
8
  "types": "./index.d.ts",
9
9
  "homepage": "https://jamcomments.com",
10
10
  "repository": "github:alexmacarthur/jam-comments-javascript",
@@ -17,6 +17,14 @@
17
17
  "src",
18
18
  "index.d.ts"
19
19
  ],
20
+ "exports": {
21
+ ".": {
22
+ "import": "./src/component.astro"
23
+ },
24
+ "./config": {
25
+ "import": "./src/config.ts"
26
+ }
27
+ },
20
28
  "keywords": [
21
29
  "astro",
22
30
  "astro-component",
@@ -29,9 +37,9 @@
29
37
  "access": "public"
30
38
  },
31
39
  "dependencies": {
32
- "@astrojs/check": "^0.6.0",
33
- "@jam-comments/server-utilities": "^4.1.0",
34
- "astro": "^4.7.1",
40
+ "@astrojs/check": "^0.7.0",
41
+ "@jam-comments/server-utilities": "^4.3.1",
42
+ "astro": "^4.8.6",
35
43
  "node-fetch": "^3.3.2",
36
44
  "typescript": "^5.4.5"
37
45
  },
@@ -2,7 +2,7 @@
2
2
  import pkg from "@jam-comments/server-utilities";
3
3
  import nodeFetch from "node-fetch";
4
4
  import type { JamCommentsProps } from "..";
5
- const { markupFetcher, logError } = pkg;
5
+ const { logError, markupFetcher } = pkg;
6
6
 
7
7
  type Props = JamCommentsProps;
8
8
 
package/src/config.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { deleteTempDirectory, fetchAll } from "@jam-comments/server-utilities";
2
+
3
+ interface PluginArgs {
4
+ domain: string;
5
+ apiKey: string;
6
+ timezone?: string;
7
+ environment?: string;
8
+ }
9
+
10
+ export function jamComments({
11
+ domain,
12
+ apiKey,
13
+ environment,
14
+ timezone,
15
+ }: PluginArgs) {
16
+ return {
17
+ name: "jamcomments",
18
+ hooks: {
19
+ "astro:build:start": () => {
20
+ return fetchAll(
21
+ {
22
+ tz: timezone,
23
+ domain,
24
+ apiKey,
25
+ environment,
26
+ },
27
+ "astro",
28
+ fetch,
29
+ );
30
+ },
31
+
32
+ "astro:build:done": () => {
33
+ deleteTempDirectory();
34
+ },
35
+ },
36
+ };
37
+ }