astro 5.8.2 → 5.9.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/dist/actions/runtime/utils.d.ts +1 -1
- package/dist/assets/fonts/config.d.ts +21 -21
- package/dist/container/index.js +2 -1
- package/dist/content/content-layer.js +14 -3
- package/dist/content/loaders/types.d.ts +3 -0
- package/dist/content/utils.d.ts +26 -10
- package/dist/content/utils.js +1 -0
- package/dist/core/app/index.js +9 -3
- package/dist/core/app/types.d.ts +12 -1
- package/dist/core/base-pipeline.js +3 -3
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +38 -4
- package/dist/core/build/internal.d.ts +1 -0
- package/dist/core/build/internal.js +2 -1
- package/dist/core/build/plugins/index.js +1 -1
- package/dist/core/build/plugins/plugin-internals.d.ts +2 -1
- package/dist/core/build/plugins/plugin-internals.js +7 -4
- package/dist/core/build/plugins/plugin-manifest.js +37 -3
- package/dist/core/config/merge.js +1 -6
- package/dist/core/config/schemas/base.d.ts +435 -331
- package/dist/core/config/schemas/base.js +20 -2
- package/dist/core/config/schemas/index.d.ts +1 -1
- package/dist/core/config/schemas/index.js +4 -1
- package/dist/core/config/schemas/relative.d.ts +681 -552
- package/dist/core/constants.js +1 -1
- package/dist/core/csp/common.d.ts +16 -0
- package/dist/core/csp/common.js +116 -0
- package/dist/core/csp/config.d.ts +16 -0
- package/dist/core/csp/config.js +52 -0
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/encryption.d.ts +8 -0
- package/dist/core/encryption.js +7 -0
- package/dist/core/errors/errors-data.d.ts +12 -0
- package/dist/core/errors/errors-data.js +6 -0
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/index.js +10 -0
- package/dist/core/render-context.d.ts +1 -0
- package/dist/core/render-context.js +77 -5
- package/dist/core/util.d.ts +1 -0
- package/dist/core/util.js +6 -1
- package/dist/env/schema.d.ts +34 -34
- package/dist/integrations/features-validation.js +36 -30
- package/dist/integrations/hooks.d.ts +3 -2
- package/dist/runtime/server/astro-island-styles.d.ts +1 -0
- package/dist/runtime/server/astro-island-styles.js +4 -0
- package/dist/runtime/server/index.d.ts +1 -0
- package/dist/runtime/server/render/astro/factory.d.ts +3 -2
- package/dist/runtime/server/render/astro/factory.js +6 -1
- package/dist/runtime/server/render/astro/head-and-content.d.ts +7 -0
- package/dist/runtime/server/render/astro/head-and-content.js +6 -0
- package/dist/runtime/server/render/astro/render.d.ts +1 -0
- package/dist/runtime/server/render/astro/render.js +2 -1
- package/dist/runtime/server/render/common.d.ts +1 -1
- package/dist/runtime/server/render/common.js +5 -3
- package/dist/runtime/server/render/component.js +8 -2
- package/dist/runtime/server/render/csp.d.ts +2 -0
- package/dist/runtime/server/render/csp.js +35 -0
- package/dist/runtime/server/render/head.js +14 -0
- package/dist/runtime/server/render/page.d.ts +1 -1
- package/dist/runtime/server/render/page.js +1 -1
- package/dist/runtime/server/render/server-islands.d.ts +14 -3
- package/dist/runtime/server/render/server-islands.js +100 -69
- package/dist/runtime/server/scripts.d.ts +1 -1
- package/dist/runtime/server/scripts.js +2 -5
- package/dist/runtime/server/transition.d.ts +1 -1
- package/dist/runtime/server/transition.js +7 -2
- package/dist/types/public/config.d.ts +240 -7
- package/dist/types/public/context.d.ts +51 -0
- package/dist/types/public/integrations.d.ts +9 -0
- package/dist/types/public/internal.d.ts +24 -2
- package/dist/vite-plugin-astro-server/css.js +3 -3
- package/dist/vite-plugin-astro-server/plugin.js +26 -4
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
|
2
|
+
import type { SSRManifestCSP } from '../../core/app/types.js';
|
|
2
3
|
import type { AstroCookies } from '../../core/cookies/cookies.js';
|
|
3
|
-
import type { AstroComponentInstance } from '../../runtime/server/index.js';
|
|
4
|
+
import type { AstroComponentInstance, ServerIslandComponent } from '../../runtime/server/index.js';
|
|
4
5
|
import type { Params } from './common.js';
|
|
5
6
|
import type { AstroConfig, RedirectConfig } from './config.js';
|
|
6
7
|
import type { AstroGlobal, AstroGlobalPartial } from './context.js';
|
|
@@ -223,6 +224,17 @@ export interface SSRResult {
|
|
|
223
224
|
trailingSlash: AstroConfig['trailingSlash'];
|
|
224
225
|
key: Promise<CryptoKey>;
|
|
225
226
|
_metadata: SSRMetadata;
|
|
227
|
+
/**
|
|
228
|
+
* Whether Astro should inject the CSP <meta> tag into the head of the component.
|
|
229
|
+
*/
|
|
230
|
+
shouldInjectCspMetaTags: boolean;
|
|
231
|
+
cspAlgorithm: SSRManifestCSP['algorithm'];
|
|
232
|
+
scriptHashes: SSRManifestCSP['scriptHashes'];
|
|
233
|
+
scriptResources: SSRManifestCSP['scriptResources'];
|
|
234
|
+
styleHashes: SSRManifestCSP['styleHashes'];
|
|
235
|
+
styleResources: SSRManifestCSP['styleResources'];
|
|
236
|
+
directives: SSRManifestCSP['directives'];
|
|
237
|
+
isStrictDynamic: SSRManifestCSP['isStrictDynamic'];
|
|
226
238
|
}
|
|
227
239
|
/**
|
|
228
240
|
* A hint on whether the Astro runtime needs to wait on a component to render head
|
|
@@ -259,9 +271,19 @@ export interface SSRMetadata {
|
|
|
259
271
|
hasDirectives: Set<string>;
|
|
260
272
|
hasRenderedHead: boolean;
|
|
261
273
|
hasRenderedServerIslandRuntime: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Used to signal the rendering engine if the current route (page) contains the
|
|
276
|
+
* <head> element.
|
|
277
|
+
*/
|
|
262
278
|
headInTree: boolean;
|
|
263
279
|
extraHead: string[];
|
|
264
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Used by the rendering engine to store hashes that are **generated** at runtime.
|
|
282
|
+
* For example, this is used by view transitions
|
|
283
|
+
*/
|
|
284
|
+
extraStyleHashes: string[];
|
|
285
|
+
extraScriptHashes: string[];
|
|
286
|
+
propagators: Set<AstroComponentInstance | ServerIslandComponent>;
|
|
265
287
|
}
|
|
266
288
|
export type SSRError = Error & ViteErrorPayload['err'];
|
|
267
289
|
export interface InternalInjectedRoute {
|
|
@@ -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
|
}
|
|
@@ -2,6 +2,16 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
2
2
|
import { IncomingMessage } from "node:http";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { normalizePath } from "vite";
|
|
5
|
+
import {
|
|
6
|
+
getAlgorithm,
|
|
7
|
+
getDirectives,
|
|
8
|
+
getScriptHashes,
|
|
9
|
+
getScriptResources,
|
|
10
|
+
getStrictDynamic,
|
|
11
|
+
getStyleHashes,
|
|
12
|
+
getStyleResources,
|
|
13
|
+
shouldTrackCspHashes
|
|
14
|
+
} from "../core/csp/common.js";
|
|
5
15
|
import { warnMissingAdapter } from "../core/dev/adapter-validation.js";
|
|
6
16
|
import { createKey, getEnvironmentKey, hasEnvironmentKey } from "../core/encryption.js";
|
|
7
17
|
import { getViteErrorPayload } from "../core/errors/dev/index.js";
|
|
@@ -73,8 +83,7 @@ function createVitePluginAstroServer({
|
|
|
73
83
|
});
|
|
74
84
|
const store = localStorage.getStore();
|
|
75
85
|
if (store instanceof IncomingMessage) {
|
|
76
|
-
|
|
77
|
-
setRouteError(controller.state, request.url, error);
|
|
86
|
+
setRouteError(controller.state, store.url, error);
|
|
78
87
|
}
|
|
79
88
|
const { errorWithMetadata } = recordServerError(loader, settings.config, pipeline, error);
|
|
80
89
|
setTimeout(
|
|
@@ -121,7 +130,8 @@ function createVitePluginAstroServer({
|
|
|
121
130
|
};
|
|
122
131
|
}
|
|
123
132
|
function createDevelopmentManifest(settings) {
|
|
124
|
-
let i18nManifest
|
|
133
|
+
let i18nManifest;
|
|
134
|
+
let csp;
|
|
125
135
|
if (settings.config.i18n) {
|
|
126
136
|
i18nManifest = {
|
|
127
137
|
fallback: settings.config.i18n.fallback,
|
|
@@ -132,6 +142,17 @@ function createDevelopmentManifest(settings) {
|
|
|
132
142
|
fallbackType: toFallbackType(settings.config.i18n.routing)
|
|
133
143
|
};
|
|
134
144
|
}
|
|
145
|
+
if (shouldTrackCspHashes(settings.config.experimental.csp)) {
|
|
146
|
+
csp = {
|
|
147
|
+
scriptHashes: getScriptHashes(settings.config.experimental.csp),
|
|
148
|
+
scriptResources: getScriptResources(settings.config.experimental.csp),
|
|
149
|
+
styleHashes: getStyleHashes(settings.config.experimental.csp),
|
|
150
|
+
styleResources: getStyleResources(settings.config.experimental.csp),
|
|
151
|
+
algorithm: getAlgorithm(settings.config.experimental.csp),
|
|
152
|
+
directives: getDirectives(settings.config.experimental.csp),
|
|
153
|
+
isStrictDynamic: getStrictDynamic(settings.config.experimental.csp)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
135
156
|
return {
|
|
136
157
|
hrefRoot: settings.config.root.toString(),
|
|
137
158
|
srcDir: settings.config.srcDir,
|
|
@@ -163,7 +184,8 @@ function createDevelopmentManifest(settings) {
|
|
|
163
184
|
onRequest: NOOP_MIDDLEWARE_FN
|
|
164
185
|
};
|
|
165
186
|
},
|
|
166
|
-
sessionConfig: settings.config.session
|
|
187
|
+
sessionConfig: settings.config.session,
|
|
188
|
+
csp
|
|
167
189
|
};
|
|
168
190
|
}
|
|
169
191
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.1",
|
|
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.
|
|
101
|
+
"@astrojs/compiler": "^2.12.1",
|
|
102
102
|
"@capsizecss/unpack": "^2.4.0",
|
|
103
103
|
"@oslojs/encoding": "^1.1.0",
|
|
104
104
|
"@rollup/pluginutils": "^5.1.4",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
"zod": "^3.24.2",
|
|
157
157
|
"zod-to-json-schema": "^3.24.5",
|
|
158
158
|
"zod-to-ts": "^1.2.0",
|
|
159
|
-
"@astrojs/internal-helpers": "0.6.1",
|
|
160
159
|
"@astrojs/markdown-remark": "6.3.2",
|
|
160
|
+
"@astrojs/internal-helpers": "0.6.1",
|
|
161
161
|
"@astrojs/telemetry": "3.3.0"
|
|
162
162
|
},
|
|
163
163
|
"optionalDependencies": {
|