astro-integration-pocketbase 1.4.1 → 1.4.2-next.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/package.json +12 -1
- package/src/middleware/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-integration-pocketbase",
|
|
3
|
-
"version": "1.4.1",
|
|
3
|
+
"version": "1.4.2-next.1",
|
|
4
4
|
"description": "An Astro integration to support developers working with astro-loader-pocketbase.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
"tooling"
|
|
14
14
|
],
|
|
15
15
|
"homepage": "https://github.com/pawcoding/astro-integration-pocketbase",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/pawcoding/astro-integration-pocketbase/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/pawcoding/astro-integration-pocketbase.git"
|
|
22
|
+
},
|
|
16
23
|
"license": "MIT",
|
|
17
24
|
"author": "Luis Wolf <development@pawcode.de> (https://pawcode.de)",
|
|
18
25
|
"type": "module",
|
|
@@ -52,5 +59,9 @@
|
|
|
52
59
|
"peerDependencies": {
|
|
53
60
|
"astro": "^5.0.0",
|
|
54
61
|
"eventsource": "^3.0.0"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public",
|
|
65
|
+
"provenance": true
|
|
55
66
|
}
|
|
56
67
|
}
|
package/src/middleware/index.ts
CHANGED
|
@@ -7,6 +7,12 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
7
7
|
const entities = findEntitiesRecursive(props).map((entity) => entity.data);
|
|
8
8
|
|
|
9
9
|
const response = await next();
|
|
10
|
+
const contentType = response.headers.get("content-type");
|
|
11
|
+
if (!contentType?.includes("text/html")) {
|
|
12
|
+
// Pass through non-HTML responses unchanged
|
|
13
|
+
return response;
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
const body = await response.text();
|
|
11
17
|
|
|
12
18
|
// Append the entities to the <head>
|