astro 6.4.4 → 6.4.6
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/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/content/vite-plugin-content-virtual-mod.js +27 -0
- package/dist/core/app/base.js +3 -5
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/default-handler.js +21 -8
- package/dist/core/errors/errors-data.d.ts +6 -6
- package/dist/core/fetch/fetch-state.js +9 -2
- package/dist/core/messages/runtime.js +1 -1
- package/dist/runtime/server/render/util.js +5 -1
- package/package.json +5 -5
|
@@ -197,7 +197,7 @@ ${contentConfig.error.message}`
|
|
|
197
197
|
logger.info("Content config changed");
|
|
198
198
|
shouldClear = true;
|
|
199
199
|
}
|
|
200
|
-
if (previousAstroVersion && previousAstroVersion !== "6.4.
|
|
200
|
+
if (previousAstroVersion && previousAstroVersion !== "6.4.6") {
|
|
201
201
|
logger.info("Astro version changed");
|
|
202
202
|
shouldClear = true;
|
|
203
203
|
}
|
|
@@ -205,8 +205,8 @@ ${contentConfig.error.message}`
|
|
|
205
205
|
logger.info("Clearing content store");
|
|
206
206
|
this.#store.clearAll();
|
|
207
207
|
}
|
|
208
|
-
if ("6.4.
|
|
209
|
-
this.#store.metaStore().set("astro-version", "6.4.
|
|
208
|
+
if ("6.4.6") {
|
|
209
|
+
this.#store.metaStore().set("astro-version", "6.4.6");
|
|
210
210
|
}
|
|
211
211
|
if (currentConfigDigest) {
|
|
212
212
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -23,6 +23,25 @@ import {
|
|
|
23
23
|
} from "./consts.js";
|
|
24
24
|
import { getDataStoreFile } from "./content-layer.js";
|
|
25
25
|
import { getContentPaths, isDeferredModule } from "./utils.js";
|
|
26
|
+
function invalidateAssetImports(viteServer, filePath) {
|
|
27
|
+
const timestamp = Date.now();
|
|
28
|
+
for (const environment of Object.values(viteServer.environments)) {
|
|
29
|
+
const modules = environment.moduleGraph.getModulesByFile(filePath);
|
|
30
|
+
if (modules) {
|
|
31
|
+
for (const module of modules) {
|
|
32
|
+
environment.moduleGraph.invalidateModule(module, void 0, timestamp, true);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (isRunnableDevEnvironment(environment)) {
|
|
36
|
+
const runnerModules = environment.runner.evaluatedModules.getModulesByFile(filePath);
|
|
37
|
+
if (runnerModules) {
|
|
38
|
+
for (const runnerModule of runnerModules) {
|
|
39
|
+
environment.runner.evaluatedModules.invalidateModule(runnerModule);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
26
45
|
function invalidateDataStore(viteServer) {
|
|
27
46
|
const environment = viteServer.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
28
47
|
const module = environment.moduleGraph.getModuleById(RESOLVED_DATA_STORE_VIRTUAL_ID);
|
|
@@ -67,8 +86,11 @@ function astroContentVirtualModPlugin({
|
|
|
67
86
|
},
|
|
68
87
|
buildStart() {
|
|
69
88
|
if (devServer) {
|
|
89
|
+
const assetImportsPath = fileURLToPath(new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir));
|
|
70
90
|
devServer.watcher.add(fileURLToPath(dataStoreFile));
|
|
91
|
+
devServer.watcher.add(assetImportsPath);
|
|
71
92
|
invalidateDataStore(devServer);
|
|
93
|
+
invalidateAssetImports(devServer, assetImportsPath);
|
|
72
94
|
}
|
|
73
95
|
},
|
|
74
96
|
resolveId: {
|
|
@@ -175,14 +197,19 @@ function astroContentVirtualModPlugin({
|
|
|
175
197
|
configureServer(server) {
|
|
176
198
|
devServer = server;
|
|
177
199
|
const dataStorePath = fileURLToPath(dataStoreFile);
|
|
200
|
+
const assetImportsPath = fileURLToPath(new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir));
|
|
178
201
|
server.watcher.on("add", (addedPath) => {
|
|
179
202
|
if (addedPath === dataStorePath) {
|
|
180
203
|
invalidateDataStore(server);
|
|
204
|
+
invalidateAssetImports(server, assetImportsPath);
|
|
181
205
|
}
|
|
182
206
|
});
|
|
183
207
|
server.watcher.on("change", (changedPath) => {
|
|
184
208
|
if (changedPath === dataStorePath) {
|
|
185
209
|
invalidateDataStore(server);
|
|
210
|
+
invalidateAssetImports(server, assetImportsPath);
|
|
211
|
+
} else if (changedPath === assetImportsPath) {
|
|
212
|
+
invalidateAssetImports(server, assetImportsPath);
|
|
186
213
|
}
|
|
187
214
|
});
|
|
188
215
|
}
|
package/dist/core/app/base.js
CHANGED
|
@@ -44,11 +44,9 @@ class BaseApp {
|
|
|
44
44
|
return this.pipeline.logger;
|
|
45
45
|
}
|
|
46
46
|
get adapterLogger() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.manifest.adapterName
|
|
51
|
-
);
|
|
47
|
+
const currentOptions = this.logger.options;
|
|
48
|
+
if (!this.#adapterLogger || this.#adapterLogger.options !== currentOptions) {
|
|
49
|
+
this.#adapterLogger = new AstroIntegrationLogger(currentOptions, this.manifest.adapterName);
|
|
52
50
|
}
|
|
53
51
|
return this.#adapterLogger;
|
|
54
52
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.4.
|
|
40
|
+
const currentVersion = "6.4.6";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -6,6 +6,7 @@ import { AstroMiddleware } from "../middleware/astro-middleware.js";
|
|
|
6
6
|
import { PagesHandler } from "../pages/handler.js";
|
|
7
7
|
import { matchRoute } from "../routing/match.js";
|
|
8
8
|
import { provideSession } from "../session/handler.js";
|
|
9
|
+
import { validateHost } from "../app/validate-headers.js";
|
|
9
10
|
class DefaultErrorHandler {
|
|
10
11
|
#app;
|
|
11
12
|
#astroMiddleware;
|
|
@@ -31,15 +32,27 @@ class DefaultErrorHandler {
|
|
|
31
32
|
if (errorRouteData) {
|
|
32
33
|
if (errorRouteData.prerender) {
|
|
33
34
|
const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
|
|
34
|
-
const
|
|
35
|
+
const allowedDomains = app.manifest.allowedDomains;
|
|
36
|
+
const validatedHost = validateHost(url.host, url.protocol.replace(":", ""), allowedDomains);
|
|
37
|
+
const safeOrigin = validatedHost ? url.origin : `${url.protocol}//localhost`;
|
|
38
|
+
const statusURL = new URL(
|
|
39
|
+
`${app.baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
|
|
40
|
+
safeOrigin
|
|
41
|
+
);
|
|
35
42
|
if (statusURL.toString() !== request.url && resolvedRenderOptions.prerenderedErrorPageFetch) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
try {
|
|
44
|
+
const response2 = await resolvedRenderOptions.prerenderedErrorPageFetch(
|
|
45
|
+
statusURL.toString()
|
|
46
|
+
);
|
|
47
|
+
const override = { status, removeContentEncodingHeaders: true };
|
|
48
|
+
const newResponse = mergeResponses(response2, originalResponse, override);
|
|
49
|
+
prepareResponse(newResponse, resolvedRenderOptions);
|
|
50
|
+
return newResponse;
|
|
51
|
+
} catch {
|
|
52
|
+
const response2 = mergeResponses(new Response(null, { status }), originalResponse);
|
|
53
|
+
prepareResponse(response2, resolvedRenderOptions);
|
|
54
|
+
return response2;
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
58
|
const mod = await app.pipeline.getComponentByRoute(errorRouteData);
|
|
@@ -185,8 +185,8 @@ export declare const NoClientOnlyHint: {
|
|
|
185
185
|
* ---
|
|
186
186
|
* export async function getStaticPaths() {
|
|
187
187
|
* return [
|
|
188
|
-
* { params: {
|
|
189
|
-
* { params: {
|
|
188
|
+
* { params: { id: "blog" } },
|
|
189
|
+
* { params: { id: "about" } }
|
|
190
190
|
* ];
|
|
191
191
|
*}
|
|
192
192
|
*---
|
|
@@ -208,8 +208,8 @@ export declare const InvalidGetStaticPathParam: {
|
|
|
208
208
|
* ```ts title="pages/blog/[id].astro"
|
|
209
209
|
* export async function getStaticPaths() {
|
|
210
210
|
* return [ // <-- Array
|
|
211
|
-
* { params: {
|
|
212
|
-
* { params: {
|
|
211
|
+
* { params: { id: "blog" } }, // <-- Object
|
|
212
|
+
* { params: { id: "about" } }
|
|
213
213
|
* ];
|
|
214
214
|
*}
|
|
215
215
|
* ```
|
|
@@ -231,8 +231,8 @@ export declare const InvalidGetStaticPathsEntry: {
|
|
|
231
231
|
* ```ts title="pages/blog/[id].astro"
|
|
232
232
|
* export async function getStaticPaths() {
|
|
233
233
|
* return [ // <-- Array
|
|
234
|
-
* { params: {
|
|
235
|
-
* { params: {
|
|
234
|
+
* { params: { id: "blog" } },
|
|
235
|
+
* { params: { id: "about" } }
|
|
236
236
|
* ];
|
|
237
237
|
*}
|
|
238
238
|
* ```
|
|
@@ -9,6 +9,7 @@ import { createCallAction, createGetActionResult, hasActionPayload } from "../..
|
|
|
9
9
|
import { AstroCookies } from "../cookies/index.js";
|
|
10
10
|
import { Slots } from "../render/index.js";
|
|
11
11
|
import {
|
|
12
|
+
appSymbol,
|
|
12
13
|
ASTRO_GENERATOR,
|
|
13
14
|
fetchStateSymbol,
|
|
14
15
|
originPathnameSymbol,
|
|
@@ -192,9 +193,9 @@ class FetchState {
|
|
|
192
193
|
if (pipeline.manifest.allowedDomains && pipeline.manifest.allowedDomains.length > 0) {
|
|
193
194
|
this.#applyForwardedHeaders();
|
|
194
195
|
}
|
|
195
|
-
if (!Reflect.get(request, originPathnameSymbol)) {
|
|
196
|
+
if (!Reflect.get(this.request, originPathnameSymbol)) {
|
|
196
197
|
setOriginPathname(
|
|
197
|
-
request,
|
|
198
|
+
this.request,
|
|
198
199
|
this.pathname,
|
|
199
200
|
pipeline.manifest.trailingSlash,
|
|
200
201
|
pipeline.manifest.buildFormat
|
|
@@ -727,6 +728,12 @@ class FetchState {
|
|
|
727
728
|
this.clientAddress = forwardedFor;
|
|
728
729
|
}
|
|
729
730
|
}
|
|
731
|
+
const oldRequest = this.request;
|
|
732
|
+
this.request = new Request(this.url, oldRequest);
|
|
733
|
+
const app = Reflect.get(oldRequest, appSymbol);
|
|
734
|
+
if (app !== void 0) {
|
|
735
|
+
Reflect.set(this.request, appSymbol, app);
|
|
736
|
+
}
|
|
730
737
|
}
|
|
731
738
|
/**
|
|
732
739
|
* Returns the resolved `props` for this render, computing them lazily
|
|
@@ -6,6 +6,7 @@ const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|chec
|
|
|
6
6
|
const AMPERSAND_REGEX = /&/g;
|
|
7
7
|
const DOUBLE_QUOTE_REGEX = /"/g;
|
|
8
8
|
const STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]);
|
|
9
|
+
const INVALID_ATTR_NAME_CHAR = /[\s"'>/=]/;
|
|
9
10
|
const toIdent = (k) => k.trim().replace(/(?!^)\b\w|\s+|\W+/g, (match, index) => {
|
|
10
11
|
if (/\W/.test(match)) return "";
|
|
11
12
|
return index === 0 ? match : match.toUpperCase();
|
|
@@ -43,6 +44,9 @@ function addAttribute(value, key, shouldEscape = true, tagName = "") {
|
|
|
43
44
|
if (value == null) {
|
|
44
45
|
return "";
|
|
45
46
|
}
|
|
47
|
+
if (INVALID_ATTR_NAME_CHAR.test(key)) {
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
46
50
|
if (STATIC_DIRECTIVES.has(key)) {
|
|
47
51
|
console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute.
|
|
48
52
|
|
|
@@ -149,7 +153,7 @@ class BufferedRenderer {
|
|
|
149
153
|
function createBufferedRenderer(destination, renderFunction) {
|
|
150
154
|
return new BufferedRenderer(destination, renderFunction);
|
|
151
155
|
}
|
|
152
|
-
const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]"
|
|
156
|
+
const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]";
|
|
153
157
|
const isDeno = typeof Deno !== "undefined";
|
|
154
158
|
function promiseWithResolvers() {
|
|
155
159
|
let resolve, reject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.6",
|
|
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",
|
|
@@ -166,8 +166,8 @@
|
|
|
166
166
|
"yargs-parser": "^22.0.0",
|
|
167
167
|
"zod": "^4.3.6",
|
|
168
168
|
"@astrojs/internal-helpers": "0.10.0",
|
|
169
|
-
"@astrojs/
|
|
170
|
-
"@astrojs/
|
|
169
|
+
"@astrojs/telemetry": "3.3.2",
|
|
170
|
+
"@astrojs/markdown-remark": "7.2.0"
|
|
171
171
|
},
|
|
172
172
|
"optionalDependencies": {
|
|
173
173
|
"sharp": "^0.34.0"
|
|
@@ -203,8 +203,8 @@
|
|
|
203
203
|
"undici": "^7.22.0",
|
|
204
204
|
"unified": "^11.0.5",
|
|
205
205
|
"vitest": "^4.1.0",
|
|
206
|
-
"
|
|
207
|
-
"
|
|
206
|
+
"astro-scripts": "0.0.14",
|
|
207
|
+
"@astrojs/check": "0.9.9"
|
|
208
208
|
},
|
|
209
209
|
"engines": {
|
|
210
210
|
"node": ">=22.12.0",
|