astro 6.1.0 → 6.1.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/cli/add/index.js +1 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/build/plugins/plugin-manifest.js +5 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +2 -2
- package/dist/core/errors/errors-data.js +3 -3
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/index.d.ts +7 -0
- package/dist/core/middleware/index.js +17 -12
- package/dist/core/preview/static-preview-server.js +12 -5
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js +12 -2
- package/dist/transitions/swap-functions.js +6 -0
- package/dist/types/public/config.d.ts +1 -1
- package/package.json +8 -3
package/dist/cli/add/index.js
CHANGED
|
@@ -492,7 +492,7 @@ function createPrettyError(err) {
|
|
|
492
492
|
Reason: ${err.message}
|
|
493
493
|
|
|
494
494
|
You will need to add these integration(s) manually.
|
|
495
|
-
Documentation: https://docs.astro.build/en/guides/integrations
|
|
495
|
+
Documentation: https://docs.astro.build/en/guides/integrations/`;
|
|
496
496
|
return err;
|
|
497
497
|
}
|
|
498
498
|
function addIntegration(mod, integration) {
|
|
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
|
|
|
192
192
|
logger.info("Content config changed");
|
|
193
193
|
shouldClear = true;
|
|
194
194
|
}
|
|
195
|
-
if (previousAstroVersion && previousAstroVersion !== "6.1.
|
|
195
|
+
if (previousAstroVersion && previousAstroVersion !== "6.1.2") {
|
|
196
196
|
logger.info("Astro version changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
|
|
|
200
200
|
logger.info("Clearing content store");
|
|
201
201
|
this.#store.clearAll();
|
|
202
202
|
}
|
|
203
|
-
if ("6.1.
|
|
204
|
-
this.#store.metaStore().set("astro-version", "6.1.
|
|
203
|
+
if ("6.1.2") {
|
|
204
|
+
this.#store.metaStore().set("astro-version", "6.1.2");
|
|
205
205
|
}
|
|
206
206
|
if (currentConfigDigest) {
|
|
207
207
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -67,6 +67,11 @@ async function createManifest(buildOpts, internals) {
|
|
|
67
67
|
for (const file of clientStatics) {
|
|
68
68
|
internals.staticFiles.add(file);
|
|
69
69
|
}
|
|
70
|
+
for (const [, ssrAssets] of internals.ssrAssetsPerEnvironment) {
|
|
71
|
+
for (const asset of ssrAssets) {
|
|
72
|
+
internals.staticFiles.add(asset);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
70
75
|
const staticFiles = internals.staticFiles;
|
|
71
76
|
const encodedKey = await encodeKey(await buildOpts.key);
|
|
72
77
|
const manifest = await buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey);
|
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.1.
|
|
40
|
+
const currentVersion = "6.1.2";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -29,7 +29,7 @@ export declare const UnknownCompilerError: {
|
|
|
29
29
|
/**
|
|
30
30
|
* @docs
|
|
31
31
|
* @see
|
|
32
|
-
* - [Official integrations](https://docs.astro.build/en/guides/integrations
|
|
32
|
+
* - [Official integrations](https://docs.astro.build/en/guides/integrations/#official-integrations)
|
|
33
33
|
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
34
34
|
* @description
|
|
35
35
|
* The adapter you're using unfortunately does not support `Astro.clientAddress`.
|
|
@@ -128,7 +128,7 @@ export declare const MissingMediaQueryDirective: {
|
|
|
128
128
|
* @message Unable to render `COMPONENT_NAME`. There are `RENDERER_COUNT` renderer(s) configured in your `astro.config.mjs` file, but none were able to server-side render `COMPONENT_NAME`.
|
|
129
129
|
* @see
|
|
130
130
|
* - [Frameworks components](https://docs.astro.build/en/guides/framework-components/)
|
|
131
|
-
* - [UI Frameworks](https://docs.astro.build/en/guides/integrations
|
|
131
|
+
* - [UI Frameworks](https://docs.astro.build/en/guides/integrations/#official-integrations)
|
|
132
132
|
* @description
|
|
133
133
|
* None of the installed integrations were able to render the component you imported. Make sure to install the appropriate integration for the type of component you are trying to include in your page.
|
|
134
134
|
*
|
|
@@ -577,7 +577,7 @@ const InvalidContentEntryFrontmatterError = {
|
|
|
577
577
|
`**${String(collection)} \u2192 ${String(
|
|
578
578
|
entryId
|
|
579
579
|
)}** frontmatter does not match collection schema.`,
|
|
580
|
-
error.message
|
|
580
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`)
|
|
581
581
|
].join("\n");
|
|
582
582
|
},
|
|
583
583
|
hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
|
|
@@ -589,7 +589,7 @@ const InvalidContentEntryDataError = {
|
|
|
589
589
|
return [
|
|
590
590
|
`**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
|
|
591
591
|
`,
|
|
592
|
-
` **: ${
|
|
592
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`),
|
|
593
593
|
""
|
|
594
594
|
].join("\n");
|
|
595
595
|
},
|
|
@@ -631,7 +631,7 @@ const ContentEntryDataError = {
|
|
|
631
631
|
return [
|
|
632
632
|
`**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
|
|
633
633
|
`,
|
|
634
|
-
` **: ${
|
|
634
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`),
|
|
635
635
|
""
|
|
636
636
|
].join("\n");
|
|
637
637
|
},
|
|
@@ -37,6 +37,13 @@ export type CreateContext = {
|
|
|
37
37
|
* Creates a context to be passed to Astro middleware `onRequest` function.
|
|
38
38
|
*/
|
|
39
39
|
declare function createContext({ request, params, userDefinedLocales, defaultLocale, locals, clientAddress, }: CreateContext): APIContext;
|
|
40
|
+
/**
|
|
41
|
+
* Checks whether the passed `value` is serializable.
|
|
42
|
+
*
|
|
43
|
+
* A serializable value contains plain values. For example, `Proxy`, `Set`, `Map`, functions, etc.
|
|
44
|
+
* are not accepted because they can't be serialized.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isLocalsSerializable(value: unknown): boolean;
|
|
40
47
|
/**
|
|
41
48
|
* It attempts to serialize `value` and return it as a string.
|
|
42
49
|
*
|
|
@@ -82,20 +82,24 @@ function createContext({
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function isLocalsSerializable(value) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
85
|
+
const stack = [value];
|
|
86
|
+
while (stack.length > 0) {
|
|
87
|
+
const current = stack.pop();
|
|
88
|
+
const type = typeof current;
|
|
89
|
+
if (current === null || type === "string" || type === "number" || type === "boolean") {
|
|
90
|
+
continue;
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
if (Array.isArray(current)) {
|
|
93
|
+
stack.push(...current);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (type === "object" && isPlainObject(current)) {
|
|
97
|
+
stack.push(...Object.values(current));
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
96
101
|
}
|
|
97
|
-
|
|
98
|
-
return result;
|
|
102
|
+
return true;
|
|
99
103
|
}
|
|
100
104
|
function isPlainObject(value) {
|
|
101
105
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -118,6 +122,7 @@ import { defineMiddleware } from "./defineMiddleware.js";
|
|
|
118
122
|
export {
|
|
119
123
|
createContext,
|
|
120
124
|
defineMiddleware,
|
|
125
|
+
isLocalsSerializable,
|
|
121
126
|
sequence,
|
|
122
127
|
trySerializeLocals
|
|
123
128
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { preview } from "vite";
|
|
3
|
+
import { mergeConfig, preview } from "vite";
|
|
4
4
|
import * as msg from "../messages/runtime.js";
|
|
5
5
|
import { getResolvedHostForHttpServer } from "./util.js";
|
|
6
6
|
import { vitePluginAstroPreview } from "./vite-plugin-astro-preview.js";
|
|
@@ -10,7 +10,7 @@ async function createStaticPreviewServer(settings, logger) {
|
|
|
10
10
|
const startServerTime = performance.now();
|
|
11
11
|
let previewServer;
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
const astroPreviewConfig = {
|
|
14
14
|
configFile: false,
|
|
15
15
|
base: settings.config.base,
|
|
16
16
|
appType: "mpa",
|
|
@@ -22,11 +22,18 @@ async function createStaticPreviewServer(settings, logger) {
|
|
|
22
22
|
host: settings.config.server.host,
|
|
23
23
|
port: settings.config.server.port,
|
|
24
24
|
headers: settings.config.server.headers,
|
|
25
|
-
open: settings.config.server.open
|
|
26
|
-
allowedHosts: settings.config.server.allowedHosts
|
|
25
|
+
open: settings.config.server.open
|
|
27
26
|
},
|
|
28
27
|
plugins: [vitePluginAstroPreview(settings)]
|
|
29
|
-
}
|
|
28
|
+
};
|
|
29
|
+
const { plugins: _plugins, ...userViteConfig } = settings.config.vite ?? {};
|
|
30
|
+
const mergedViteConfig = mergeConfig(userViteConfig, astroPreviewConfig);
|
|
31
|
+
const { allowedHosts } = settings.config.server;
|
|
32
|
+
if (typeof allowedHosts === "boolean" || Array.isArray(allowedHosts) && allowedHosts.length > 0) {
|
|
33
|
+
mergedViteConfig.preview ??= {};
|
|
34
|
+
mergedViteConfig.preview.allowedHosts = allowedHosts;
|
|
35
|
+
}
|
|
36
|
+
previewServer = await preview(mergedViteConfig);
|
|
30
37
|
} catch (err) {
|
|
31
38
|
if (err instanceof Error) {
|
|
32
39
|
logger.error(null, err.stack || err.message);
|
|
@@ -451,7 +451,9 @@ const a11y = [
|
|
|
451
451
|
}
|
|
452
452
|
const elementRoles = role.split(WHITESPACE_REGEX);
|
|
453
453
|
for (const elementRole of elementRoles) {
|
|
454
|
-
const
|
|
454
|
+
const roleData = roles.get(normalizeAriaRole(elementRole));
|
|
455
|
+
if (!roleData) continue;
|
|
456
|
+
const { requiredProps } = roleData;
|
|
455
457
|
const required_role_props = Object.keys(requiredProps);
|
|
456
458
|
const missingProps = required_role_props.filter((prop) => !element.hasAttribute(prop));
|
|
457
459
|
if (missingProps.length > 0) {
|
|
@@ -477,7 +479,9 @@ const a11y = [
|
|
|
477
479
|
if (!role) return false;
|
|
478
480
|
const elementRoles = role.split(WHITESPACE_REGEX);
|
|
479
481
|
for (const elementRole of elementRoles) {
|
|
480
|
-
const
|
|
482
|
+
const roleData = roles.get(normalizeAriaRole(elementRole));
|
|
483
|
+
if (!roleData) continue;
|
|
484
|
+
const { props } = roleData;
|
|
481
485
|
const attributes = getAttributeObject(element);
|
|
482
486
|
const unsupportedAttributes = aria.keys().filter((attribute) => !(attribute in props));
|
|
483
487
|
const invalidAttributes = Object.keys(attributes).filter(
|
|
@@ -546,6 +550,12 @@ function menuitem_implicit_role(attributes) {
|
|
|
546
550
|
if (!type) return;
|
|
547
551
|
return menuitem_type_to_implicit_role.get(type);
|
|
548
552
|
}
|
|
553
|
+
const ariaQueryRoleAliases = {
|
|
554
|
+
image: "img"
|
|
555
|
+
};
|
|
556
|
+
function normalizeAriaRole(role) {
|
|
557
|
+
return ariaQueryRoleAliases[role] ?? role;
|
|
558
|
+
}
|
|
549
559
|
function getRole(element) {
|
|
550
560
|
if (element.hasAttribute("role")) {
|
|
551
561
|
return element.getAttribute("role");
|
|
@@ -116,6 +116,12 @@ const persistedHeadElement = (el, newDoc) => {
|
|
|
116
116
|
const href = el.getAttribute("href");
|
|
117
117
|
return newDoc.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
|
118
118
|
}
|
|
119
|
+
if (import.meta.env.DEV && el.tagName === "STYLE") {
|
|
120
|
+
const viteDevId = el.getAttribute("data-vite-dev-id");
|
|
121
|
+
if (viteDevId) {
|
|
122
|
+
return newDoc.head.querySelector(`style[data-vite-dev-id="${viteDevId}"]`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
119
125
|
if (el.tagName === "STYLE" && el.textContent) {
|
|
120
126
|
const styles = newDoc.head.querySelectorAll("style");
|
|
121
127
|
for (const s of styles) {
|
|
@@ -312,7 +312,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TDriver exten
|
|
|
312
312
|
*
|
|
313
313
|
* Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown).
|
|
314
314
|
*
|
|
315
|
-
* Read our [Integrations Guide](https://docs.astro.build/en/guides/integrations
|
|
315
|
+
* Read our [Integrations Guide](https://docs.astro.build/en/guides/integrations/) for help getting started with Astro Integrations.
|
|
316
316
|
*
|
|
317
317
|
* ```js
|
|
318
318
|
* import react from '@astrojs/react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.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",
|
|
@@ -218,7 +218,12 @@
|
|
|
218
218
|
"test:e2e:chrome": "playwright test",
|
|
219
219
|
"test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
|
|
220
220
|
"test:types": "tsc --project test/types/tsconfig.json",
|
|
221
|
-
"
|
|
222
|
-
"test:
|
|
221
|
+
"typecheck:tests": "tsc --project tsconfig.test.json",
|
|
222
|
+
"test:unit": "pnpm run test:unit:js && pnpm run test:unit:ts",
|
|
223
|
+
"test:unit:js": "astro-scripts test \"test/units/**/*.test.js\" --teardown ./test/units/teardown.js",
|
|
224
|
+
"test:unit:ts": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.js",
|
|
225
|
+
"test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
|
|
226
|
+
"test:integration:js": "astro-scripts test \"test/*.test.js\"",
|
|
227
|
+
"test:integration:ts": "astro-scripts test \"test/*.test.ts\" --strip-types"
|
|
223
228
|
}
|
|
224
229
|
}
|