astro 5.9.0 → 5.9.2
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/content/content-layer.js +3 -3
- package/dist/core/app/index.js +9 -3
- package/dist/core/config/merge.js +1 -6
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/util.d.ts +1 -0
- package/dist/core/util.js +6 -1
- package/dist/runtime/server/render/csp.js +4 -4
- package/dist/runtime/server/render/server-islands.js +2 -2
- package/dist/runtime/server/transition.d.ts +1 -1
- package/dist/runtime/server/transition.js +1 -5
- package/dist/types/public/config.d.ts +2 -9
- package/dist/vite-plugin-astro-server/css.js +3 -3
- package/package.json +4 -4
|
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
|
|
|
164
164
|
logger.info("Content config changed");
|
|
165
165
|
shouldClear = true;
|
|
166
166
|
}
|
|
167
|
-
if (previousAstroVersion && previousAstroVersion !== "5.9.
|
|
167
|
+
if (previousAstroVersion && previousAstroVersion !== "5.9.2") {
|
|
168
168
|
logger.info("Astro version changed");
|
|
169
169
|
shouldClear = true;
|
|
170
170
|
}
|
|
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
|
|
|
172
172
|
logger.info("Clearing content store");
|
|
173
173
|
this.#store.clearAll();
|
|
174
174
|
}
|
|
175
|
-
if ("5.9.
|
|
176
|
-
await this.#store.metaStore().set("astro-version", "5.9.
|
|
175
|
+
if ("5.9.2") {
|
|
176
|
+
await this.#store.metaStore().set("astro-version", "5.9.2");
|
|
177
177
|
}
|
|
178
178
|
if (currentConfigDigest) {
|
|
179
179
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/index.js
CHANGED
|
@@ -346,7 +346,7 @@ class App {
|
|
|
346
346
|
);
|
|
347
347
|
if (statusURL.toString() !== request.url) {
|
|
348
348
|
const response2 = await prerenderedErrorPageFetch(statusURL.toString());
|
|
349
|
-
const override = { status };
|
|
349
|
+
const override = { status, removeContentEncodingHeaders: true };
|
|
350
350
|
return this.#mergeResponses(response2, originalResponse, override);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
@@ -387,12 +387,18 @@ class App {
|
|
|
387
387
|
return response;
|
|
388
388
|
}
|
|
389
389
|
#mergeResponses(newResponse, originalResponse, override) {
|
|
390
|
+
let newResponseHeaders = newResponse.headers;
|
|
391
|
+
if (override?.removeContentEncodingHeaders) {
|
|
392
|
+
newResponseHeaders = new Headers(newResponseHeaders);
|
|
393
|
+
newResponseHeaders.delete("Content-Encoding");
|
|
394
|
+
newResponseHeaders.delete("Content-Length");
|
|
395
|
+
}
|
|
390
396
|
if (!originalResponse) {
|
|
391
397
|
if (override !== void 0) {
|
|
392
398
|
return new Response(newResponse.body, {
|
|
393
399
|
status: override.status,
|
|
394
400
|
statusText: newResponse.statusText,
|
|
395
|
-
headers:
|
|
401
|
+
headers: newResponseHeaders
|
|
396
402
|
});
|
|
397
403
|
}
|
|
398
404
|
return newResponse;
|
|
@@ -403,7 +409,7 @@ class App {
|
|
|
403
409
|
} catch {
|
|
404
410
|
}
|
|
405
411
|
const mergedHeaders = new Map([
|
|
406
|
-
...Array.from(
|
|
412
|
+
...Array.from(newResponseHeaders),
|
|
407
413
|
...Array.from(originalResponse.headers)
|
|
408
414
|
]);
|
|
409
415
|
const newHeaders = new Headers();
|
|
@@ -7,7 +7,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
7
7
|
if (value == null) {
|
|
8
8
|
continue;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
const existing = merged[key];
|
|
11
11
|
if (existing == null) {
|
|
12
12
|
merged[key] = value;
|
|
13
13
|
continue;
|
|
@@ -29,11 +29,6 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
29
29
|
if (key === "allowedHosts" && rootPath === "server" && typeof existing === "boolean") {
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
|
-
if (key === "data" && rootPath === "db") {
|
|
33
|
-
if (!Array.isArray(existing) && !Array.isArray(value)) {
|
|
34
|
-
existing = [existing];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
32
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
|
38
33
|
merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
|
|
39
34
|
continue;
|
package/dist/core/constants.js
CHANGED
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.9.
|
|
25
|
+
const currentVersion = "5.9.2";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "5.9.
|
|
40
|
+
const version = "5.9.2";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -274,7 +274,7 @@ function printHelp({
|
|
|
274
274
|
message.push(
|
|
275
275
|
linebreak(),
|
|
276
276
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
277
|
-
`v${"5.9.
|
|
277
|
+
`v${"5.9.2"}`
|
|
278
278
|
)} ${headline}`
|
|
279
279
|
);
|
|
280
280
|
}
|
package/dist/core/util.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare function parseNpmName(spec: string): {
|
|
|
33
33
|
export declare function viteID(filePath: URL): string;
|
|
34
34
|
export declare const VALID_ID_PREFIX = "/@id/";
|
|
35
35
|
export declare function unwrapId(id: string): string;
|
|
36
|
+
export declare function wrapId(id: string): string;
|
|
36
37
|
export declare function resolvePages(config: AstroConfig): URL;
|
|
37
38
|
export declare function isPage(file: URL, settings: AstroSettings): boolean;
|
|
38
39
|
export declare function isEndpoint(file: URL, settings: AstroSettings): boolean;
|
package/dist/core/util.js
CHANGED
|
@@ -67,9 +67,13 @@ function viteID(filePath) {
|
|
|
67
67
|
}
|
|
68
68
|
const VALID_ID_PREFIX = `/@id/`;
|
|
69
69
|
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
70
|
+
const NULL_BYTE_REGEX = /^\0/;
|
|
70
71
|
function unwrapId(id) {
|
|
71
72
|
return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
|
|
72
73
|
}
|
|
74
|
+
function wrapId(id) {
|
|
75
|
+
return id.replace(NULL_BYTE_REGEX, `${VALID_ID_PREFIX}${NULL_BYTE_PLACEHOLDER}`);
|
|
76
|
+
}
|
|
73
77
|
function resolvePages(config) {
|
|
74
78
|
return new URL("./pages", config.srcDir);
|
|
75
79
|
}
|
|
@@ -141,5 +145,6 @@ export {
|
|
|
141
145
|
resolveJsToTs,
|
|
142
146
|
resolvePages,
|
|
143
147
|
unwrapId,
|
|
144
|
-
viteID
|
|
148
|
+
viteID,
|
|
149
|
+
wrapId
|
|
145
150
|
};
|
|
@@ -19,15 +19,15 @@ function renderCspContent(result) {
|
|
|
19
19
|
}
|
|
20
20
|
let scriptResources = "'self'";
|
|
21
21
|
if (result.scriptResources.length > 0) {
|
|
22
|
-
scriptResources = result.scriptResources.map((r) =>
|
|
22
|
+
scriptResources = result.scriptResources.map((r) => `${r}`).join(" ");
|
|
23
23
|
}
|
|
24
24
|
let styleResources = "'self'";
|
|
25
25
|
if (result.styleResources.length > 0) {
|
|
26
|
-
styleResources = result.styleResources.map((r) =>
|
|
26
|
+
styleResources = result.styleResources.map((r) => `${r}`).join(" ");
|
|
27
27
|
}
|
|
28
28
|
const strictDynamic = result.isStrictDynamic ? ` strict-dynamic` : "";
|
|
29
|
-
const scriptSrc = `
|
|
30
|
-
const styleSrc = `
|
|
29
|
+
const scriptSrc = `script-src ${scriptResources} ${Array.from(finalScriptHashes).join(" ")}${strictDynamic};`;
|
|
30
|
+
const styleSrc = `style-src ${styleResources} ${Array.from(finalStyleHashes).join(" ")};`;
|
|
31
31
|
return `${directives} ${scriptSrc} ${styleSrc}`;
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
@@ -111,13 +111,13 @@ let response = await fetch('${serverIslandUrl}', {
|
|
|
111
111
|
return createThinHead();
|
|
112
112
|
}
|
|
113
113
|
async render(destination) {
|
|
114
|
+
destination.write(createRenderInstruction({ type: "server-island-runtime" }));
|
|
115
|
+
destination.write("<!--[if astro]>server-island-start<![endif]-->");
|
|
114
116
|
for (const name in this.slots) {
|
|
115
117
|
if (name === "fallback") {
|
|
116
118
|
await renderChild(destination, this.slots.fallback(this.result));
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
|
-
destination.write(createRenderInstruction({ type: "server-island-runtime" }));
|
|
120
|
-
destination.write("<!--[if astro]>server-island-start<![endif]-->");
|
|
121
121
|
destination.write(
|
|
122
122
|
`<script type="module" data-astro-rerun data-island-id="${this.hostId}">${this.islandContent}</script>`
|
|
123
123
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SSRResult } from '../../types/public/internal.js';
|
|
2
2
|
import type { TransitionAnimationPair, TransitionAnimationValue } from '../../types/public/view-transitions.js';
|
|
3
3
|
export declare function createTransitionScope(result: SSRResult, hash: string): string;
|
|
4
|
-
export declare function renderTransition(result: SSRResult, hash: string, animationName: TransitionAnimationValue | undefined, transitionName: string):
|
|
4
|
+
export declare function renderTransition(result: SSRResult, hash: string, animationName: TransitionAnimationValue | undefined, transitionName: string): string;
|
|
5
5
|
export declare function createAnimationScope(transitionName: string, animations: Record<string, TransitionAnimationPair>): {
|
|
6
6
|
scope: string;
|
|
7
7
|
styles: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import cssesc from "cssesc";
|
|
2
|
-
import { generateCspDigest } from "../../core/encryption.js";
|
|
3
2
|
import { fade, slide } from "../../transitions/index.js";
|
|
4
3
|
import { markHTMLString } from "./escape.js";
|
|
5
4
|
const transitionNameMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -40,7 +39,7 @@ function reEncode(s) {
|
|
|
40
39
|
}
|
|
41
40
|
return reEncodeInValidStart[result.codePointAt(0) ?? 0] ? "_" + result : result;
|
|
42
41
|
}
|
|
43
|
-
|
|
42
|
+
function renderTransition(result, hash, animationName, transitionName) {
|
|
44
43
|
if (typeof (transitionName ?? "") !== "string") {
|
|
45
44
|
throw new Error(`Invalid transition name {${transitionName}}`);
|
|
46
45
|
}
|
|
@@ -58,9 +57,6 @@ async function renderTransition(result, hash, animationName, transitionName) {
|
|
|
58
57
|
sheet.addModern("group", "animation: none");
|
|
59
58
|
}
|
|
60
59
|
const css = sheet.toString();
|
|
61
|
-
if (result.shouldInjectCspMetaTags) {
|
|
62
|
-
result._metadata.extraStyleHashes.push(await generateCspDigest(css, result.cspAlgorithm));
|
|
63
|
-
}
|
|
64
60
|
result._metadata.extraHead.push(markHTMLString(`<style>${css}</style>`));
|
|
65
61
|
return scope;
|
|
66
62
|
}
|
|
@@ -1749,8 +1749,6 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
|
1749
1749
|
*/
|
|
1750
1750
|
domains?: [TLocales] extends [never] ? Record<string, string> : Partial<Record<NormalizeLocales<NoInfer<TLocales>>, string>>;
|
|
1751
1751
|
};
|
|
1752
|
-
/** ! WARNING: SUBJECT TO CHANGE */
|
|
1753
|
-
db?: Config.Database;
|
|
1754
1752
|
/**
|
|
1755
1753
|
* @docs
|
|
1756
1754
|
* @kind heading
|
|
@@ -2217,7 +2215,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
|
2217
2215
|
* csp: {
|
|
2218
2216
|
* styleDirective: {
|
|
2219
2217
|
* resources: [
|
|
2220
|
-
* "self",
|
|
2218
|
+
* "'self'",
|
|
2221
2219
|
* "https://styles.cdn.example.com"
|
|
2222
2220
|
* ]
|
|
2223
2221
|
* }
|
|
@@ -2292,7 +2290,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
|
2292
2290
|
* csp: {
|
|
2293
2291
|
* scriptDirective: {
|
|
2294
2292
|
* resources: [
|
|
2295
|
-
* "self",
|
|
2293
|
+
* "'self'",
|
|
2296
2294
|
* "https://cdn.example.com"
|
|
2297
2295
|
* ]
|
|
2298
2296
|
* }
|
|
@@ -2452,8 +2450,3 @@ export interface AstroInlineOnlyConfig {
|
|
|
2452
2450
|
*/
|
|
2453
2451
|
force?: boolean;
|
|
2454
2452
|
}
|
|
2455
|
-
declare global {
|
|
2456
|
-
namespace Config {
|
|
2457
|
-
type Database = Record<string, any>;
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { viteID } from "../core/util.js";
|
|
1
|
+
import { viteID, wrapId } from "../core/util.js";
|
|
2
2
|
import { isBuildableCSSRequest } from "./util.js";
|
|
3
3
|
import { crawlGraph } from "./vite.js";
|
|
4
4
|
const inlineQueryRE = /(?:\?|&)inline(?:$|&)/;
|
|
@@ -31,8 +31,8 @@ async function getStylesForURL(filePath, loader) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
importedStylesMap.set(importedModule.url, {
|
|
34
|
-
id: importedModule.id ?? importedModule.url,
|
|
35
|
-
url: importedModule.url,
|
|
34
|
+
id: wrapId(importedModule.id ?? importedModule.url),
|
|
35
|
+
url: wrapId(importedModule.url),
|
|
36
36
|
content: css
|
|
37
37
|
});
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.2",
|
|
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",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"vendor"
|
|
99
99
|
],
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@astrojs/compiler": "^2.12.
|
|
101
|
+
"@astrojs/compiler": "^2.12.2",
|
|
102
102
|
"@capsizecss/unpack": "^2.4.0",
|
|
103
103
|
"@oslojs/encoding": "^1.1.0",
|
|
104
104
|
"@rollup/pluginutils": "^5.1.4",
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
"zod-to-json-schema": "^3.24.5",
|
|
158
158
|
"zod-to-ts": "^1.2.0",
|
|
159
159
|
"@astrojs/internal-helpers": "0.6.1",
|
|
160
|
-
"@astrojs/
|
|
161
|
-
"@astrojs/
|
|
160
|
+
"@astrojs/telemetry": "3.3.0",
|
|
161
|
+
"@astrojs/markdown-remark": "6.3.2"
|
|
162
162
|
},
|
|
163
163
|
"optionalDependencies": {
|
|
164
164
|
"sharp": "^0.33.3"
|