astro 2.10.1 → 2.10.3
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 +8 -3
- package/dist/@types/astro.d.ts +8 -4
- package/dist/content/types-generator.js +1 -1
- package/dist/content/vite-plugin-content-imports.js +2 -1
- package/dist/core/app/index.js +4 -7
- package/dist/core/build/static-build.js +3 -14
- package/dist/core/compile/compile.js +1 -0
- package/dist/core/compile/style.js +1 -0
- package/dist/core/config/config.d.ts +6 -0
- package/dist/core/config/config.js +3 -0
- package/dist/core/config/settings.js +1 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/vite.js +10 -10
- package/dist/core/errors/errors-data.d.ts +1048 -962
- package/dist/core/errors/errors-data.js +446 -996
- package/dist/core/errors/errors.d.ts +1 -1
- package/dist/core/errors/errors.js +1 -11
- package/dist/core/errors/index.d.ts +1 -1
- package/dist/core/errors/index.js +1 -1
- package/dist/core/errors/utils.d.ts +0 -5
- package/dist/core/errors/utils.js +0 -11
- package/dist/core/messages.js +2 -2
- package/dist/core/util.js +3 -2
- package/dist/jsx/babel.js +1 -1
- package/dist/template/4xx.js +27 -5
- package/dist/transitions/vite-plugin-transitions.js +1 -0
- package/dist/vite-plugin-integrations-container/index.js +17 -0
- package/dist/vite-plugin-markdown/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { codeFrame } from "./printer.js";
|
|
2
|
-
import { getErrorDataByTitle } from "./utils.js";
|
|
3
2
|
function isAstroError(e) {
|
|
4
3
|
return e instanceof Error && e.type === "AstroError";
|
|
5
4
|
}
|
|
6
5
|
class AstroError extends Error {
|
|
7
6
|
constructor(props, ...params) {
|
|
8
|
-
var _a;
|
|
9
7
|
super(...params);
|
|
10
8
|
this.type = "AstroError";
|
|
11
9
|
const { name, title, message, stack, location, hint, frame } = props;
|
|
12
10
|
this.title = title;
|
|
13
|
-
|
|
14
|
-
this.name = name;
|
|
15
|
-
} else if (this.title) {
|
|
16
|
-
const errorData = (_a = getErrorDataByTitle(this.title)) == null ? void 0 : _a.name;
|
|
17
|
-
if (errorData) {
|
|
18
|
-
this.name = errorData;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
11
|
+
this.name = name;
|
|
21
12
|
if (message)
|
|
22
13
|
this.message = message;
|
|
23
14
|
this.stack = stack ? stack : this.stack;
|
|
@@ -48,7 +39,6 @@ class CompilerError extends AstroError {
|
|
|
48
39
|
constructor(props, ...params) {
|
|
49
40
|
super(props, ...params);
|
|
50
41
|
this.type = "CompilerError";
|
|
51
|
-
this.name = "CompilerError";
|
|
52
42
|
}
|
|
53
43
|
static is(err) {
|
|
54
44
|
return err.type === "CompilerError";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ErrorLocation, ErrorWithMetadata } from './errors';
|
|
2
|
-
export
|
|
2
|
+
export * as AstroErrorData from './errors-data.js';
|
|
3
3
|
export { AggregateError, AstroError, CSSError, CompilerError, MarkdownError, isAstroError, } from './errors.js';
|
|
4
4
|
export { codeFrame } from './printer.js';
|
|
5
5
|
export { createSafeError, positionAt } from './utils.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { YAMLException } from 'js-yaml';
|
|
2
2
|
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
|
3
|
-
import { type ErrorData } from './errors-data.js';
|
|
4
3
|
/**
|
|
5
4
|
* Get the line and character based on the offset
|
|
6
5
|
* @param offset The index of the position
|
|
@@ -16,7 +15,3 @@ export declare function formatYAMLException(e: YAMLException): ViteErrorPayload[
|
|
|
16
15
|
/** Coalesce any throw variable to an Error instance. */
|
|
17
16
|
export declare function createSafeError(err: any): Error;
|
|
18
17
|
export declare function normalizeLF(code: string): string;
|
|
19
|
-
export declare function getErrorDataByTitle(title: string): {
|
|
20
|
-
name: string;
|
|
21
|
-
data: ErrorData;
|
|
22
|
-
} | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AstroErrorData } from "./errors-data.js";
|
|
2
1
|
function positionAt(offset, text) {
|
|
3
2
|
const lineOffsets = getLineOffsets(text);
|
|
4
3
|
offset = Math.max(0, Math.min(text.length, offset));
|
|
@@ -70,19 +69,9 @@ function createSafeError(err) {
|
|
|
70
69
|
function normalizeLF(code) {
|
|
71
70
|
return code.replace(/\r\n|\r(?!\n)|\n/g, "\n");
|
|
72
71
|
}
|
|
73
|
-
function getErrorDataByTitle(title) {
|
|
74
|
-
const entry = Object.entries(AstroErrorData).find((data) => data[1].title === title);
|
|
75
|
-
if (entry) {
|
|
76
|
-
return {
|
|
77
|
-
name: entry[0],
|
|
78
|
-
data: entry[1]
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
72
|
export {
|
|
83
73
|
createSafeError,
|
|
84
74
|
formatYAMLException,
|
|
85
|
-
getErrorDataByTitle,
|
|
86
75
|
isYAMLException,
|
|
87
76
|
normalizeLF,
|
|
88
77
|
positionAt
|
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.3";
|
|
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.3"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|
package/dist/core/util.js
CHANGED
|
@@ -74,8 +74,9 @@ function isInPagesDir(file, config) {
|
|
|
74
74
|
return file.toString().startsWith(pagesDir.toString());
|
|
75
75
|
}
|
|
76
76
|
function isInjectedRoute(file, settings) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
let fileURL = file.toString();
|
|
78
|
+
for (const route of settings.resolvedInjectedRoutes) {
|
|
79
|
+
if (route.resolvedEntryPoint && fileURL === route.resolvedEntryPoint.toString())
|
|
79
80
|
return true;
|
|
80
81
|
}
|
|
81
82
|
return false;
|
package/dist/jsx/babel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
-
import { AstroErrorData } from "../core/errors/errors-data.js";
|
|
3
2
|
import { AstroError } from "../core/errors/errors.js";
|
|
3
|
+
import { AstroErrorData } from "../core/errors/index.js";
|
|
4
4
|
import { resolvePath } from "../core/util.js";
|
|
5
5
|
const ClientOnlyPlaceholder = "astro-client-only";
|
|
6
6
|
function isComponent(tagName) {
|
package/dist/template/4xx.js
CHANGED
|
@@ -14,6 +14,14 @@ function template({
|
|
|
14
14
|
<title>${tabTitle}</title>
|
|
15
15
|
<style>
|
|
16
16
|
${baseCSS}
|
|
17
|
+
:root {
|
|
18
|
+
--black: #13151A;
|
|
19
|
+
--accent-light: #E0CCFA;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
background: var(--black);
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
.center {
|
|
19
27
|
display: flex;
|
|
@@ -24,19 +32,33 @@ function template({
|
|
|
24
32
|
width: 100vw;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
h1 {
|
|
36
|
+
margin-bottom: 8px;
|
|
37
|
+
color: white;
|
|
38
|
+
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
.statusCode {
|
|
28
|
-
color: var(--
|
|
43
|
+
color: var(--accent-light);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.astro-icon {
|
|
47
|
+
height: 124px;
|
|
48
|
+
width: 124px;
|
|
29
49
|
}
|
|
30
50
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
pre {
|
|
52
|
+
padding: 2px 8px;
|
|
53
|
+
background: rgba(0,0,0, 0.25);
|
|
54
|
+
border: 1px solid rgba(255,255,255, 0.25);
|
|
55
|
+
border-radius: 4px;
|
|
34
56
|
}
|
|
35
57
|
</style>
|
|
36
58
|
</head>
|
|
37
59
|
<body>
|
|
38
60
|
<main class="center">
|
|
39
|
-
<svg class="astro"
|
|
61
|
+
<svg class="astro-icon" xmlns="http://www.w3.org/2000/svg" width="64" height="80" viewBox="0 0 64 80" fill="none"> <path d="M20.5253 67.6322C16.9291 64.3531 15.8793 57.4632 17.3776 52.4717C19.9755 55.6188 23.575 56.6157 27.3035 57.1784C33.0594 58.0468 38.7122 57.722 44.0592 55.0977C44.6709 54.7972 45.2362 54.3978 45.9045 53.9931C46.4062 55.4451 46.5368 56.9109 46.3616 58.4028C45.9355 62.0362 44.1228 64.8429 41.2397 66.9705C40.0868 67.8215 38.8669 68.5822 37.6762 69.3846C34.0181 71.8508 33.0285 74.7426 34.403 78.9491C34.4357 79.0516 34.4649 79.1541 34.5388 79.4042C32.6711 78.5705 31.3069 77.3565 30.2674 75.7604C29.1694 74.0757 28.6471 72.2121 28.6196 70.1957C28.6059 69.2144 28.6059 68.2244 28.4736 67.257C28.1506 64.8985 27.0406 63.8425 24.9496 63.7817C22.8036 63.7192 21.106 65.0426 20.6559 67.1268C20.6215 67.2865 20.5717 67.4446 20.5218 67.6304L20.5253 67.6322Z" fill="white"/> <path d="M20.5253 67.6322C16.9291 64.3531 15.8793 57.4632 17.3776 52.4717C19.9755 55.6188 23.575 56.6157 27.3035 57.1784C33.0594 58.0468 38.7122 57.722 44.0592 55.0977C44.6709 54.7972 45.2362 54.3978 45.9045 53.9931C46.4062 55.4451 46.5368 56.9109 46.3616 58.4028C45.9355 62.0362 44.1228 64.8429 41.2397 66.9705C40.0868 67.8215 38.8669 68.5822 37.6762 69.3846C34.0181 71.8508 33.0285 74.7426 34.403 78.9491C34.4357 79.0516 34.4649 79.1541 34.5388 79.4042C32.6711 78.5705 31.3069 77.3565 30.2674 75.7604C29.1694 74.0757 28.6471 72.2121 28.6196 70.1957C28.6059 69.2144 28.6059 68.2244 28.4736 67.257C28.1506 64.8985 27.0406 63.8425 24.9496 63.7817C22.8036 63.7192 21.106 65.0426 20.6559 67.1268C20.6215 67.2865 20.5717 67.4446 20.5218 67.6304L20.5253 67.6322Z" fill="url(#paint0_linear_738_686)"/> <path d="M0 51.6401C0 51.6401 10.6488 46.4654 21.3274 46.4654L29.3786 21.6102C29.6801 20.4082 30.5602 19.5913 31.5538 19.5913C32.5474 19.5913 33.4275 20.4082 33.7289 21.6102L41.7802 46.4654C54.4274 46.4654 63.1076 51.6401 63.1076 51.6401C63.1076 51.6401 45.0197 2.48776 44.9843 2.38914C44.4652 0.935933 43.5888 0 42.4073 0H20.7022C19.5206 0 18.6796 0.935933 18.1251 2.38914C18.086 2.4859 0 51.6401 0 51.6401Z" fill="white"/> <defs> <linearGradient id="paint0_linear_738_686" x1="31.554" y1="75.4423" x2="39.7462" y2="48.376" gradientUnits="userSpaceOnUse"> <stop stop-color="#D83333"/> <stop offset="1" stop-color="#F041FF"/> </linearGradient> </defs> </svg>
|
|
40
62
|
<h1>${statusCode ? `<span class="statusCode">${statusCode}: </span> ` : ""}<span class="statusMessage">${title}</span></h1>
|
|
41
63
|
${body || `
|
|
42
64
|
<pre>Path: ${escape(pathname)}</pre>
|
|
@@ -13,6 +13,7 @@ function astroTransitions({ config }) {
|
|
|
13
13
|
if (id === resolvedVirtualModuleId) {
|
|
14
14
|
if (!config.experimental.viewTransitions) {
|
|
15
15
|
throw new AstroError({
|
|
16
|
+
name: "TransitionError",
|
|
16
17
|
title: "Experimental View Transitions not enabled",
|
|
17
18
|
message: `View Transitions support is experimental. To enable update your config to include:
|
|
18
19
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizePath } from "vite";
|
|
1
2
|
import { runHookServerSetup } from "../integrations/index.js";
|
|
2
3
|
function astroIntegrationsContainerPlugin({
|
|
3
4
|
settings,
|
|
@@ -6,10 +7,26 @@ function astroIntegrationsContainerPlugin({
|
|
|
6
7
|
return {
|
|
7
8
|
name: "astro:integration-container",
|
|
8
9
|
configureServer(server) {
|
|
10
|
+
if (server.config.isProduction)
|
|
11
|
+
return;
|
|
9
12
|
runHookServerSetup({ config: settings.config, server, logging });
|
|
13
|
+
},
|
|
14
|
+
async buildStart() {
|
|
15
|
+
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length)
|
|
16
|
+
return;
|
|
17
|
+
settings.resolvedInjectedRoutes = await Promise.all(
|
|
18
|
+
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
|
|
19
|
+
);
|
|
10
20
|
}
|
|
11
21
|
};
|
|
12
22
|
}
|
|
23
|
+
async function resolveEntryPoint(route) {
|
|
24
|
+
const resolvedId = await this.resolve(route.entryPoint).then((res) => res == null ? void 0 : res.id).catch(() => void 0);
|
|
25
|
+
if (!resolvedId)
|
|
26
|
+
return route;
|
|
27
|
+
const resolvedEntryPoint = new URL(`file://${normalizePath(resolvedId)}`);
|
|
28
|
+
return { ...route, resolvedEntryPoint };
|
|
29
|
+
}
|
|
13
30
|
export {
|
|
14
31
|
astroIntegrationsContainerPlugin as default
|
|
15
32
|
};
|