astro 4.0.8 → 4.1.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/astro-jsx.d.ts +10 -1
- package/config.d.ts +2 -1
- package/config.mjs +2 -2
- package/dist/@types/astro.d.ts +58 -15
- package/dist/assets/services/sharp.d.ts +7 -1
- package/dist/assets/services/sharp.js +6 -2
- package/dist/assets/utils/transformToPath.js +1 -1
- package/dist/assets/vite-plugin-assets.js +2 -2
- package/dist/cli/add/index.js +4 -2
- package/dist/cli/check/index.js +2 -0
- package/dist/cli/flags.js +1 -1
- package/dist/cli/index.js +0 -3
- package/dist/cli/preview/index.js +3 -0
- package/dist/core/build/index.js +2 -0
- package/dist/core/config/config.js +2 -2
- package/dist/core/config/schema.d.ts +26 -26
- package/dist/core/config/schema.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.d.ts +7 -3
- package/dist/core/cookies/cookies.js +8 -8
- package/dist/core/cookies/index.d.ts +1 -0
- package/dist/core/dev/container.js +2 -2
- package/dist/core/dev/dev.js +3 -1
- package/dist/core/errors/dev/utils.js +5 -2
- package/dist/core/errors/dev/vite.d.ts +1 -1
- package/dist/core/errors/overlay.js +2 -2
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/index.js +9 -0
- package/dist/core/render/result.js +1 -0
- package/dist/core/routing/manifest/create.js +1 -1
- package/dist/core/sync/index.js +2 -0
- package/dist/core/util.d.ts +4 -0
- package/dist/core/util.js +6 -0
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +6 -3
- package/dist/i18n/vite-plugin-i18n.js +1 -1
- package/dist/prefetch/index.js +11 -1
- package/dist/runtime/client/dev-overlay/overlay.js +8 -2
- package/dist/runtime/client/dev-overlay/plugins/audit/a11y.js +126 -0
- package/dist/runtime/client/visible.js +6 -2
- package/dist/runtime/client/visible.prebuilt.d.ts +1 -1
- package/dist/runtime/client/visible.prebuilt.js +1 -1
- package/dist/runtime/server/render/common.js +9 -0
- package/dist/runtime/server/render/component.js +9 -0
- package/dist/runtime/server/render/instruction.d.ts +11 -1
- package/dist/transitions/router.js +9 -3
- package/dist/vite-plugin-astro-server/base.js +6 -1
- package/dist/vite-plugin-astro-server/error.js +4 -2
- package/dist/vite-plugin-dev-overlay/vite-plugin-dev-overlay.js +8 -0
- package/package.json +4 -1
|
@@ -114,8 +114,10 @@ function runScripts() {
|
|
|
114
114
|
}
|
|
115
115
|
return wait;
|
|
116
116
|
}
|
|
117
|
-
const moveToLocation = (to, from, options, historyState) => {
|
|
117
|
+
const moveToLocation = (to, from, options, pageTitleForBrowserHistory, historyState) => {
|
|
118
118
|
const intraPage = samePage(from, to);
|
|
119
|
+
const targetPageTitle = document.title;
|
|
120
|
+
document.title = pageTitleForBrowserHistory;
|
|
119
121
|
let scrolledToTop = false;
|
|
120
122
|
if (to.href !== location.href && !historyState) {
|
|
121
123
|
if (options.history === "replace") {
|
|
@@ -148,7 +150,9 @@ const moveToLocation = (to, from, options, historyState) => {
|
|
|
148
150
|
} else {
|
|
149
151
|
if (to.hash) {
|
|
150
152
|
history.scrollRestoration = "auto";
|
|
153
|
+
const savedState = history.state;
|
|
151
154
|
location.href = to.href;
|
|
155
|
+
history.state || replaceState(savedState, "");
|
|
152
156
|
} else {
|
|
153
157
|
if (!scrolledToTop) {
|
|
154
158
|
scrollTo({ left: 0, top: 0, behavior: "instant" });
|
|
@@ -156,6 +160,7 @@ const moveToLocation = (to, from, options, historyState) => {
|
|
|
156
160
|
}
|
|
157
161
|
history.scrollRestoration = "manual";
|
|
158
162
|
}
|
|
163
|
+
document.title = targetPageTitle;
|
|
159
164
|
};
|
|
160
165
|
function preloadStyleLinks(newDocument) {
|
|
161
166
|
const links = [];
|
|
@@ -279,8 +284,9 @@ async function updateDOM(preparationEvent, options, historyState, fallback) {
|
|
|
279
284
|
} else {
|
|
280
285
|
throw new DOMException("Transition was skipped");
|
|
281
286
|
}
|
|
287
|
+
const pageTitleForBrowserHistory = document.title;
|
|
282
288
|
const swapEvent = await doSwap(preparationEvent, viewTransition, defaultSwap);
|
|
283
|
-
moveToLocation(swapEvent.to, swapEvent.from, options, historyState);
|
|
289
|
+
moveToLocation(swapEvent.to, swapEvent.from, options, pageTitleForBrowserHistory, historyState);
|
|
284
290
|
triggerEvent(TRANSITION_AFTER_SWAP);
|
|
285
291
|
if (fallback === "animate" && !skipTransition) {
|
|
286
292
|
animate("new").then(() => viewTransitionFinished());
|
|
@@ -296,7 +302,7 @@ async function transition(direction, from, to, options, historyState) {
|
|
|
296
302
|
updateScrollPosition({ scrollX, scrollY });
|
|
297
303
|
}
|
|
298
304
|
if (samePage(from, to) && !!to.hash) {
|
|
299
|
-
moveToLocation(to, from, options, historyState);
|
|
305
|
+
moveToLocation(to, from, options, document.title, historyState);
|
|
300
306
|
return;
|
|
301
307
|
}
|
|
302
308
|
const prepEvent = await doPreparation(
|
|
@@ -10,7 +10,12 @@ function baseMiddleware(settings, logger) {
|
|
|
10
10
|
const devRootReplacement = devRoot.endsWith("/") ? "/" : "";
|
|
11
11
|
return function devBaseMiddleware(req, res, next) {
|
|
12
12
|
const url = req.url;
|
|
13
|
-
|
|
13
|
+
let pathname;
|
|
14
|
+
try {
|
|
15
|
+
pathname = decodeURI(new URL(url, "http://localhost").pathname);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return next(e);
|
|
18
|
+
}
|
|
14
19
|
if (pathname.startsWith(devRoot)) {
|
|
15
20
|
req.url = url.replace(devRoot, devRootReplacement);
|
|
16
21
|
return next();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectErrorMetadata } from "../core/errors/dev/index.js";
|
|
2
|
-
import { createSafeError } from "../core/errors/index.js";
|
|
2
|
+
import { createSafeError, AstroErrorData } from "../core/errors/index.js";
|
|
3
3
|
import { formatErrorMessage } from "../core/messages.js";
|
|
4
4
|
import { eventError, telemetry } from "../events/index.js";
|
|
5
5
|
function recordServerError(loader, config, pipeline, _err) {
|
|
@@ -9,7 +9,9 @@ function recordServerError(loader, config, pipeline, _err) {
|
|
|
9
9
|
} catch {
|
|
10
10
|
}
|
|
11
11
|
const errorWithMetadata = collectErrorMetadata(err, config.root);
|
|
12
|
-
|
|
12
|
+
if (errorWithMetadata.name !== AstroErrorData.UnhandledRejection.name) {
|
|
13
|
+
telemetry.record(eventError({ cmd: "dev", err: errorWithMetadata, isFatal: false }));
|
|
14
|
+
}
|
|
13
15
|
pipeline.logger.error(
|
|
14
16
|
null,
|
|
15
17
|
formatErrorMessage(errorWithMetadata, pipeline.logger.level() === "debug")
|
|
@@ -3,6 +3,14 @@ const resolvedVirtualModuleId = "\0" + VIRTUAL_MODULE_ID;
|
|
|
3
3
|
function astroDevOverlay({ settings }) {
|
|
4
4
|
return {
|
|
5
5
|
name: "astro:dev-overlay",
|
|
6
|
+
config() {
|
|
7
|
+
return {
|
|
8
|
+
optimizeDeps: {
|
|
9
|
+
// Optimize CJS dependencies used by the dev toolbar
|
|
10
|
+
include: ["astro > aria-query", "astro > axobject-query"]
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
},
|
|
6
14
|
resolveId(id) {
|
|
7
15
|
if (id === VIRTUAL_MODULE_ID) {
|
|
8
16
|
return resolvedVirtualModuleId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
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",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"@babel/types": "^7.23.3",
|
|
111
111
|
"@types/babel__core": "^7.20.4",
|
|
112
112
|
"acorn": "^8.11.2",
|
|
113
|
+
"aria-query": "^5.3.0",
|
|
114
|
+
"axobject-query": "^4.0.0",
|
|
113
115
|
"boxen": "^7.1.1",
|
|
114
116
|
"chokidar": "^3.5.3",
|
|
115
117
|
"ci-info": "^4.0.0",
|
|
@@ -169,6 +171,7 @@
|
|
|
169
171
|
"devDependencies": {
|
|
170
172
|
"@astrojs/check": "^0.3.1",
|
|
171
173
|
"@playwright/test": "1.40.0",
|
|
174
|
+
"@types/aria-query": "^5.0.4",
|
|
172
175
|
"@types/babel__generator": "^7.6.7",
|
|
173
176
|
"@types/babel__traverse": "^7.20.4",
|
|
174
177
|
"@types/chai": "^4.3.10",
|