astro 3.4.0 → 3.4.1

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.
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { z } from "zod";
6
6
  import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } from "../path.js";
7
+ import "mdast-util-to-hast";
7
8
  const ASTRO_CONFIG_DEFAULTS = {
8
9
  root: ".",
9
10
  srcDir: "./src",
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "3.4.0";
1
+ const ASTRO_VERSION = "3.4.1";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
20
20
  base: restart.container.settings.config.base
21
21
  })
22
22
  );
23
- const currentVersion = "3.4.0";
23
+ const currentVersion = "3.4.1";
24
24
  if (currentVersion.includes("-")) {
25
25
  logger.warn(null, msg.prerelease({ currentVersion }));
26
26
  }
@@ -29,7 +29,7 @@ export declare const UnknownCompilerError: {
29
29
  /**
30
30
  * @docs
31
31
  * @see
32
- * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
32
+ * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/)
33
33
  * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#astroredirect)
34
34
  * @description
35
35
  * The `Astro.redirect` function is only available when [Server-side rendering](/en/guides/server-side-rendering/) is enabled.
@@ -59,7 +59,7 @@ export declare const ClientAddressNotAvailable: {
59
59
  /**
60
60
  * @docs
61
61
  * @see
62
- * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
62
+ * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/)
63
63
  * - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
64
64
  * @description
65
65
  * The `Astro.clientAddress` property is only available when [Server-side rendering](https://docs.astro.build/en/guides/server-side-rendering/) is enabled.
@@ -357,7 +357,6 @@ export declare const ReservedSlotName: {
357
357
  * @docs
358
358
  * @see
359
359
  * - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
360
- * - [Adding an Adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter)
361
360
  * @description
362
361
  * To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your targeted deployment platform.
363
362
  */
@@ -7,7 +7,7 @@ const StaticRedirectNotAvailable = {
7
7
  name: "StaticRedirectNotAvailable",
8
8
  title: "`Astro.redirect` is not available in static mode.",
9
9
  message: "Redirects are only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
10
- hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
10
+ hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information on how to enable SSR."
11
11
  };
12
12
  const ClientAddressNotAvailable = {
13
13
  name: "ClientAddressNotAvailable",
@@ -18,7 +18,7 @@ const StaticClientAddressNotAvailable = {
18
18
  name: "StaticClientAddressNotAvailable",
19
19
  title: "`Astro.clientAddress` is not available in static mode.",
20
20
  message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
21
- hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
21
+ hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information on how to enable SSR."
22
22
  };
23
23
  const NoMatchingStaticPathFound = {
24
24
  name: "NoMatchingStaticPathFound",
@@ -50,7 +50,7 @@ function serverStart({
50
50
  base,
51
51
  isRestart = false
52
52
  }) {
53
- const version = "3.4.0";
53
+ const version = "3.4.1";
54
54
  const localPrefix = `${dim("\u2503")} Local `;
55
55
  const networkPrefix = `${dim("\u2503")} Network `;
56
56
  const emptyPrefix = " ".repeat(11);
@@ -235,7 +235,7 @@ function printHelp({
235
235
  message.push(
236
236
  linebreak(),
237
237
  ` ${bgGreen(black(` ${commandName} `))} ${green(
238
- `v${"3.4.0"}`
238
+ `v${"3.4.1"}`
239
239
  )} ${headline}`
240
240
  );
241
241
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ import {} from "./overlay.js";
2
+ let overlay;
3
+ document.addEventListener("DOMContentLoaded", async () => {
4
+ const [
5
+ { loadDevOverlayPlugins },
6
+ { default: astroDevToolPlugin },
7
+ { default: astroAuditPlugin },
8
+ { default: astroXrayPlugin },
9
+ { AstroDevOverlay, DevOverlayCanvas },
10
+ { DevOverlayCard },
11
+ { DevOverlayHighlight },
12
+ { DevOverlayTooltip },
13
+ { DevOverlayWindow }
14
+ ] = await Promise.all([
15
+ // @ts-expect-error
16
+ import("astro:dev-overlay"),
17
+ import("./plugins/astro.js"),
18
+ import("./plugins/audit.js"),
19
+ import("./plugins/xray.js"),
20
+ import("./overlay.js"),
21
+ import("./ui-library/card.js"),
22
+ import("./ui-library/highlight.js"),
23
+ import("./ui-library/tooltip.js"),
24
+ import("./ui-library/window.js")
25
+ ]);
26
+ customElements.define("astro-dev-overlay", AstroDevOverlay);
27
+ customElements.define("astro-dev-overlay-window", DevOverlayWindow);
28
+ customElements.define("astro-dev-overlay-plugin-canvas", DevOverlayCanvas);
29
+ customElements.define("astro-dev-overlay-tooltip", DevOverlayTooltip);
30
+ customElements.define("astro-dev-overlay-highlight", DevOverlayHighlight);
31
+ customElements.define("astro-dev-overlay-card", DevOverlayCard);
32
+ overlay = document.createElement("astro-dev-overlay");
33
+ const preparePlugin = (pluginDefinition, builtIn) => {
34
+ const eventTarget = new EventTarget();
35
+ const plugin = {
36
+ ...pluginDefinition,
37
+ builtIn,
38
+ active: false,
39
+ status: "loading",
40
+ eventTarget
41
+ };
42
+ eventTarget.addEventListener("plugin-notification", (evt) => {
43
+ const target = overlay.shadowRoot?.querySelector(`[data-plugin-id="${plugin.id}"]`);
44
+ if (!target)
45
+ return;
46
+ let newState = true;
47
+ if (evt instanceof CustomEvent) {
48
+ newState = evt.detail.state ?? true;
49
+ }
50
+ target.querySelector(".notification")?.toggleAttribute("data-active", newState);
51
+ });
52
+ return plugin;
53
+ };
54
+ const customPluginsDefinitions = await loadDevOverlayPlugins();
55
+ const plugins = [
56
+ ...[astroDevToolPlugin, astroXrayPlugin, astroAuditPlugin].map(
57
+ (pluginDef) => preparePlugin(pluginDef, true)
58
+ ),
59
+ ...customPluginsDefinitions.map((pluginDef) => preparePlugin(pluginDef, false))
60
+ ];
61
+ overlay.plugins = plugins;
62
+ document.body.append(overlay);
63
+ document.addEventListener("astro:after-swap", () => {
64
+ document.body.append(overlay);
65
+ });
66
+ });
@@ -1 +1,33 @@
1
- export {};
1
+ import type { DevOverlayPlugin as DevOverlayPluginDefinition } from '../../../@types/astro.js';
2
+ import { type Icon } from './ui-library/icons.js';
3
+ export type DevOverlayPlugin = DevOverlayPluginDefinition & {
4
+ builtIn: boolean;
5
+ active: boolean;
6
+ status: 'ready' | 'loading' | 'error';
7
+ eventTarget: EventTarget;
8
+ };
9
+ export declare class AstroDevOverlay extends HTMLElement {
10
+ shadowRoot: ShadowRoot;
11
+ hoverTimeout: number | undefined;
12
+ isHidden: () => boolean;
13
+ devOverlay: HTMLDivElement | undefined;
14
+ plugins: DevOverlayPlugin[];
15
+ HOVER_DELAY: number;
16
+ hasBeenInitialized: boolean;
17
+ constructor();
18
+ connectedCallback(): Promise<void>;
19
+ attachEvents(): void;
20
+ initAllPlugins(): Promise<void>;
21
+ initPlugin(plugin: DevOverlayPlugin): Promise<void>;
22
+ getPluginTemplate(plugin: DevOverlayPlugin): string;
23
+ getPluginIcon(icon: Icon): string | undefined;
24
+ getPluginById(id: string): DevOverlayPlugin | undefined;
25
+ getPluginCanvasById(id: string): Element | null;
26
+ togglePluginStatus(plugin: DevOverlayPlugin, status?: boolean): void;
27
+ toggleMinimizeButton(newStatus?: boolean): void;
28
+ toggleOverlay(newStatus?: boolean): void;
29
+ }
30
+ export declare class DevOverlayCanvas extends HTMLElement {
31
+ shadowRoot: ShadowRoot;
32
+ constructor();
33
+ }