astro 5.8.2 → 5.9.0
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/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/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/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 -0
- 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/plugin.js +26 -4
- package/package.json +2 -2
|
@@ -7,6 +7,18 @@ import { normalizeTheLocale } from "../../../i18n/index.js";
|
|
|
7
7
|
import { toFallbackType, toRoutingStrategy } from "../../../i18n/utils.js";
|
|
8
8
|
import { runHookBuildSsr } from "../../../integrations/hooks.js";
|
|
9
9
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../../vite-plugin-scripts/index.js";
|
|
10
|
+
import {
|
|
11
|
+
getAlgorithm,
|
|
12
|
+
getDirectives,
|
|
13
|
+
getScriptHashes,
|
|
14
|
+
getScriptResources,
|
|
15
|
+
getStrictDynamic,
|
|
16
|
+
getStyleHashes,
|
|
17
|
+
getStyleResources,
|
|
18
|
+
shouldTrackCspHashes,
|
|
19
|
+
trackScriptHashes,
|
|
20
|
+
trackStyleHashes
|
|
21
|
+
} from "../../csp/common.js";
|
|
10
22
|
import { encodeKey } from "../../encryption.js";
|
|
11
23
|
import { fileExtension, joinPaths, prependForwardSlash } from "../../path.js";
|
|
12
24
|
import { DEFAULT_COMPONENTS } from "../../routing/default.js";
|
|
@@ -126,7 +138,7 @@ async function createManifest(buildOpts, internals) {
|
|
|
126
138
|
}
|
|
127
139
|
const staticFiles = internals.staticFiles;
|
|
128
140
|
const encodedKey = await encodeKey(await buildOpts.key);
|
|
129
|
-
return buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey);
|
|
141
|
+
return await buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey);
|
|
130
142
|
}
|
|
131
143
|
function injectManifest(manifest, chunk) {
|
|
132
144
|
const code = chunk.code;
|
|
@@ -134,7 +146,7 @@ function injectManifest(manifest, chunk) {
|
|
|
134
146
|
return JSON.stringify(manifest);
|
|
135
147
|
});
|
|
136
148
|
}
|
|
137
|
-
function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
149
|
+
async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
138
150
|
const { settings } = opts;
|
|
139
151
|
const routes = [];
|
|
140
152
|
const domainLookupTable = {};
|
|
@@ -221,6 +233,27 @@ function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
221
233
|
domainLookupTable
|
|
222
234
|
};
|
|
223
235
|
}
|
|
236
|
+
let csp = void 0;
|
|
237
|
+
if (shouldTrackCspHashes(settings.config.experimental.csp)) {
|
|
238
|
+
const algorithm = getAlgorithm(settings.config.experimental.csp);
|
|
239
|
+
const scriptHashes = [
|
|
240
|
+
...getScriptHashes(settings.config.experimental.csp),
|
|
241
|
+
...await trackScriptHashes(internals, settings, algorithm)
|
|
242
|
+
];
|
|
243
|
+
const styleHashes = [
|
|
244
|
+
...getStyleHashes(settings.config.experimental.csp),
|
|
245
|
+
...await trackStyleHashes(internals, settings, algorithm)
|
|
246
|
+
];
|
|
247
|
+
csp = {
|
|
248
|
+
scriptHashes,
|
|
249
|
+
scriptResources: getScriptResources(settings.config.experimental.csp),
|
|
250
|
+
styleHashes,
|
|
251
|
+
styleResources: getStyleResources(settings.config.experimental.csp),
|
|
252
|
+
algorithm,
|
|
253
|
+
directives: getDirectives(settings.config.experimental.csp),
|
|
254
|
+
isStrictDynamic: getStrictDynamic(settings.config.experimental.csp)
|
|
255
|
+
};
|
|
256
|
+
}
|
|
224
257
|
return {
|
|
225
258
|
hrefRoot: opts.settings.config.root.toString(),
|
|
226
259
|
cacheDir: opts.settings.config.cacheDir.toString(),
|
|
@@ -248,7 +281,8 @@ function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
248
281
|
checkOrigin: (settings.config.security?.checkOrigin && settings.buildOutput === "server") ?? false,
|
|
249
282
|
serverIslandNameMap: Array.from(settings.serverIslandNameMap),
|
|
250
283
|
key: encodedKey,
|
|
251
|
-
sessionConfig: settings.config.session
|
|
284
|
+
sessionConfig: settings.config.session,
|
|
285
|
+
csp
|
|
252
286
|
};
|
|
253
287
|
}
|
|
254
288
|
export {
|