astro 4.0.2 → 4.0.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/astro-jsx.d.ts +2 -1
- package/dist/@types/astro.d.ts +3 -0
- package/dist/core/compile/compile.d.ts +3 -1
- package/dist/core/compile/compile.js +2 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +3 -3
- package/dist/runtime/client/dev-overlay/plugins/settings.js +1 -1
- package/dist/vite-plugin-astro/index.js +2 -0
- package/dist/vite-plugin-astro-server/route.js +9 -15
- package/package.json +1 -1
package/astro-jsx.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ declare namespace astroHTML.JSX {
|
|
|
36
36
|
AstroDefineVarsAttribute;
|
|
37
37
|
type AstroStyleAttributes = import('./dist/@types/astro.js').AstroStyleAttributes &
|
|
38
38
|
AstroDefineVarsAttribute;
|
|
39
|
+
type AstroSlotAttributes = import('./dist/@types/astro.js').AstroSlotAttributes;
|
|
39
40
|
|
|
40
41
|
// This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework
|
|
41
42
|
// without importing every single framework's types (which comes with its own set of problems).
|
|
@@ -1415,7 +1416,7 @@ declare namespace astroHTML.JSX {
|
|
|
1415
1416
|
ruby: HTMLAttributes;
|
|
1416
1417
|
s: HTMLAttributes;
|
|
1417
1418
|
samp: HTMLAttributes;
|
|
1418
|
-
slot: SlotHTMLAttributes;
|
|
1419
|
+
slot: SlotHTMLAttributes & AstroSlotAttributes;
|
|
1419
1420
|
script: ScriptHTMLAttributes & AstroScriptAttributes;
|
|
1420
1421
|
section: HTMLAttributes;
|
|
1421
1422
|
select: SelectHTMLAttributes;
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -73,6 +73,9 @@ export interface AstroStyleAttributes {
|
|
|
73
73
|
export interface AstroScriptAttributes {
|
|
74
74
|
'is:inline'?: boolean;
|
|
75
75
|
}
|
|
76
|
+
export interface AstroSlotAttributes {
|
|
77
|
+
'is:inline'?: boolean;
|
|
78
|
+
}
|
|
76
79
|
export interface AstroComponentMetadata {
|
|
77
80
|
displayName: string;
|
|
78
81
|
hydrate?: 'load' | 'idle' | 'visible' | 'media' | 'only';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { TransformResult } from '@astrojs/compiler';
|
|
2
2
|
import type { ResolvedConfig } from 'vite';
|
|
3
3
|
import type { AstroConfig } from '../../@types/astro.js';
|
|
4
|
+
import type { AstroPreferences } from '../../preferences/index.js';
|
|
4
5
|
export interface CompileProps {
|
|
5
6
|
astroConfig: AstroConfig;
|
|
6
7
|
viteConfig: ResolvedConfig;
|
|
8
|
+
preferences: AstroPreferences;
|
|
7
9
|
filename: string;
|
|
8
10
|
source: string;
|
|
9
11
|
}
|
|
@@ -11,4 +13,4 @@ export interface CompileResult extends TransformResult {
|
|
|
11
13
|
cssDeps: Set<string>;
|
|
12
14
|
source: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function compile({ astroConfig, viteConfig, filename, source, }: CompileProps): Promise<CompileResult>;
|
|
16
|
+
export declare function compile({ astroConfig, viteConfig, preferences, filename, source, }: CompileProps): Promise<CompileResult>;
|
|
@@ -8,6 +8,7 @@ import { createStylePreprocessor } from "./style.js";
|
|
|
8
8
|
async function compile({
|
|
9
9
|
astroConfig,
|
|
10
10
|
viteConfig,
|
|
11
|
+
preferences,
|
|
11
12
|
filename,
|
|
12
13
|
source
|
|
13
14
|
}) {
|
|
@@ -25,7 +26,7 @@ async function compile({
|
|
|
25
26
|
scopedStyleStrategy: astroConfig.scopedStyleStrategy,
|
|
26
27
|
resultScopedSlot: true,
|
|
27
28
|
transitionsAnimationURL: "astro/components/viewtransitions.css",
|
|
28
|
-
annotateSourceFile: viteConfig.command === "serve" && astroConfig.devToolbar && astroConfig.devToolbar.enabled,
|
|
29
|
+
annotateSourceFile: viteConfig.command === "serve" && astroConfig.devToolbar && astroConfig.devToolbar.enabled && await preferences.get("devToolbar.enabled"),
|
|
29
30
|
preprocessStyle: createStylePreprocessor({
|
|
30
31
|
filename,
|
|
31
32
|
viteConfig,
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -21,7 +21,7 @@ async function dev(inlineConfig) {
|
|
|
21
21
|
base: restart.container.settings.config.base
|
|
22
22
|
})
|
|
23
23
|
);
|
|
24
|
-
const currentVersion = "4.0.
|
|
24
|
+
const currentVersion = "4.0.3";
|
|
25
25
|
if (currentVersion.includes("-")) {
|
|
26
26
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
27
27
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -27,7 +27,7 @@ function req({
|
|
|
27
27
|
statusCode,
|
|
28
28
|
reqTime
|
|
29
29
|
}) {
|
|
30
|
-
const color = statusCode >=
|
|
30
|
+
const color = statusCode >= 500 ? red : statusCode >= 300 ? yellow : blue;
|
|
31
31
|
return color(`[${statusCode}]`) + ` ` + (method && method !== "GET" ? color(method) + " " : "") + url + ` ` + (reqTime ? dim(Math.round(reqTime) + "ms") : "");
|
|
32
32
|
}
|
|
33
33
|
function serverStart({
|
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.0.
|
|
39
|
+
const version = "4.0.3";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -258,7 +258,7 @@ function printHelp({
|
|
|
258
258
|
message.push(
|
|
259
259
|
linebreak(),
|
|
260
260
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
261
|
-
`v${"4.0.
|
|
261
|
+
`v${"4.0.3"}`
|
|
262
262
|
)} ${headline}`
|
|
263
263
|
);
|
|
264
264
|
}
|
|
@@ -13,7 +13,7 @@ const settingsRows = [
|
|
|
13
13
|
devOverlay.setNotificationVisible(!evt.currentTarget.checked);
|
|
14
14
|
}
|
|
15
15
|
settings.updateSetting("disablePluginNotification", evt.currentTarget.checked);
|
|
16
|
-
const action = evt.currentTarget.checked ? "
|
|
16
|
+
const action = evt.currentTarget.checked ? "disabled" : "enabled";
|
|
17
17
|
settings.log(`Plugin notification badges ${action}`);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -113,6 +113,7 @@ File: ${id}`
|
|
|
113
113
|
const compileProps = {
|
|
114
114
|
astroConfig: config,
|
|
115
115
|
viteConfig: resolvedConfig,
|
|
116
|
+
preferences: settings.preferences,
|
|
116
117
|
filename: normalizePath(parsedId.filename),
|
|
117
118
|
source
|
|
118
119
|
};
|
|
@@ -149,6 +150,7 @@ File: ${id}`
|
|
|
149
150
|
const compile = () => cachedCompilation({
|
|
150
151
|
astroConfig: config,
|
|
151
152
|
viteConfig: resolvedConfig,
|
|
153
|
+
preferences: settings.preferences,
|
|
152
154
|
filename,
|
|
153
155
|
source
|
|
154
156
|
});
|
|
@@ -253,7 +253,7 @@ async function handleRoute({
|
|
|
253
253
|
req({
|
|
254
254
|
url: pathname,
|
|
255
255
|
method: incomingRequest.method,
|
|
256
|
-
statusCode: response.status,
|
|
256
|
+
statusCode: status ?? response.status,
|
|
257
257
|
reqTime: timeEnd - timeStart
|
|
258
258
|
})
|
|
259
259
|
);
|
|
@@ -277,22 +277,16 @@ async function handleRoute({
|
|
|
277
277
|
}
|
|
278
278
|
if (route.type === "endpoint") {
|
|
279
279
|
await writeWebResponse(incomingResponse, response);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
// By default, the status code passed via parameters is computed by the matched route.
|
|
284
|
-
//
|
|
285
|
-
// By default, we should give priority to the status code passed, although it's possible that
|
|
286
|
-
// the `Response` emitted by the user is a redirect. If so, then return the returned response.
|
|
287
|
-
response.status < 400 && response.status >= 300
|
|
288
|
-
) {
|
|
289
|
-
await writeSSRResult(request, response, incomingResponse);
|
|
290
|
-
return;
|
|
291
|
-
} else if (status && response.status !== status && (status === 404 || status === 500)) {
|
|
292
|
-
response = new Response(response.body, { ...response, status });
|
|
293
|
-
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (response.status < 400 && response.status >= 300) {
|
|
294
283
|
await writeSSRResult(request, response, incomingResponse);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (status && response.status !== status && (status === 404 || status === 500)) {
|
|
287
|
+
response = new Response(response.body, { ...response, status });
|
|
295
288
|
}
|
|
289
|
+
await writeSSRResult(request, response, incomingResponse);
|
|
296
290
|
}
|
|
297
291
|
async function getScriptsAndStyles({ pipeline, filePath }) {
|
|
298
292
|
const moduleLoader = pipeline.getModuleLoader();
|