astro 4.1.2 → 4.1.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.
Files changed (72) hide show
  1. package/components/ViewTransitions.astro +6 -1
  2. package/dist/@types/astro.d.ts +26 -25
  3. package/dist/assets/internal.js +3 -2
  4. package/dist/assets/services/noop.js +1 -4
  5. package/dist/assets/types.d.ts +1 -1
  6. package/dist/assets/utils/emitAsset.js +1 -1
  7. package/dist/assets/utils/proxy.d.ts +2 -1
  8. package/dist/assets/utils/proxy.js +5 -1
  9. package/dist/assets/vite-plugin-assets.js +21 -14
  10. package/dist/content/runtime-assets.d.ts +1 -1
  11. package/dist/content/runtime-assets.js +1 -1
  12. package/dist/content/vite-plugin-content-imports.js +1 -0
  13. package/dist/core/config/vite-load.js +1 -1
  14. package/dist/core/constants.js +1 -1
  15. package/dist/core/create-vite.js +3 -3
  16. package/dist/core/dev/dev.js +1 -1
  17. package/dist/core/errors/errors-data.d.ts +5 -0
  18. package/dist/core/errors/errors-data.js +7 -0
  19. package/dist/core/messages.js +2 -2
  20. package/dist/core/routing/manifest/create.js +15 -0
  21. package/dist/core/sync/index.js +1 -1
  22. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.js +2 -2
  23. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.js +3 -3
  24. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.js +7 -7
  25. package/dist/runtime/client/dev-toolbar/apps/utils/highlight.d.ts +8 -0
  26. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.d.ts +1 -1
  27. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.js +4 -4
  28. package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.js +64 -68
  29. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.d.ts +2 -2
  30. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.js +10 -5
  31. package/dist/runtime/client/dev-toolbar/toolbar.d.ts +45 -0
  32. package/dist/runtime/client/{dev-overlay/overlay.js → dev-toolbar/toolbar.js} +99 -103
  33. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.d.ts +1 -1
  34. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.js +2 -2
  35. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.d.ts +1 -1
  36. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.js +3 -2
  37. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.d.ts +1 -1
  38. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.js +2 -2
  39. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.d.ts +1 -1
  40. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.js +2 -2
  41. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.d.ts +1 -1
  42. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.js +2 -2
  43. package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +8 -0
  44. package/dist/runtime/client/dev-toolbar/ui-library/index.js +18 -0
  45. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.d.ts +1 -1
  46. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.js +2 -2
  47. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.d.ts +3 -3
  48. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.js +2 -2
  49. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.d.ts +1 -1
  50. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.js +3 -3
  51. package/dist/vite-plugin-astro/index.js +12 -2
  52. package/dist/vite-plugin-astro-server/route.js +3 -3
  53. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.d.ts → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.d.ts} +1 -1
  54. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.js → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js} +5 -5
  55. package/package.json +1 -1
  56. package/dist/runtime/client/dev-overlay/overlay.d.ts +0 -45
  57. package/dist/runtime/client/dev-overlay/plugins/utils/highlight.d.ts +0 -8
  58. package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +0 -8
  59. package/dist/runtime/client/dev-overlay/ui-library/index.js +0 -18
  60. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.d.ts +0 -0
  61. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.d.ts +0 -0
  62. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.js +0 -0
  63. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.d.ts +0 -0
  64. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.d.ts +0 -0
  65. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/highlight.js +0 -0
  66. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.d.ts +0 -0
  67. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.js +0 -0
  68. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.js +0 -0
  69. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.d.ts +0 -0
  70. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.d.ts +0 -0
  71. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.d.ts +0 -0
  72. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.js +0 -0
@@ -53,6 +53,9 @@ const { fallback = 'animate' } = Astro.props;
53
53
  if (supportsViewTransitions || getFallback() !== 'none') {
54
54
  document.addEventListener('click', (ev) => {
55
55
  let link = ev.target;
56
+ if (ev.composed) {
57
+ link = ev.composedPath()[0];
58
+ }
56
59
  if (link instanceof Element) {
57
60
  link = link.closest('a, area');
58
61
  }
@@ -106,7 +109,9 @@ const { fallback = 'animate' } = Astro.props;
106
109
 
107
110
  // the "dialog" method is a special keyword used within <dialog> elements
108
111
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-method
109
- if (method === 'dialog') {
112
+ if (method === 'dialog' || location.origin !== new URL(action, location.href).origin) {
113
+ // No page transitions in these cases,
114
+ // Let the browser standard action handle this
110
115
  return;
111
116
  }
112
117
 
@@ -15,9 +15,9 @@ import type { TSConfig } from '../core/config/tsconfig.js';
15
15
  import type { AstroCookies } from '../core/cookies/index.js';
16
16
  import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
17
17
  import type { AstroPreferences } from '../preferences/index.js';
18
- import type { AstroDevOverlay, DevOverlayCanvas } from '../runtime/client/dev-overlay/overlay.js';
19
- import type { Icon } from '../runtime/client/dev-overlay/ui-library/icons.js';
20
- import type { DevOverlayBadge, DevOverlayButton, DevOverlayCard, DevOverlayHighlight, DevOverlayIcon, DevOverlayToggle, DevOverlayTooltip, DevOverlayWindow } from '../runtime/client/dev-overlay/ui-library/index.js';
18
+ import type { AstroDevToolbar, DevToolbarCanvas } from '../runtime/client/dev-toolbar/toolbar.js';
19
+ import type { Icon } from '../runtime/client/dev-toolbar/ui-library/icons.js';
20
+ import type { DevToolbarBadge, DevToolbarButton, DevToolbarCard, DevToolbarHighlight, DevToolbarIcon, DevToolbarToggle, DevToolbarTooltip, DevToolbarWindow } from '../runtime/client/dev-toolbar/ui-library/index.js';
21
21
  import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
22
22
  import type { DeepPartial, OmitIndexSignature, Simplify } from '../type-utils.js';
23
23
  import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
@@ -2082,6 +2082,7 @@ export interface AstroIntegration {
2082
2082
  addClientDirective: (directive: ClientDirectiveConfig) => void;
2083
2083
  /**
2084
2084
  * @deprecated Use `addDevToolbarApp` instead.
2085
+ * TODO: Fully remove in Astro 5.0
2085
2086
  */
2086
2087
  addDevOverlayPlugin: (entrypoint: string) => void;
2087
2088
  addDevToolbarApp: (entrypoint: string) => void;
@@ -2302,8 +2303,8 @@ export interface DevToolbarApp {
2302
2303
  beforeTogglingOff?(canvas: ShadowRoot): boolean | Promise<boolean>;
2303
2304
  }
2304
2305
  export type DevOverlayPlugin = DevToolbarApp;
2305
- export type DevOverlayMetadata = Window & typeof globalThis & {
2306
- __astro_dev_overlay__: {
2306
+ export type DevToolbarMetadata = Window & typeof globalThis & {
2307
+ __astro_dev_toolbar__: {
2307
2308
  root: string;
2308
2309
  version: string;
2309
2310
  debugInfo: string;
@@ -2311,25 +2312,25 @@ export type DevOverlayMetadata = Window & typeof globalThis & {
2311
2312
  };
2312
2313
  declare global {
2313
2314
  interface HTMLElementTagNameMap {
2314
- 'astro-dev-toolbar': AstroDevOverlay;
2315
- 'astro-dev-toolbar-window': DevOverlayWindow;
2316
- 'astro-dev-toolbar-plugin-canvas': DevOverlayCanvas;
2317
- 'astro-dev-toolbar-tooltip': DevOverlayTooltip;
2318
- 'astro-dev-toolbar-highlight': DevOverlayHighlight;
2319
- 'astro-dev-toolbar-toggle': DevOverlayToggle;
2320
- 'astro-dev-toolbar-badge': DevOverlayBadge;
2321
- 'astro-dev-toolbar-button': DevOverlayButton;
2322
- 'astro-dev-toolbar-icon': DevOverlayIcon;
2323
- 'astro-dev-toolbar-card': DevOverlayCard;
2324
- 'astro-dev-overlay': AstroDevOverlay;
2325
- 'astro-dev-overlay-window': DevOverlayWindow;
2326
- 'astro-dev-overlay-plugin-canvas': DevOverlayCanvas;
2327
- 'astro-dev-overlay-tooltip': DevOverlayTooltip;
2328
- 'astro-dev-overlay-highlight': DevOverlayHighlight;
2329
- 'astro-dev-overlay-toggle': DevOverlayToggle;
2330
- 'astro-dev-overlay-badge': DevOverlayBadge;
2331
- 'astro-dev-overlay-button': DevOverlayButton;
2332
- 'astro-dev-overlay-icon': DevOverlayIcon;
2333
- 'astro-dev-overlay-card': DevOverlayCard;
2315
+ 'astro-dev-toolbar': AstroDevToolbar;
2316
+ 'astro-dev-toolbar-window': DevToolbarWindow;
2317
+ 'astro-dev-toolbar-app-canvas': DevToolbarCanvas;
2318
+ 'astro-dev-toolbar-tooltip': DevToolbarTooltip;
2319
+ 'astro-dev-toolbar-highlight': DevToolbarHighlight;
2320
+ 'astro-dev-toolbar-toggle': DevToolbarToggle;
2321
+ 'astro-dev-toolbar-badge': DevToolbarBadge;
2322
+ 'astro-dev-toolbar-button': DevToolbarButton;
2323
+ 'astro-dev-toolbar-icon': DevToolbarIcon;
2324
+ 'astro-dev-toolbar-card': DevToolbarCard;
2325
+ 'astro-dev-overlay': AstroDevToolbar;
2326
+ 'astro-dev-overlay-window': DevToolbarWindow;
2327
+ 'astro-dev-overlay-plugin-canvas': DevToolbarCanvas;
2328
+ 'astro-dev-overlay-tooltip': DevToolbarTooltip;
2329
+ 'astro-dev-overlay-highlight': DevToolbarHighlight;
2330
+ 'astro-dev-overlay-toggle': DevToolbarToggle;
2331
+ 'astro-dev-overlay-badge': DevToolbarBadge;
2332
+ 'astro-dev-overlay-button': DevToolbarButton;
2333
+ 'astro-dev-overlay-icon': DevToolbarIcon;
2334
+ 'astro-dev-overlay-card': DevToolbarCard;
2334
2335
  }
2335
2336
  }
@@ -41,6 +41,7 @@ async function getImage(options, imageConfig) {
41
41
  ...options,
42
42
  src: typeof options.src === "object" && "then" in options.src ? (await options.src).default ?? await options.src : options.src
43
43
  };
44
+ const originalPath = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.fsPath : resolvedOptions.src;
44
45
  const clonedSrc = isESMImportedImage(resolvedOptions.src) ? (
45
46
  // @ts-expect-error - clone is a private, hidden prop
46
47
  resolvedOptions.src.clone ?? resolvedOptions.src
@@ -59,10 +60,10 @@ async function getImage(options, imageConfig) {
59
60
  );
60
61
  if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
61
62
  const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS;
62
- imageURL = globalThis.astroAsset.addStaticImage(validatedOptions, propsToHash);
63
+ imageURL = globalThis.astroAsset.addStaticImage(validatedOptions, propsToHash, originalPath);
63
64
  srcSets = srcSetTransforms.map((srcSet) => ({
64
65
  transform: srcSet.transform,
65
- url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash),
66
+ url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash, originalPath),
66
67
  descriptor: srcSet.descriptor,
67
68
  attributes: srcSet.attributes
68
69
  }));
@@ -1,10 +1,7 @@
1
1
  import { baseService } from "./service.js";
2
2
  const noopService = {
3
+ ...baseService,
3
4
  propertiesToHash: ["src"],
4
- validateOptions: baseService.validateOptions,
5
- getURL: baseService.getURL,
6
- parseURL: baseService.parseURL,
7
- getHTMLAttributes: baseService.getHTMLAttributes,
8
5
  async transform(inputBuffer, transformOptions) {
9
6
  return {
10
7
  data: inputBuffer,
@@ -15,7 +15,7 @@ export type AssetsGlobalStaticImagesList = Map<string, {
15
15
  declare global {
16
16
  var astroAsset: {
17
17
  imageService?: ImageService;
18
- addStaticImage?: ((options: ImageTransform, hashProperties: string[]) => string) | undefined;
18
+ addStaticImage?: ((options: ImageTransform, hashProperties: string[], fsPath: string) => string) | undefined;
19
19
  staticImages?: AssetsGlobalStaticImagesList;
20
20
  referencedImages?: Set<string>;
21
21
  };
@@ -22,7 +22,7 @@ async function emitESMImage(id, watchMode, fileEmitter) {
22
22
  Object.defineProperty(emittedImage, "fsPath", {
23
23
  enumerable: false,
24
24
  writable: false,
25
- value: url
25
+ value: id
26
26
  });
27
27
  if (!watchMode) {
28
28
  const pathname = decodeURI(url.pathname);
@@ -1 +1,2 @@
1
- export declare function getProxyCode(options: Record<string, any>, isSSR: boolean): string;
1
+ import type { ImageMetadata } from '../types.js';
2
+ export declare function getProxyCode(options: ImageMetadata, isSSR: boolean): string;
@@ -1,11 +1,15 @@
1
1
  function getProxyCode(options, isSSR) {
2
+ const stringifiedFSPath = JSON.stringify(options.fsPath);
2
3
  return `
3
4
  new Proxy(${JSON.stringify(options)}, {
4
5
  get(target, name, receiver) {
5
6
  if (name === 'clone') {
6
7
  return structuredClone(target);
7
8
  }
8
- ${!isSSR ? "globalThis.astroAsset.referencedImages.add(target.fsPath);" : ""}
9
+ if (name === 'fsPath') {
10
+ return ${stringifiedFSPath};
11
+ }
12
+ ${!isSSR ? `globalThis.astroAsset.referencedImages.add(${stringifiedFSPath});` : ""}
9
13
  return target[name];
10
14
  }
11
15
  })
@@ -15,7 +15,8 @@ import { isESMImportedImage } from "./utils/imageKind.js";
15
15
  import { getProxyCode } from "./utils/proxy.js";
16
16
  import { hashTransform, propsToFilename } from "./utils/transformToPath.js";
17
17
  const resolvedVirtualModuleId = "\0" + VIRTUAL_MODULE_ID;
18
- const assetRegex = new RegExp(`\\.(${VALID_INPUT_FORMATS.join("|")})$`, "i");
18
+ const assetRegex = new RegExp(`\\.(${VALID_INPUT_FORMATS.join("|")})`, "i");
19
+ const assetRegexEnds = new RegExp(`\\.(${VALID_INPUT_FORMATS.join("|")})$`, "i");
19
20
  function assets({
20
21
  settings,
21
22
  mode
@@ -67,12 +68,11 @@ function assets({
67
68
  if (mode != "build") {
68
69
  return;
69
70
  }
70
- globalThis.astroAsset.addStaticImage = (options, hashProperties) => {
71
+ globalThis.astroAsset.addStaticImage = (options, hashProperties, originalPath) => {
71
72
  if (!globalThis.astroAsset.staticImages) {
72
73
  globalThis.astroAsset.staticImages = /* @__PURE__ */ new Map();
73
74
  }
74
75
  const finalOriginalImagePath = (isESMImportedImage(options.src) ? options.src.src : options.src).replace(settings.config.build.assetsPrefix || "", "");
75
- const originalSrcPath = isESMImportedImage(options.src) ? options.src.fsPath : options.src;
76
76
  const hash = hashTransform(
77
77
  options,
78
78
  settings.config.image.service.entrypoint,
@@ -89,7 +89,7 @@ function assets({
89
89
  );
90
90
  if (!transformsForPath) {
91
91
  globalThis.astroAsset.staticImages.set(finalOriginalImagePath, {
92
- originalSrcPath,
92
+ originalSrcPath: originalPath,
93
93
  transforms: /* @__PURE__ */ new Map()
94
94
  });
95
95
  transformsForPath = globalThis.astroAsset.staticImages.get(finalOriginalImagePath);
@@ -137,24 +137,31 @@ function assets({
137
137
  resolvedConfig = viteConfig;
138
138
  },
139
139
  async load(id, options) {
140
- if (id !== removeQueryString(id)) {
141
- return;
142
- }
143
140
  if (assetRegex.test(id)) {
144
- const meta = await emitESMImage(id, this.meta.watchMode, this.emitFile);
145
- if (!meta) {
141
+ if (!globalThis.astroAsset.referencedImages)
142
+ globalThis.astroAsset.referencedImages = /* @__PURE__ */ new Set();
143
+ if (id !== removeQueryString(id)) {
144
+ globalThis.astroAsset.referencedImages.add(removeQueryString(id));
145
+ return;
146
+ }
147
+ if (!assetRegexEnds.test(id)) {
148
+ return;
149
+ }
150
+ const imageMetadata = await emitESMImage(id, this.meta.watchMode, this.emitFile);
151
+ if (!imageMetadata) {
146
152
  throw new AstroError({
147
153
  ...AstroErrorData.ImageNotFound,
148
154
  message: AstroErrorData.ImageNotFound.message(id)
149
155
  });
150
156
  }
151
157
  if (options?.ssr) {
152
- return `export default ${getProxyCode(meta, isServerLikeOutput(settings.config))}`;
158
+ return `export default ${getProxyCode(
159
+ imageMetadata,
160
+ isServerLikeOutput(settings.config)
161
+ )}`;
153
162
  } else {
154
- if (!globalThis.astroAsset.referencedImages)
155
- globalThis.astroAsset.referencedImages = /* @__PURE__ */ new Set();
156
- globalThis.astroAsset.referencedImages.add(meta.fsPath);
157
- return `export default ${JSON.stringify(meta)}`;
163
+ globalThis.astroAsset.referencedImages.add(imageMetadata.fsPath);
164
+ return `export default ${JSON.stringify(imageMetadata)}`;
158
165
  }
159
166
  }
160
167
  }
@@ -1,7 +1,7 @@
1
1
  import type { PluginContext } from 'rollup';
2
2
  import { z } from 'zod';
3
3
  export declare function createImage(pluginContext: PluginContext, entryFilePath: string): () => z.ZodEffects<z.ZodString, z.ZodNever | {
4
- ASTRO_ASSET: boolean;
4
+ ASTRO_ASSET: string;
5
5
  src: string;
6
6
  width: number;
7
7
  height: number;
@@ -17,7 +17,7 @@ function createImage(pluginContext, entryFilePath) {
17
17
  });
18
18
  return z.never();
19
19
  }
20
- return { ...metadata, ASTRO_ASSET: true };
20
+ return { ...metadata, ASTRO_ASSET: metadata.fsPath };
21
21
  });
22
22
  };
23
23
  }
@@ -268,6 +268,7 @@ function stringifyEntryData(data, isSSR) {
268
268
  }
269
269
  if (typeof value === "object" && "ASTRO_ASSET" in value) {
270
270
  const { ASTRO_ASSET, ...asset } = value;
271
+ asset.fsPath = ASTRO_ASSET;
271
272
  return getProxyCode(asset, isSSR);
272
273
  }
273
274
  });
@@ -4,7 +4,7 @@ import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
4
4
  import { debug } from "../logger/core.js";
5
5
  async function createViteServer(root, fs) {
6
6
  const viteServer = await createServer({
7
- server: { middlewareMode: true, hmr: false, watch: { ignored: ["**"] } },
7
+ server: { middlewareMode: true, hmr: false, watch: null },
8
8
  optimizeDeps: { disabled: true },
9
9
  clearScreen: false,
10
10
  appType: "custom",
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.1.2";
1
+ const ASTRO_VERSION = "4.1.3";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -15,8 +15,9 @@ import astroPostprocessVitePlugin from "../vite-plugin-astro-postprocess/index.j
15
15
  import { vitePluginAstroServer } from "../vite-plugin-astro-server/index.js";
16
16
  import astroVitePlugin from "../vite-plugin-astro/index.js";
17
17
  import configAliasVitePlugin from "../vite-plugin-config-alias/index.js";
18
- import astroDevOverlay from "../vite-plugin-dev-overlay/vite-plugin-dev-overlay.js";
18
+ import astroDevToolbar from "../vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js";
19
19
  import envVitePlugin from "../vite-plugin-env/index.js";
20
+ import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
20
21
  import astroHeadPlugin from "../vite-plugin-head/index.js";
21
22
  import htmlVitePlugin from "../vite-plugin-html/index.js";
22
23
  import { astroInjectEnvTsPlugin } from "../vite-plugin-inject-env-ts/index.js";
@@ -31,7 +32,6 @@ import { vitePluginSSRManifest } from "../vite-plugin-ssr-manifest/index.js";
31
32
  import { createViteLogger } from "./logger/vite.js";
32
33
  import { vitePluginMiddleware } from "./middleware/vite-plugin.js";
33
34
  import { joinPaths } from "./path.js";
34
- import vitePluginFileURL from "../vite-plugin-fileurl/index.js";
35
35
  const ALWAYS_NOEXTERNAL = [
36
36
  // This is only because Vite's native ESM doesn't resolve "exports" correctly.
37
37
  "astro",
@@ -113,7 +113,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
113
113
  astroAssetsPlugin({ settings, logger, mode }),
114
114
  astroPrefetch({ settings }),
115
115
  astroTransitions({ settings }),
116
- astroDevOverlay({ settings, logger }),
116
+ astroDevToolbar({ settings, logger }),
117
117
  vitePluginFileURL({}),
118
118
  !!settings.config.i18n && astroInternationalization({ settings })
119
119
  ],
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.1.2";
26
+ const currentVersion = "4.1.3";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -893,6 +893,11 @@ export declare const MissingLocale: {
893
893
  title: string;
894
894
  message: (locale: string) => string;
895
895
  };
896
+ export declare const MissingIndexForInternationalization: {
897
+ name: string;
898
+ title: string;
899
+ message: (src: string) => string;
900
+ };
896
901
  /**
897
902
  * @docs
898
903
  * @description
@@ -313,6 +313,12 @@ const MissingLocale = {
313
313
  title: "The provided locale does not exist.",
314
314
  message: (locale) => `The locale/path \`${locale}\` does not exist in the configured \`i18n.locales\`.`
315
315
  };
316
+ const MissingIndexForInternationalization = {
317
+ name: "MissingIndexForInternationalizationError",
318
+ title: "Index page not found.",
319
+ message: (src) => `Astro couldn't find the index URL. This index page is required to create a redirect from the index URL to the index URL of the default locale.
320
+ Create an index page in \`${src}\``
321
+ };
316
322
  const CantRenderPage = {
317
323
  name: "CantRenderPage",
318
324
  title: "Astro can't render the route.",
@@ -502,6 +508,7 @@ export {
502
508
  MiddlewareNoDataOrNextCalled,
503
509
  MiddlewareNotAResponse,
504
510
  MissingImageDimension,
511
+ MissingIndexForInternationalization,
505
512
  MissingLocale,
506
513
  MissingMediaQueryDirective,
507
514
  MissingSharp,
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.1.2";
39
+ const version = "4.1.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.1.2"}`
261
+ `v${"4.1.3"}`
262
262
  )} ${headline}`
263
263
  );
264
264
  }
@@ -8,6 +8,8 @@ import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "../../constants.js";
8
8
  import { removeLeadingForwardSlash, slash } from "../../path.js";
9
9
  import { resolvePages } from "../../util.js";
10
10
  import { getRouteGenerator } from "./generator.js";
11
+ import { AstroError } from "../../errors/index.js";
12
+ import { MissingIndexForInternationalization } from "../../errors/errors-data.js";
11
13
  const require2 = createRequire(import.meta.url);
12
14
  function countOccurrences(needle, haystack) {
13
15
  let count = 0;
@@ -362,6 +364,19 @@ This route collides with: "${collision.component}".`
362
364
  });
363
365
  const i18n = settings.config.i18n;
364
366
  if (i18n) {
367
+ if (i18n.routing === "prefix-always") {
368
+ let index = routes.find((route) => route.route === "/");
369
+ if (!index) {
370
+ let relativePath = path.relative(
371
+ fileURLToPath(settings.config.root),
372
+ fileURLToPath(new URL("pages", settings.config.srcDir))
373
+ );
374
+ throw new AstroError({
375
+ ...MissingIndexForInternationalization,
376
+ message: MissingIndexForInternationalization.message(relativePath)
377
+ });
378
+ }
379
+ }
365
380
  const routesByLocale = /* @__PURE__ */ new Map();
366
381
  const setRoutes = new Set(routes.filter((route) => route.type === "page"));
367
382
  const filteredLocales = i18n.locales.filter((loc) => {
@@ -34,7 +34,7 @@ async function syncInternal(settings, { logger, fs }) {
34
34
  const tempViteServer = await createServer(
35
35
  await createVite(
36
36
  {
37
- server: { middlewareMode: true, hmr: false, watch: { ignored: ["**"] } },
37
+ server: { middlewareMode: true, hmr: false, watch: null },
38
38
  optimizeDeps: { disabled: true },
39
39
  ssr: { external: [] },
40
40
  logLevel: "silent"
@@ -291,7 +291,7 @@ var astro_default = {
291
291
  <header>
292
292
  <section>
293
293
  ${astroLogo}
294
- <astro-dev-toolbar-badge badge-style="gray" size="large">${window.__astro_dev_overlay__.version}</astro-dev-toolbar-badge>
294
+ <astro-dev-toolbar-badge badge-style="gray" size="large">${window.__astro_dev_toolbar__.version}</astro-dev-toolbar-badge>
295
295
  </section>
296
296
  <astro-dev-toolbar-button id="copy-debug-button">Copy debug info <astro-dev-toolbar-icon icon="copy" /></astro-dev-toolbar-button>
297
297
  </header>
@@ -321,7 +321,7 @@ var astro_default = {
321
321
  const copyDebugButton = windowComponent.querySelector("#copy-debug-button");
322
322
  copyDebugButton?.addEventListener("click", () => {
323
323
  navigator.clipboard.writeText(
324
- "```\n" + window.__astro_dev_overlay__.debugInfo + "\n```"
324
+ "```\n" + window.__astro_dev_toolbar__.debugInfo + "\n```"
325
325
  );
326
326
  copyDebugButton.textContent = "Copied to clipboard!";
327
327
  setTimeout(() => {
@@ -37,7 +37,7 @@ var audit_default = {
37
37
  if (target.closest("astro-dev-toolbar"))
38
38
  return;
39
39
  eventTarget.dispatchEvent(
40
- new CustomEvent("toggle-plugin", {
40
+ new CustomEvent("toggle-app", {
41
41
  detail: {
42
42
  state: false
43
43
  }
@@ -132,7 +132,7 @@ var audit_default = {
132
132
  function refreshLintPositions() {
133
133
  const noAuditBlock = canvas.getElementById("no-audit");
134
134
  if (noAuditBlock) {
135
- const devOverlayRect = document.querySelector("astro-dev-toolbar")?.shadowRoot.querySelector("#dev-overlay")?.getBoundingClientRect();
135
+ const devOverlayRect = document.querySelector("astro-dev-toolbar")?.shadowRoot.querySelector("#dev-toolbar-root")?.getBoundingClientRect();
136
136
  noAuditBlock.style.top = `${(devOverlayRect?.top ?? 0) - (devOverlayRect?.height ?? 0) - 16}px`;
137
137
  }
138
138
  audits.forEach(({ highlightElement, auditedElement }) => {
@@ -178,7 +178,7 @@ var audit_default = {
178
178
  const elementFileWithPosition = elementFile + (elementPosition ? ":" + elementPosition : "");
179
179
  tooltip.sections.push({
180
180
  content: elementFileWithPosition.slice(
181
- window.__astro_dev_overlay__.root.length - 1
181
+ window.__astro_dev_toolbar__.root.length - 1
182
182
  // We want to keep the final slash, so minus one.
183
183
  ),
184
184
  clickDescription: "Click to go to file",
@@ -5,22 +5,22 @@ const settingsRows = [
5
5
  name: "Disable notifications",
6
6
  description: "Hide notification badges in the toolbar.",
7
7
  input: "checkbox",
8
- settingKey: "disablePluginNotification",
8
+ settingKey: "disableAppNotification",
9
9
  changeEvent: (evt) => {
10
10
  if (evt.currentTarget instanceof HTMLInputElement) {
11
- const devOverlay = document.querySelector("astro-dev-toolbar");
12
- if (devOverlay) {
13
- devOverlay.setNotificationVisible(!evt.currentTarget.checked);
11
+ const devToolbar = document.querySelector("astro-dev-toolbar");
12
+ if (devToolbar) {
13
+ devToolbar.setNotificationVisible(!evt.currentTarget.checked);
14
14
  }
15
- settings.updateSetting("disablePluginNotification", evt.currentTarget.checked);
15
+ settings.updateSetting("disableAppNotification", evt.currentTarget.checked);
16
16
  const action = evt.currentTarget.checked ? "disabled" : "enabled";
17
- settings.log(`Plugin notification badges ${action}`);
17
+ settings.log(`App notification badges ${action}`);
18
18
  }
19
19
  }
20
20
  },
21
21
  {
22
22
  name: "Verbose logging",
23
- description: "Logs dev overlay events in the browser console.",
23
+ description: "Logs dev toolbar events in the browser console.",
24
24
  input: "checkbox",
25
25
  settingKey: "verbose",
26
26
  changeEvent: (evt) => {
@@ -0,0 +1,8 @@
1
+ import type { DevToolbarHighlight } from '../../ui-library/highlight.js';
2
+ import type { Icon } from '../../ui-library/icons.js';
3
+ export declare function createHighlight(rect: DOMRect, icon?: Icon): DevToolbarHighlight;
4
+ export declare function getElementsPositionInDocument(el: Element): {
5
+ isFixed: boolean;
6
+ };
7
+ export declare function positionHighlight(highlight: DevToolbarHighlight, rect: DOMRect): void;
8
+ export declare function attachTooltipToHighlight(highlight: DevToolbarHighlight, tooltip: HTMLElement, originalElement: Element): void;
@@ -1 +1 @@
1
- export declare function createWindowElement(content: string): import("../../ui-library/window.js").DevOverlayWindow;
1
+ export declare function createWindowElement(content: string): import("../../ui-library/window.js").DevToolbarWindow;
@@ -26,7 +26,7 @@ var xray_default = {
26
26
  event.preventDefault();
27
27
  event.stopPropagation();
28
28
  eventTarget.dispatchEvent(
29
- new CustomEvent("toggle-plugin", {
29
+ new CustomEvent("toggle-app", {
30
30
  detail: {
31
31
  state: false
32
32
  }
@@ -52,7 +52,7 @@ var xray_default = {
52
52
  header {
53
53
  display: flex;
54
54
  }
55
-
55
+
56
56
  h1 {
57
57
  display: flex;
58
58
  align-items: center;
@@ -62,7 +62,7 @@ var xray_default = {
62
62
  margin: 0;
63
63
  font-size: 22px;
64
64
  }
65
-
65
+
66
66
  astro-dev-toolbar-icon {
67
67
  width: 1em;
68
68
  height: 1em;
@@ -142,7 +142,7 @@ var xray_default = {
142
142
  async clickAction() {
143
143
  await fetch(
144
144
  "/__open-in-editor?file=" + encodeURIComponent(
145
- window.__astro_dev_overlay__.root + islandComponentPath.slice(1)
145
+ window.__astro_dev_toolbar__.root + islandComponentPath.slice(1)
146
146
  )
147
147
  );
148
148
  }