astro 5.5.3 → 5.5.5
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/dist/actions/noop-actions.d.ts +2 -0
- package/dist/actions/noop-actions.js +6 -0
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/index.js +19 -6
- package/dist/core/app/types.d.ts +1 -1
- package/dist/core/base-pipeline.d.ts +2 -2
- package/dist/core/base-pipeline.js +3 -2
- package/dist/core/build/generate.js +9 -3
- package/dist/core/build/plugins/plugin-ssr.js +1 -2
- package/dist/core/config/vite-load.js +3 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.d.ts +4 -3
- package/dist/core/cookies/cookies.js +14 -9
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/routing/3xx.d.ts +3 -2
- package/dist/core/routing/3xx.js +10 -5
- package/dist/runtime/server/render/page.js +8 -1
- package/dist/runtime/server/render/server-islands.js +6 -6
- package/dist/vite-plugin-astro-server/response.js +5 -1
- package/dist/vite-plugin-astro-server/route.js +3 -1
- package/package.json +3 -4
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.5.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.5.5") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.5.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.5.
|
|
164
|
+
if ("5.5.5") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.5.5");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { collapseDuplicateTrailingSlashes, hasFileExtension } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { normalizeTheLocale } from "../../i18n/index.js";
|
|
3
3
|
import {
|
|
4
|
+
DEFAULT_404_COMPONENT,
|
|
4
5
|
REROUTABLE_STATUS_CODES,
|
|
5
6
|
REROUTE_DIRECTIVE_HEADER,
|
|
6
7
|
clientAddressSymbol,
|
|
@@ -36,7 +37,6 @@ class App {
|
|
|
36
37
|
#baseWithoutTrailingSlash;
|
|
37
38
|
#pipeline;
|
|
38
39
|
#adapterLogger;
|
|
39
|
-
#renderOptionsDeprecationWarningShown = false;
|
|
40
40
|
constructor(manifest, streaming = true) {
|
|
41
41
|
this.#manifest = manifest;
|
|
42
42
|
this.#manifestData = {
|
|
@@ -195,12 +195,20 @@ class App {
|
|
|
195
195
|
const redirect = this.#redirectTrailingSlash(url.pathname);
|
|
196
196
|
if (redirect !== url.pathname) {
|
|
197
197
|
const status = request.method === "GET" ? 301 : 308;
|
|
198
|
-
return new Response(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
return new Response(
|
|
199
|
+
redirectTemplate({
|
|
200
|
+
status,
|
|
201
|
+
relativeLocation: url.pathname,
|
|
202
|
+
absoluteLocation: redirect,
|
|
203
|
+
from: request.url
|
|
204
|
+
}),
|
|
205
|
+
{
|
|
206
|
+
status,
|
|
207
|
+
headers: {
|
|
208
|
+
location: redirect + url.search
|
|
209
|
+
}
|
|
202
210
|
}
|
|
203
|
-
|
|
211
|
+
);
|
|
204
212
|
}
|
|
205
213
|
addCookieHeader = renderOptions?.addCookieHeader;
|
|
206
214
|
clientAddress = renderOptions?.clientAddress ?? Reflect.get(request, clientAddressSymbol);
|
|
@@ -226,6 +234,11 @@ class App {
|
|
|
226
234
|
this.#logger.debug("router", "Astro matched the following route for " + request.url);
|
|
227
235
|
this.#logger.debug("router", "RouteData:\n" + routeData);
|
|
228
236
|
}
|
|
237
|
+
if (!routeData) {
|
|
238
|
+
routeData = this.#manifestData.routes.find(
|
|
239
|
+
(route) => route.component === "404.astro" || route.component === DEFAULT_404_COMPONENT
|
|
240
|
+
);
|
|
241
|
+
}
|
|
229
242
|
if (!routeData) {
|
|
230
243
|
this.#logger.debug("router", "Astro hasn't found routes that match " + request.url);
|
|
231
244
|
this.#logger.debug("router", "Here's the available routes:\n", this.#manifestData);
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export type SSRManifest = {
|
|
|
67
67
|
key: Promise<CryptoKey>;
|
|
68
68
|
i18n: SSRManifestI18n | undefined;
|
|
69
69
|
middleware?: () => Promise<AstroMiddlewareInstance> | AstroMiddlewareInstance;
|
|
70
|
-
actions?: SSRActions;
|
|
70
|
+
actions?: () => Promise<SSRActions> | SSRActions;
|
|
71
71
|
checkOrigin: boolean;
|
|
72
72
|
sessionConfig?: ResolvedSessionConfig<any>;
|
|
73
73
|
cacheDir: string | URL;
|
|
@@ -51,7 +51,7 @@ export declare abstract class Pipeline {
|
|
|
51
51
|
route: string;
|
|
52
52
|
component: string;
|
|
53
53
|
}[];
|
|
54
|
-
readonly actions: SSRActions | undefined;
|
|
54
|
+
readonly actions: (() => Promise<SSRActions> | SSRActions) | undefined;
|
|
55
55
|
readonly internalMiddleware: MiddlewareHandler[];
|
|
56
56
|
resolvedMiddleware: MiddlewareHandler | undefined;
|
|
57
57
|
resolvedActions: SSRActions | undefined;
|
|
@@ -81,7 +81,7 @@ export declare abstract class Pipeline {
|
|
|
81
81
|
matchesComponent(filePath: URL): boolean;
|
|
82
82
|
route: string;
|
|
83
83
|
component: string;
|
|
84
|
-
}[], actions?: SSRActions | undefined);
|
|
84
|
+
}[], actions?: (() => Promise<SSRActions> | SSRActions) | undefined);
|
|
85
85
|
abstract headElements(routeData: RouteData): Promise<HeadElements> | HeadElements;
|
|
86
86
|
abstract componentMetadata(routeData: RouteData): Promise<SSRResult['componentMetadata']> | void;
|
|
87
87
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NOOP_ACTIONS_MOD } from "../actions/noop-actions.js";
|
|
1
2
|
import { createI18nMiddleware } from "../i18n/middleware.js";
|
|
2
3
|
import { createOriginCheckMiddleware } from "./app/middlewares.js";
|
|
3
4
|
import { ActionNotFoundError } from "./errors/errors-data.js";
|
|
@@ -63,9 +64,9 @@ class Pipeline {
|
|
|
63
64
|
if (this.resolvedActions) {
|
|
64
65
|
return this.resolvedActions;
|
|
65
66
|
} else if (this.actions) {
|
|
66
|
-
return this.actions;
|
|
67
|
+
return await this.actions();
|
|
67
68
|
}
|
|
68
|
-
return
|
|
69
|
+
return NOOP_ACTIONS_MOD;
|
|
69
70
|
}
|
|
70
71
|
async getAction(path) {
|
|
71
72
|
const pathKeys = path.split(".").map((key) => decodeURIComponent(key));
|
|
@@ -3,6 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import { bgGreen, black, blue, bold, dim, green, magenta, red, yellow } from "kleur/colors";
|
|
4
4
|
import PLimit from "p-limit";
|
|
5
5
|
import PQueue from "p-queue";
|
|
6
|
+
import { NOOP_ACTIONS_MOD } from "../../actions/noop-actions.js";
|
|
6
7
|
import {
|
|
7
8
|
generateImagesForPath,
|
|
8
9
|
getStaticImageList,
|
|
@@ -44,7 +45,7 @@ async function generatePages(options, internals) {
|
|
|
44
45
|
const renderersEntryUrl = new URL("renderers.mjs", baseDirectory);
|
|
45
46
|
const renderers = await import(renderersEntryUrl.toString());
|
|
46
47
|
const middleware = internals.middlewareEntryPoint ? await import(internals.middlewareEntryPoint.toString()).then((mod) => mod.onRequest) : NOOP_MIDDLEWARE_FN;
|
|
47
|
-
const actions = internals.astroActionsEntryPoint ? await import(internals.astroActionsEntryPoint.toString()).then((mod) => mod) :
|
|
48
|
+
const actions = internals.astroActionsEntryPoint ? await import(internals.astroActionsEntryPoint.toString()).then((mod) => mod) : NOOP_ACTIONS_MOD;
|
|
48
49
|
manifest = createBuildManifest(
|
|
49
50
|
options.settings,
|
|
50
51
|
internals,
|
|
@@ -327,7 +328,12 @@ async function generatePath(pathname, pipeline, gopts, route) {
|
|
|
327
328
|
const siteURL = config.site;
|
|
328
329
|
const location = siteURL ? new URL(locationSite, siteURL) : locationSite;
|
|
329
330
|
const fromPath = new URL(request.url).pathname;
|
|
330
|
-
body = redirectTemplate({
|
|
331
|
+
body = redirectTemplate({
|
|
332
|
+
status: response.status,
|
|
333
|
+
absoluteLocation: location,
|
|
334
|
+
relativeLocation: locationSite,
|
|
335
|
+
from: fromPath
|
|
336
|
+
});
|
|
331
337
|
if (config.compressHTML === true) {
|
|
332
338
|
body = body.replaceAll("\n", "");
|
|
333
339
|
}
|
|
@@ -400,7 +406,7 @@ function createBuildManifest(settings, internals, renderers, middleware, actions
|
|
|
400
406
|
onRequest: middleware
|
|
401
407
|
};
|
|
402
408
|
},
|
|
403
|
-
actions,
|
|
409
|
+
actions: () => actions,
|
|
404
410
|
checkOrigin: (settings.config.security?.checkOrigin && settings.buildOutput === "server") ?? false,
|
|
405
411
|
key
|
|
406
412
|
};
|
|
@@ -139,7 +139,6 @@ function generateSSRCode(adapter, middlewareId) {
|
|
|
139
139
|
const edgeMiddleware = adapter?.adapterFeatures?.edgeMiddleware ?? false;
|
|
140
140
|
const imports = [
|
|
141
141
|
`import { renderers } from '${RENDERERS_MODULE_ID}';`,
|
|
142
|
-
`import * as actions from '${ASTRO_ACTIONS_INTERNAL_MODULE_ID}';`,
|
|
143
142
|
`import * as serverEntrypointModule from '${ADAPTER_VIRTUAL_MODULE_ID}';`,
|
|
144
143
|
`import { manifest as defaultManifest } from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';`,
|
|
145
144
|
`import { serverIslandMap } from '${VIRTUAL_ISLAND_MAP_ID}';`
|
|
@@ -150,7 +149,7 @@ function generateSSRCode(adapter, middlewareId) {
|
|
|
150
149
|
` pageMap,`,
|
|
151
150
|
` serverIslandMap,`,
|
|
152
151
|
` renderers,`,
|
|
153
|
-
` actions,`,
|
|
152
|
+
` actions: () => import("${ASTRO_ACTIONS_INTERNAL_MODULE_ID}"),`,
|
|
154
153
|
` middleware: ${edgeMiddleware ? "undefined" : `() => import("${middlewareId}")`}`,
|
|
155
154
|
`});`,
|
|
156
155
|
`const _args = ${adapter.args ? JSON.stringify(adapter.args, null, 4) : "undefined"};`,
|
|
@@ -24,6 +24,9 @@ async function loadConfigWithVite({
|
|
|
24
24
|
const config = await import(pathToFileURL(configPath).toString() + "?t=" + Date.now());
|
|
25
25
|
return config.default ?? {};
|
|
26
26
|
} catch (e) {
|
|
27
|
+
if (e && typeof e === "object" && "code" in e && e.code === "ERR_DLOPEN_DISABLED") {
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
27
30
|
debug("Failed to load config with Node", e);
|
|
28
31
|
}
|
|
29
32
|
}
|
package/dist/core/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type AstroCookieSetOptions = Pick<
|
|
1
|
+
import type { SerializeOptions } from 'cookie';
|
|
2
|
+
export type AstroCookieSetOptions = Pick<SerializeOptions, 'domain' | 'path' | 'expires' | 'maxAge' | 'httpOnly' | 'sameSite' | 'secure' | 'encode'>;
|
|
3
3
|
export interface AstroCookieGetOptions {
|
|
4
4
|
decode?: (value: string) => string;
|
|
5
5
|
}
|
|
@@ -45,9 +45,10 @@ declare class AstroCookies implements AstroCookiesInterface {
|
|
|
45
45
|
* Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
|
|
46
46
|
* part of the initial request or set via Astro.cookies.set(key)
|
|
47
47
|
* @param key The cookie to check for.
|
|
48
|
+
* @param _options This parameter is no longer used.
|
|
48
49
|
* @returns
|
|
49
50
|
*/
|
|
50
|
-
has(key: string,
|
|
51
|
+
has(key: string, _options?: AstroCookieGetOptions): boolean;
|
|
51
52
|
/**
|
|
52
53
|
* Astro.cookies.set(key, value) is used to set a cookie's value. If provided
|
|
53
54
|
* an object it will be stringified via JSON.stringify(value). Additionally you
|
|
@@ -3,6 +3,7 @@ import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
|
3
3
|
const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0);
|
|
4
4
|
const DELETED_VALUE = "deleted";
|
|
5
5
|
const responseSentSymbol = Symbol.for("astro.responseSent");
|
|
6
|
+
const identity = (value) => value;
|
|
6
7
|
class AstroCookie {
|
|
7
8
|
constructor(value) {
|
|
8
9
|
this.value = value;
|
|
@@ -73,25 +74,29 @@ class AstroCookies {
|
|
|
73
74
|
return void 0;
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
const
|
|
77
|
+
const decode = options?.decode ?? decodeURIComponent;
|
|
78
|
+
const values = this.#ensureParsed();
|
|
77
79
|
if (key in values) {
|
|
78
80
|
const value = values[key];
|
|
79
|
-
|
|
81
|
+
if (value) {
|
|
82
|
+
return new AstroCookie(decode(value));
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
/**
|
|
83
87
|
* Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
|
|
84
88
|
* part of the initial request or set via Astro.cookies.set(key)
|
|
85
89
|
* @param key The cookie to check for.
|
|
90
|
+
* @param _options This parameter is no longer used.
|
|
86
91
|
* @returns
|
|
87
92
|
*/
|
|
88
|
-
has(key,
|
|
93
|
+
has(key, _options) {
|
|
89
94
|
if (this.#outgoing?.has(key)) {
|
|
90
95
|
let [, , isSetValue] = this.#outgoing.get(key);
|
|
91
96
|
return isSetValue;
|
|
92
97
|
}
|
|
93
|
-
const values = this.#ensureParsed(
|
|
94
|
-
return
|
|
98
|
+
const values = this.#ensureParsed();
|
|
99
|
+
return values[key] !== void 0;
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
102
|
* Astro.cookies.set(key, value) is used to set a cookie's value. If provided
|
|
@@ -168,9 +173,9 @@ class AstroCookies {
|
|
|
168
173
|
cookies.#consumed = true;
|
|
169
174
|
return cookies.headers();
|
|
170
175
|
}
|
|
171
|
-
#ensureParsed(
|
|
176
|
+
#ensureParsed() {
|
|
172
177
|
if (!this.#requestValues) {
|
|
173
|
-
this.#parse(
|
|
178
|
+
this.#parse();
|
|
174
179
|
}
|
|
175
180
|
if (!this.#requestValues) {
|
|
176
181
|
this.#requestValues = {};
|
|
@@ -183,12 +188,12 @@ class AstroCookies {
|
|
|
183
188
|
}
|
|
184
189
|
return this.#outgoing;
|
|
185
190
|
}
|
|
186
|
-
#parse(
|
|
191
|
+
#parse() {
|
|
187
192
|
const raw = this.#request.headers.get("cookie");
|
|
188
193
|
if (!raw) {
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
|
-
this.#requestValues = parse(raw,
|
|
196
|
+
this.#requestValues = parse(raw, { decode: identity });
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
export {
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.5.
|
|
25
|
+
const currentVersion = "5.5.5";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.5.
|
|
41
|
+
const version = "5.5.5";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -282,7 +282,7 @@ function printHelp({
|
|
|
282
282
|
message.push(
|
|
283
283
|
linebreak(),
|
|
284
284
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
285
|
-
`v${"5.5.
|
|
285
|
+
`v${"5.5.5"}`
|
|
286
286
|
)} ${headline}`
|
|
287
287
|
);
|
|
288
288
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type RedirectTemplate = {
|
|
2
2
|
from?: string;
|
|
3
|
-
|
|
3
|
+
absoluteLocation: string | URL;
|
|
4
4
|
status: number;
|
|
5
|
+
relativeLocation: string;
|
|
5
6
|
};
|
|
6
|
-
export declare function redirectTemplate({ status,
|
|
7
|
+
export declare function redirectTemplate({ status, absoluteLocation, relativeLocation, from, }: RedirectTemplate): string;
|
package/dist/core/routing/3xx.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
function redirectTemplate({
|
|
1
|
+
function redirectTemplate({
|
|
2
|
+
status,
|
|
3
|
+
absoluteLocation,
|
|
4
|
+
relativeLocation,
|
|
5
|
+
from
|
|
6
|
+
}) {
|
|
2
7
|
const delay = status === 302 ? 2 : 0;
|
|
3
8
|
return `<!doctype html>
|
|
4
|
-
<title>Redirecting to: ${
|
|
5
|
-
<meta http-equiv="refresh" content="${delay};url=${
|
|
9
|
+
<title>Redirecting to: ${relativeLocation}</title>
|
|
10
|
+
<meta http-equiv="refresh" content="${delay};url=${relativeLocation}">
|
|
6
11
|
<meta name="robots" content="noindex">
|
|
7
|
-
<link rel="canonical" href="${
|
|
12
|
+
<link rel="canonical" href="${absoluteLocation}">
|
|
8
13
|
<body>
|
|
9
|
-
<a href="${
|
|
14
|
+
<a href="${relativeLocation}">Redirecting ${from ? `from <code>${from}</code> ` : ""}to <code>${relativeLocation}</code></a>
|
|
10
15
|
</body>`;
|
|
11
16
|
}
|
|
12
17
|
export {
|
|
@@ -51,13 +51,20 @@ async function renderPage(result, componentFactory, props, children, streaming,
|
|
|
51
51
|
headers.set("Content-Length", body.byteLength.toString());
|
|
52
52
|
}
|
|
53
53
|
let status = init.status;
|
|
54
|
+
let statusText = init.statusText;
|
|
54
55
|
if (route?.route === "/404") {
|
|
55
56
|
status = 404;
|
|
57
|
+
if (statusText === "OK") {
|
|
58
|
+
statusText = "Not Found";
|
|
59
|
+
}
|
|
56
60
|
} else if (route?.route === "/500") {
|
|
57
61
|
status = 500;
|
|
62
|
+
if (statusText === "OK") {
|
|
63
|
+
statusText = "Internal Server Error";
|
|
64
|
+
}
|
|
58
65
|
}
|
|
59
66
|
if (status) {
|
|
60
|
-
return new Response(body, { ...init, headers, status });
|
|
67
|
+
return new Response(body, { ...init, headers, status, statusText });
|
|
61
68
|
} else {
|
|
62
69
|
return new Response(body, { ...init, headers });
|
|
63
70
|
}
|
|
@@ -70,7 +70,7 @@ function renderServerIsland(result, _displayName, props, slots) {
|
|
|
70
70
|
`<link rel="preload" as="fetch" href="${serverIslandUrl}" crossorigin="anonymous">`
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
destination.write(`<script async type="module" data-island-id="${hostId}">
|
|
73
|
+
destination.write(`<script async type="module" data-astro-rerun data-island-id="${hostId}">
|
|
74
74
|
let script = document.querySelector('script[data-island-id="${hostId}"]');
|
|
75
75
|
|
|
76
76
|
${useGETRequest ? (
|
|
@@ -93,11 +93,11 @@ let response = await fetch('${serverIslandUrl}', {
|
|
|
93
93
|
)}
|
|
94
94
|
if (script) {
|
|
95
95
|
if(
|
|
96
|
-
response.status === 200
|
|
97
|
-
&& response.headers.has('content-type')
|
|
96
|
+
response.status === 200
|
|
97
|
+
&& response.headers.has('content-type')
|
|
98
98
|
&& response.headers.get('content-type').split(";")[0].trim() === 'text/html') {
|
|
99
99
|
let html = await response.text();
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
// Swap!
|
|
102
102
|
while(script.previousSibling &&
|
|
103
103
|
script.previousSibling.nodeType !== 8 &&
|
|
@@ -105,11 +105,11 @@ if (script) {
|
|
|
105
105
|
script.previousSibling.remove();
|
|
106
106
|
}
|
|
107
107
|
script.previousSibling?.remove();
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
let frag = document.createRange().createContextualFragment(html);
|
|
110
110
|
script.before(frag);
|
|
111
111
|
}
|
|
112
|
-
script.remove();
|
|
112
|
+
script.remove(); // Prior to v5.4.2, this was the trick to force rerun of scripts. Keeping it to minimize change to the existing behavior.
|
|
113
113
|
}
|
|
114
114
|
</script>`);
|
|
115
115
|
}
|
|
@@ -39,7 +39,11 @@ function writeHtmlResponse(res, statusCode, html) {
|
|
|
39
39
|
res.end();
|
|
40
40
|
}
|
|
41
41
|
function writeRedirectResponse(res, statusCode, location) {
|
|
42
|
-
const html = redirectTemplate({
|
|
42
|
+
const html = redirectTemplate({
|
|
43
|
+
status: statusCode,
|
|
44
|
+
absoluteLocation: location,
|
|
45
|
+
relativeLocation: location
|
|
46
|
+
});
|
|
43
47
|
res.writeHead(statusCode, {
|
|
44
48
|
Location: location,
|
|
45
49
|
"Content-Type": "text/html",
|
|
@@ -211,10 +211,12 @@ async function handleRoute({
|
|
|
211
211
|
}
|
|
212
212
|
if (response.status < 400 && response.status >= 300) {
|
|
213
213
|
if (response.status >= 300 && response.status < 400 && routeIsRedirect(route) && !config.build.redirects && pipeline.settings.buildOutput === "static") {
|
|
214
|
+
const location = response.headers.get("location");
|
|
214
215
|
response = new Response(
|
|
215
216
|
redirectTemplate({
|
|
216
217
|
status: response.status,
|
|
217
|
-
|
|
218
|
+
absoluteLocation: location,
|
|
219
|
+
relativeLocation: location,
|
|
218
220
|
from: pathname
|
|
219
221
|
}),
|
|
220
222
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.5",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -106,7 +106,6 @@
|
|
|
106
106
|
"@astrojs/compiler": "^2.11.0",
|
|
107
107
|
"@oslojs/encoding": "^1.1.0",
|
|
108
108
|
"@rollup/pluginutils": "^5.1.4",
|
|
109
|
-
"@types/cookie": "^0.6.0",
|
|
110
109
|
"acorn": "^8.14.1",
|
|
111
110
|
"aria-query": "^5.3.2",
|
|
112
111
|
"axobject-query": "^4.1.0",
|
|
@@ -114,7 +113,7 @@
|
|
|
114
113
|
"ci-info": "^4.2.0",
|
|
115
114
|
"clsx": "^2.1.1",
|
|
116
115
|
"common-ancestor-path": "^1.0.1",
|
|
117
|
-
"cookie": "^0.
|
|
116
|
+
"cookie": "^1.0.2",
|
|
118
117
|
"cssesc": "^3.0.0",
|
|
119
118
|
"debug": "^4.4.0",
|
|
120
119
|
"deterministic-object-hash": "^2.0.2",
|
|
@@ -150,7 +149,7 @@
|
|
|
150
149
|
"unist-util-visit": "^5.0.0",
|
|
151
150
|
"unstorage": "^1.15.0",
|
|
152
151
|
"vfile": "^6.0.3",
|
|
153
|
-
"vite": "^6.2.
|
|
152
|
+
"vite": "^6.2.3",
|
|
154
153
|
"vitefu": "^1.0.6",
|
|
155
154
|
"xxhash-wasm": "^1.1.0",
|
|
156
155
|
"yargs-parser": "^21.1.1",
|