astro 2.10.5 → 2.10.7
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/components/ViewTransitions.astro +32 -1
- package/dist/content/runtime.js +1 -1
- package/dist/core/build/plugins/plugin-middleware.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/template/4xx.js +34 -4
- package/dist/vite-plugin-astro-server/plugin.js +4 -6
- package/package.json +1 -1
- package/dist/template/css.d.ts +0 -6
- package/dist/template/css.js +0 -46
|
@@ -63,9 +63,16 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
63
63
|
return 'animate';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
function markScriptsExec() {
|
|
67
|
+
for (const script of document.scripts) {
|
|
68
|
+
script.dataset.astroExec = '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
function runScripts() {
|
|
67
73
|
let wait = Promise.resolve();
|
|
68
74
|
for (const script of Array.from(document.scripts)) {
|
|
75
|
+
if (script.dataset.astroExec === '') continue;
|
|
69
76
|
const s = document.createElement('script');
|
|
70
77
|
s.innerHTML = script.innerHTML;
|
|
71
78
|
for (const attr of script.attributes) {
|
|
@@ -77,6 +84,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
77
84
|
}
|
|
78
85
|
s.setAttribute(attr.name, attr.value);
|
|
79
86
|
}
|
|
87
|
+
s.dataset.astroExec = '';
|
|
80
88
|
script.replaceWith(s);
|
|
81
89
|
}
|
|
82
90
|
return wait;
|
|
@@ -100,6 +108,19 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
100
108
|
const href = el.getAttribute('href');
|
|
101
109
|
return doc.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
|
102
110
|
}
|
|
111
|
+
if (el.tagName === 'SCRIPT') {
|
|
112
|
+
let s1 = el as HTMLScriptElement;
|
|
113
|
+
for (const s2 of doc.scripts) {
|
|
114
|
+
if (
|
|
115
|
+
// Inline
|
|
116
|
+
(s1.textContent && s1.textContent === s2.textContent) ||
|
|
117
|
+
// External
|
|
118
|
+
(s1.type === s2.type && s1.src === s2.src)
|
|
119
|
+
) {
|
|
120
|
+
return s2;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
103
124
|
return null;
|
|
104
125
|
};
|
|
105
126
|
|
|
@@ -132,6 +153,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
132
153
|
}
|
|
133
154
|
}
|
|
134
155
|
|
|
156
|
+
if (state?.scrollY === 0 && location.hash) {
|
|
157
|
+
const id = decodeURIComponent(location.hash.slice(1));
|
|
158
|
+
state.scrollY = document.getElementById(id)?.offsetTop || 0;
|
|
159
|
+
}
|
|
135
160
|
if (state?.scrollY != null) {
|
|
136
161
|
scrollTo(0, state.scrollY);
|
|
137
162
|
}
|
|
@@ -203,6 +228,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
203
228
|
} finally {
|
|
204
229
|
document.documentElement.removeAttribute('data-astro-transition');
|
|
205
230
|
await runScripts();
|
|
231
|
+
markScriptsExec();
|
|
206
232
|
onload();
|
|
207
233
|
}
|
|
208
234
|
}
|
|
@@ -221,6 +247,8 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
221
247
|
}
|
|
222
248
|
|
|
223
249
|
if (supportsViewTransitions || getFallback() !== 'none') {
|
|
250
|
+
markScriptsExec();
|
|
251
|
+
|
|
224
252
|
document.addEventListener('click', (ev) => {
|
|
225
253
|
let link = ev.target;
|
|
226
254
|
if (link instanceof Element && link.tagName !== 'A') {
|
|
@@ -235,7 +263,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
235
263
|
link.href &&
|
|
236
264
|
(!link.target || link.target === '_self') &&
|
|
237
265
|
link.origin === location.origin &&
|
|
238
|
-
!
|
|
266
|
+
!(
|
|
267
|
+
// Same page means same path and same query params
|
|
268
|
+
(location.pathname === link.pathname && location.search === link.search)
|
|
269
|
+
) &&
|
|
239
270
|
ev.button === 0 && // left clicks only
|
|
240
271
|
!ev.metaKey && // new tab (mac)
|
|
241
272
|
!ev.ctrlKey && // new tab (windows)
|
package/dist/content/runtime.js
CHANGED
|
@@ -49,7 +49,7 @@ function createGetCollection({
|
|
|
49
49
|
);
|
|
50
50
|
let entries = [];
|
|
51
51
|
if (import.meta.env.PROD && cacheEntriesByCollection.has(collection)) {
|
|
52
|
-
entries = cacheEntriesByCollection.get(collection);
|
|
52
|
+
entries = [...cacheEntriesByCollection.get(collection)];
|
|
53
53
|
} else {
|
|
54
54
|
entries = await Promise.all(
|
|
55
55
|
lazyImports.map(async (lazyImport) => {
|
|
@@ -42,7 +42,7 @@ function vitePluginMiddleware(opts, internals) {
|
|
|
42
42
|
if (chunk.type === "asset") {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
if (chunk.fileName === "middleware.mjs") {
|
|
45
|
+
if (chunk.fileName === "middleware.mjs" && opts.settings.config.build.excludeMiddleware) {
|
|
46
46
|
internals.middlewareEntryPoint = new URL(chunkName, opts.settings.config.build.server);
|
|
47
47
|
}
|
|
48
48
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "2.10.
|
|
26
|
+
const currentVersion = "2.10.7";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
warn(logging, null, msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
base,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "2.10.
|
|
50
|
+
const version = "2.10.7";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
53
53
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -233,7 +233,7 @@ function printHelp({
|
|
|
233
233
|
message.push(
|
|
234
234
|
linebreak(),
|
|
235
235
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
236
|
-
`v${"2.10.
|
|
236
|
+
`v${"2.10.7"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|
package/dist/template/4xx.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { escape } from "html-escaper";
|
|
2
|
-
import { baseCSS } from "./css.js";
|
|
3
2
|
function template({
|
|
4
3
|
title,
|
|
5
4
|
pathname,
|
|
@@ -13,14 +12,40 @@ function template({
|
|
|
13
12
|
<meta charset="UTF-8">
|
|
14
13
|
<title>${tabTitle}</title>
|
|
15
14
|
<style>
|
|
16
|
-
${baseCSS}
|
|
17
15
|
:root {
|
|
16
|
+
--gray-10: hsl(258, 7%, 10%);
|
|
17
|
+
--gray-20: hsl(258, 7%, 20%);
|
|
18
|
+
--gray-30: hsl(258, 7%, 30%);
|
|
19
|
+
--gray-40: hsl(258, 7%, 40%);
|
|
20
|
+
--gray-50: hsl(258, 7%, 50%);
|
|
21
|
+
--gray-60: hsl(258, 7%, 60%);
|
|
22
|
+
--gray-70: hsl(258, 7%, 70%);
|
|
23
|
+
--gray-80: hsl(258, 7%, 80%);
|
|
24
|
+
--gray-90: hsl(258, 7%, 90%);
|
|
18
25
|
--black: #13151A;
|
|
19
26
|
--accent-light: #E0CCFA;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
* {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
html {
|
|
23
34
|
background: var(--black);
|
|
35
|
+
color-scheme: dark;
|
|
36
|
+
accent-color: var(--accent-light);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
background-color: var(--gray-10);
|
|
41
|
+
color: var(--gray-80);
|
|
42
|
+
font-family: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
a {
|
|
48
|
+
color: var(--accent-light);
|
|
24
49
|
}
|
|
25
50
|
|
|
26
51
|
.center {
|
|
@@ -37,6 +62,8 @@ function template({
|
|
|
37
62
|
color: white;
|
|
38
63
|
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
39
64
|
font-weight: 700;
|
|
65
|
+
margin-top: 1rem;
|
|
66
|
+
margin-bottom: 0;
|
|
40
67
|
}
|
|
41
68
|
|
|
42
69
|
.statusCode {
|
|
@@ -48,11 +75,14 @@ function template({
|
|
|
48
75
|
width: 124px;
|
|
49
76
|
}
|
|
50
77
|
|
|
51
|
-
pre {
|
|
78
|
+
pre, code {
|
|
52
79
|
padding: 2px 8px;
|
|
53
80
|
background: rgba(0,0,0, 0.25);
|
|
54
81
|
border: 1px solid rgba(255,255,255, 0.25);
|
|
55
82
|
border-radius: 4px;
|
|
83
|
+
font-size: 1.2em;
|
|
84
|
+
margin-top: 0;
|
|
85
|
+
max-width: 60em;
|
|
56
86
|
}
|
|
57
87
|
</style>
|
|
58
88
|
</head>
|
|
@@ -28,12 +28,10 @@ function createVitePluginAstroServer({
|
|
|
28
28
|
viteServer.watcher.on("unlink", rebuildManifest.bind(null, true));
|
|
29
29
|
viteServer.watcher.on("change", rebuildManifest.bind(null, false));
|
|
30
30
|
return () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
31
|
+
viteServer.middlewares.stack.unshift({
|
|
32
|
+
route: "",
|
|
33
|
+
handle: baseMiddleware(settings, logging)
|
|
34
|
+
});
|
|
37
35
|
viteServer.middlewares.use(async function astroDevHandler(request, response) {
|
|
38
36
|
if (request.url === void 0 || !request.method) {
|
|
39
37
|
response.writeHead(500, "Incomplete request");
|
package/package.json
CHANGED
package/dist/template/css.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS is exported as a string so the error pages:
|
|
3
|
-
* 1. don’t need to resolve a deep internal CSS import
|
|
4
|
-
* 2. don’t need external dependencies to render (they may be shown because of a dep!)
|
|
5
|
-
*/
|
|
6
|
-
export declare const baseCSS = "\n:root {\n --gray-10: hsl(258, 7%, 10%);\n --gray-20: hsl(258, 7%, 20%);\n --gray-30: hsl(258, 7%, 30%);\n --gray-40: hsl(258, 7%, 40%);\n --gray-50: hsl(258, 7%, 50%);\n --gray-60: hsl(258, 7%, 60%);\n --gray-70: hsl(258, 7%, 70%);\n --gray-80: hsl(258, 7%, 80%);\n --gray-90: hsl(258, 7%, 90%);\n --orange: #ff5d01;\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n background-color: var(--gray-10);\n color: var(--gray-80);\n font-family: monospace;\n line-height: 1.5;\n margin: 0;\n}\n\na {\n color: var(--orange);\n}\n\nh1 {\n font-weight: 800;\n margin-top: 1rem;\n margin-bottom: 0;\n}\n\npre {\n color:;\n font-size: 1.2em;\n margin-top: 0;\n max-width: 60em;\n}\n";
|
package/dist/template/css.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const baseCSS = `
|
|
2
|
-
:root {
|
|
3
|
-
--gray-10: hsl(258, 7%, 10%);
|
|
4
|
-
--gray-20: hsl(258, 7%, 20%);
|
|
5
|
-
--gray-30: hsl(258, 7%, 30%);
|
|
6
|
-
--gray-40: hsl(258, 7%, 40%);
|
|
7
|
-
--gray-50: hsl(258, 7%, 50%);
|
|
8
|
-
--gray-60: hsl(258, 7%, 60%);
|
|
9
|
-
--gray-70: hsl(258, 7%, 70%);
|
|
10
|
-
--gray-80: hsl(258, 7%, 80%);
|
|
11
|
-
--gray-90: hsl(258, 7%, 90%);
|
|
12
|
-
--orange: #ff5d01;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
* {
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
body {
|
|
20
|
-
background-color: var(--gray-10);
|
|
21
|
-
color: var(--gray-80);
|
|
22
|
-
font-family: monospace;
|
|
23
|
-
line-height: 1.5;
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
a {
|
|
28
|
-
color: var(--orange);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
h1 {
|
|
32
|
-
font-weight: 800;
|
|
33
|
-
margin-top: 1rem;
|
|
34
|
-
margin-bottom: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
pre {
|
|
38
|
-
color:;
|
|
39
|
-
font-size: 1.2em;
|
|
40
|
-
margin-top: 0;
|
|
41
|
-
max-width: 60em;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
export {
|
|
45
|
-
baseCSS
|
|
46
|
-
};
|