@astrojs/cloudflare 13.1.8 → 13.1.10
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.
|
@@ -87,7 +87,7 @@ function serverStart({
|
|
|
87
87
|
host,
|
|
88
88
|
base
|
|
89
89
|
}) {
|
|
90
|
-
const version = "13.1.
|
|
90
|
+
const version = "13.1.10";
|
|
91
91
|
const localPrefix = `${colors.dim("\u2503")} Local `;
|
|
92
92
|
const networkPrefix = `${colors.dim("\u2503")} Network `;
|
|
93
93
|
const emptyPrefix = " ".repeat(11);
|
package/dist/index.js
CHANGED
package/dist/prerenderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { preview } from "vite";
|
|
1
|
+
import { preview, createLogger } from "vite";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { mkdir } from "node:fs/promises";
|
|
4
4
|
import { cloudflare as cfVitePlugin } from "@cloudflare/vite-plugin";
|
|
@@ -23,6 +23,16 @@ function createCloudflarePrerenderer({
|
|
|
23
23
|
name: "@astrojs/cloudflare:prerenderer",
|
|
24
24
|
async setup() {
|
|
25
25
|
await mkdir(clientDir, { recursive: true });
|
|
26
|
+
const defaultLogger = createLogger("info");
|
|
27
|
+
const ansiRe = /\x1b\[[0-9;]*m/g;
|
|
28
|
+
const astroRequestLogRe = /^(?:GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+\/__astro_/;
|
|
29
|
+
const customLogger = {
|
|
30
|
+
...defaultLogger,
|
|
31
|
+
info(msg, opts) {
|
|
32
|
+
if (astroRequestLogRe.test(msg.replace(ansiRe, ""))) return;
|
|
33
|
+
defaultLogger.info(msg, opts);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
26
36
|
previewServer = await preview({
|
|
27
37
|
configFile: false,
|
|
28
38
|
base,
|
|
@@ -31,7 +41,7 @@ function createCloudflarePrerenderer({
|
|
|
31
41
|
outDir: fileURLToPath(serverDir)
|
|
32
42
|
},
|
|
33
43
|
root: fileURLToPath(root),
|
|
34
|
-
|
|
44
|
+
customLogger,
|
|
35
45
|
preview: {
|
|
36
46
|
host: "localhost",
|
|
37
47
|
port: 0,
|
|
@@ -14,7 +14,10 @@ async function transform(rawUrl, images, assets) {
|
|
|
14
14
|
return new Response("Forbidden", { status: 403 });
|
|
15
15
|
}
|
|
16
16
|
const imageSrc = new URL(href, url.origin);
|
|
17
|
-
const content = await (isRemotePath(href) ? fetch(imageSrc) : assets.fetch(imageSrc));
|
|
17
|
+
const content = await (isRemotePath(href) ? fetch(imageSrc, { redirect: "manual" }) : assets.fetch(imageSrc));
|
|
18
|
+
if (content.status >= 300 && content.status < 400) {
|
|
19
|
+
return new Response("Not Found", { status: 404 });
|
|
20
|
+
}
|
|
18
21
|
if (!content.body) {
|
|
19
22
|
return new Response(null, { status: 404 });
|
|
20
23
|
}
|
|
@@ -9,13 +9,6 @@ function createNodePrerenderPlugin() {
|
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
|
-
// Disable dep optimization for the `prerender` environment so dependencies
|
|
13
|
-
// are loaded via native import() with correct import.meta.url semantics.
|
|
14
|
-
configEnvironment(environmentName) {
|
|
15
|
-
if (environmentName === "prerender") {
|
|
16
|
-
return { optimizeDeps: { noDiscovery: true, include: [] } };
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
12
|
configureServer(server) {
|
|
20
13
|
server[devPrerenderMiddlewareSymbol] = true;
|
|
21
14
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/cloudflare",
|
|
3
3
|
"description": "Deploy your site to Cloudflare Workers",
|
|
4
|
-
"version": "13.1.
|
|
4
|
+
"version": "13.1.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"piccolore": "^0.1.3",
|
|
40
40
|
"tinyglobby": "^0.2.15",
|
|
41
41
|
"vite": "^7.3.1",
|
|
42
|
-
"@astrojs/
|
|
43
|
-
"@astrojs/
|
|
42
|
+
"@astrojs/internal-helpers": "0.8.0",
|
|
43
|
+
"@astrojs/underscore-redirects": "1.0.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"astro": "^6.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/node": "^25.2.2",
|
|
52
52
|
"cheerio": "1.2.0",
|
|
53
53
|
"devalue": "^5.6.3",
|
|
54
|
-
"astro": "6.1.
|
|
54
|
+
"astro": "6.1.7",
|
|
55
55
|
"astro-scripts": "0.0.14"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|