astro 5.6.0 → 5.6.2

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 (46) hide show
  1. package/dist/actions/plugins.js +1 -1
  2. package/dist/assets/utils/index.d.ts +5 -1
  3. package/dist/assets/utils/index.js +5 -1
  4. package/dist/assets/utils/node/emitAsset.d.ts +8 -0
  5. package/dist/assets/utils/node/emitAsset.js +45 -3
  6. package/dist/assets/vite-plugin-assets.d.ts +3 -1
  7. package/dist/assets/vite-plugin-assets.js +36 -30
  8. package/dist/cli/add/index.js +3 -1
  9. package/dist/cli/install-package.js +3 -0
  10. package/dist/content/content-layer.js +3 -3
  11. package/dist/content/utils.d.ts +10 -10
  12. package/dist/content/vite-plugin-content-virtual-mod.js +7 -9
  13. package/dist/core/build/plugins/plugin-component-entry.js +3 -1
  14. package/dist/core/build/plugins/plugin-manifest.js +1 -1
  15. package/dist/core/build/plugins/plugin-pages.js +1 -1
  16. package/dist/core/build/plugins/plugin-renderers.js +3 -3
  17. package/dist/core/build/plugins/plugin-ssr.js +2 -2
  18. package/dist/core/config/schemas/base.d.ts +10 -10
  19. package/dist/core/config/schemas/base.js +1 -0
  20. package/dist/core/config/schemas/refined.js +0 -7
  21. package/dist/core/config/schemas/relative.d.ts +14 -14
  22. package/dist/core/constants.js +1 -1
  23. package/dist/core/create-vite.js +1 -1
  24. package/dist/core/dev/dev.js +1 -1
  25. package/dist/core/messages.js +2 -2
  26. package/dist/core/middleware/vite-plugin.js +3 -3
  27. package/dist/core/render-context.js +1 -0
  28. package/dist/core/server-islands/vite-plugin-server-islands.js +1 -1
  29. package/dist/env/schema.d.ts +6 -6
  30. package/dist/env/vite-plugin-env.js +3 -3
  31. package/dist/integrations/hooks.js +3 -0
  32. package/dist/manifest/virtual-module.js +2 -2
  33. package/dist/prefetch/vite-plugin-prefetch.js +1 -1
  34. package/dist/runtime/server/render/common.js +8 -0
  35. package/dist/runtime/server/render/instruction.d.ts +5 -5
  36. package/dist/runtime/server/render/server-islands.d.ts +1 -0
  37. package/dist/runtime/server/render/server-islands.js +29 -31
  38. package/dist/toolbar/vite-plugin-dev-toolbar.js +41 -39
  39. package/dist/transitions/swap-functions.d.ts +1 -1
  40. package/dist/transitions/swap-functions.js +7 -6
  41. package/dist/transitions/vite-plugin-transitions.js +22 -18
  42. package/dist/types/public/internal.d.ts +1 -0
  43. package/dist/vite-plugin-load-fallback/index.js +4 -2
  44. package/dist/vite-plugin-scripts/index.js +9 -3
  45. package/dist/vite-plugin-ssr-manifest/index.js +4 -3
  46. package/package.json +3 -3
@@ -95,7 +95,7 @@ export * from 'astro/actions/runtime/virtual/client.js';`;
95
95
  shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format)
96
96
  )
97
97
  );
98
- return code;
98
+ return { code };
99
99
  }
100
100
  };
101
101
  }
@@ -4,7 +4,11 @@
4
4
  *
5
5
  * If some functions don't need to be exposed, just import the file that contains the functions.
6
6
  */
7
- export { emitESMImage } from './node/emitAsset.js';
7
+ export {
8
+ /**
9
+ * @deprecated
10
+ */
11
+ emitESMImage, emitImageMetadata, } from './node/emitAsset.js';
8
12
  export { isESMImportedImage, isRemoteImage } from './imageKind.js';
9
13
  export { imageMetadata } from './metadata.js';
10
14
  export { getOrigQueryParams } from './queryParams.js';
@@ -1,4 +1,7 @@
1
- import { emitESMImage } from "./node/emitAsset.js";
1
+ import {
2
+ emitESMImage,
3
+ emitImageMetadata
4
+ } from "./node/emitAsset.js";
2
5
  import { isESMImportedImage, isRemoteImage } from "./imageKind.js";
3
6
  import { imageMetadata } from "./metadata.js";
4
7
  import { getOrigQueryParams } from "./queryParams.js";
@@ -14,6 +17,7 @@ import {
14
17
  } from "./remotePattern.js";
15
18
  export {
16
19
  emitESMImage,
20
+ emitImageMetadata,
17
21
  getOrigQueryParams,
18
22
  hashTransform,
19
23
  imageMetadata,
@@ -16,4 +16,12 @@ type ImageMetadataWithContents = ImageMetadata & {
16
16
  export declare function emitESMImage(id: string | undefined,
17
17
  /** @deprecated */
18
18
  _watchMode: boolean, experimentalSvgEnabled: boolean, fileEmitter?: FileEmitter): Promise<ImageMetadataWithContents | undefined>;
19
+ /**
20
+ * Processes an image file and emits its metadata and optionally its contents. This function supports both build and development modes.
21
+ *
22
+ * @param {string | undefined} id - The identifier or path of the image file to process. If undefined, the function returns immediately.
23
+ * @param {FileEmitter | undefined} [fileEmitter] - Function for emitting files during the build process. May throw in certain scenarios.
24
+ * @return {Promise<ImageMetadataWithContents | undefined>} Resolves to metadata with optional image contents or `undefined` if processing fails.
25
+ */
26
+ export declare function emitImageMetadata(id: string | undefined, fileEmitter?: FileEmitter): Promise<ImageMetadataWithContents | undefined>;
19
27
  export {};
@@ -24,9 +24,50 @@ async function emitESMImage(id, _watchMode, experimentalSvgEnabled, fileEmitter)
24
24
  writable: false,
25
25
  value: id
26
26
  });
27
- if (fileMetadata.format === "svg" && experimentalSvgEnabled) {
28
- emittedImage.contents = fileData;
27
+ let isBuild = typeof fileEmitter === "function";
28
+ if (isBuild) {
29
+ const pathname = decodeURI(url.pathname);
30
+ const filename = path.basename(pathname, path.extname(pathname) + `.${fileMetadata.format}`);
31
+ try {
32
+ const handle = fileEmitter({
33
+ name: filename,
34
+ source: await fs.readFile(url),
35
+ type: "asset"
36
+ });
37
+ emittedImage.src = `__ASTRO_ASSET_IMAGE__${handle}__`;
38
+ } catch {
39
+ isBuild = false;
40
+ }
41
+ }
42
+ if (!isBuild) {
43
+ url.searchParams.append("origWidth", fileMetadata.width.toString());
44
+ url.searchParams.append("origHeight", fileMetadata.height.toString());
45
+ url.searchParams.append("origFormat", fileMetadata.format);
46
+ emittedImage.src = `/@fs` + prependForwardSlash(fileURLToNormalizedPath(url));
47
+ }
48
+ return emittedImage;
49
+ }
50
+ async function emitImageMetadata(id, fileEmitter) {
51
+ if (!id) {
52
+ return void 0;
53
+ }
54
+ const url = pathToFileURL(id);
55
+ let fileData;
56
+ try {
57
+ fileData = await fs.readFile(url);
58
+ } catch {
59
+ return void 0;
29
60
  }
61
+ const fileMetadata = await imageMetadata(fileData, id);
62
+ const emittedImage = {
63
+ src: "",
64
+ ...fileMetadata
65
+ };
66
+ Object.defineProperty(emittedImage, "fsPath", {
67
+ enumerable: false,
68
+ writable: false,
69
+ value: id
70
+ });
30
71
  let isBuild = typeof fileEmitter === "function";
31
72
  if (isBuild) {
32
73
  const pathname = decodeURI(url.pathname);
@@ -54,5 +95,6 @@ function fileURLToNormalizedPath(filePath) {
54
95
  return slash(fileURLToPath(filePath) + filePath.search).replace(/\\/g, "/");
55
96
  }
56
97
  export {
57
- emitESMImage
98
+ emitESMImage,
99
+ emitImageMetadata
58
100
  };
@@ -1,5 +1,7 @@
1
+ import type * as fsMod from 'node:fs';
1
2
  import type * as vite from 'vite';
2
3
  import type { AstroSettings } from '../types/astro.js';
3
- export default function assets({ settings }: {
4
+ export default function assets({ fs, settings, }: {
5
+ fs: typeof fsMod;
4
6
  settings: AstroSettings;
5
7
  }): vite.Plugin[];
@@ -63,7 +63,10 @@ const addStaticImageFactory = (settings) => {
63
63
  }
64
64
  };
65
65
  };
66
- function assets({ settings }) {
66
+ function assets({
67
+ fs,
68
+ settings
69
+ }) {
67
70
  let resolvedConfig;
68
71
  let shouldEmitFile = false;
69
72
  let isBuild = false;
@@ -88,33 +91,32 @@ function assets({ settings }) {
88
91
  },
89
92
  load(id) {
90
93
  if (id === resolvedVirtualModuleId) {
91
- return (
92
- /* ts */
93
- `
94
- export { getConfiguredImageService, isLocalService } from "astro/assets";
95
- import { getImage as getImageInternal } from "astro/assets";
96
- export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
97
- export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
98
- export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
94
+ return {
95
+ code: `
96
+ export { getConfiguredImageService, isLocalService } from "astro/assets";
97
+ import { getImage as getImageInternal } from "astro/assets";
98
+ export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
99
+ export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
100
+ export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
99
101
 
100
- export const imageConfig = ${JSON.stringify({ ...settings.config.image, experimentalResponsiveImages: settings.config.experimental.responsiveImages })};
101
- // This is used by the @astrojs/node integration to locate images.
102
- // It's unused on other platforms, but on some platforms like Netlify (and presumably also Vercel)
103
- // new URL("dist/...") is interpreted by the bundler as a signal to include that directory
104
- // in the Lambda bundle, which would bloat the bundle with images.
105
- // To prevent this, we mark the URL construction as pure,
106
- // so that it's tree-shaken away for all platforms that don't need it.
107
- export const outDir = /* #__PURE__ */ new URL(${JSON.stringify(
102
+ export const imageConfig = ${JSON.stringify({ ...settings.config.image, experimentalResponsiveImages: settings.config.experimental.responsiveImages })};
103
+ // This is used by the @astrojs/node integration to locate images.
104
+ // It's unused on other platforms, but on some platforms like Netlify (and presumably also Vercel)
105
+ // new URL("dist/...") is interpreted by the bundler as a signal to include that directory
106
+ // in the Lambda bundle, which would bloat the bundle with images.
107
+ // To prevent this, we mark the URL construction as pure,
108
+ // so that it's tree-shaken away for all platforms that don't need it.
109
+ export const outDir = /* #__PURE__ */ new URL(${JSON.stringify(
108
110
  new URL(
109
111
  settings.buildOutput === "server" ? settings.config.build.client : settings.config.outDir
110
112
  )
111
113
  )});
112
- export const assetsDir = /* #__PURE__ */ new URL(${JSON.stringify(
114
+ export const assetsDir = /* #__PURE__ */ new URL(${JSON.stringify(
113
115
  settings.config.build.assets
114
116
  )}, outDir);
115
- export const getImage = async (options) => await getImageInternal(options, imageConfig);
116
- `
117
- );
117
+ export const getImage = async (options) => await getImageInternal(options, imageConfig);
118
+ `
119
+ };
118
120
  }
119
121
  },
120
122
  buildStart() {
@@ -123,7 +125,7 @@ function assets({ settings }) {
123
125
  },
124
126
  // In build, rewrite paths to ESM imported images in code to their final location
125
127
  async renderChunk(code) {
126
- const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]{8})__(?:_(.*?)__)?/g;
128
+ const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]+)__(?:_(.*?)__)?/g;
127
129
  let match;
128
130
  let s;
129
131
  while (match = assetUrlRE.exec(code)) {
@@ -167,7 +169,7 @@ function assets({ settings }) {
167
169
  if (!assetRegexEnds.test(id)) {
168
170
  return;
169
171
  }
170
- const emitFile = shouldEmitFile ? this.emitFile : void 0;
172
+ const emitFile = shouldEmitFile ? this.emitFile.bind(this) : void 0;
171
173
  const imageMetadata = await emitESMImage(
172
174
  id,
173
175
  this.meta.watchMode,
@@ -181,17 +183,21 @@ function assets({ settings }) {
181
183
  });
182
184
  }
183
185
  if (settings.config.experimental.svg && /\.svg$/.test(id)) {
184
- const { contents, ...metadata } = imageMetadata;
185
- return makeSvgComponent(metadata, contents);
186
+ const contents = await fs.promises.readFile(imageMetadata.fsPath, { encoding: "utf8" });
187
+ return { code: makeSvgComponent(imageMetadata, contents) };
186
188
  }
187
189
  if (options?.ssr) {
188
- return `export default ${getProxyCode(
189
- imageMetadata,
190
- settings.buildOutput === "server"
191
- )}`;
190
+ return {
191
+ code: `export default ${getProxyCode(
192
+ imageMetadata,
193
+ settings.buildOutput === "server"
194
+ )}`
195
+ };
192
196
  } else {
193
197
  globalThis.astroAsset.referencedImages.add(imageMetadata.fsPath);
194
- return `export default ${JSON.stringify(imageMetadata)}`;
198
+ return {
199
+ code: `export default ${JSON.stringify(imageMetadata)}`
200
+ };
195
201
  }
196
202
  }
197
203
  }
@@ -545,7 +545,9 @@ async function tryToInstallIntegrations({
545
545
  }).filter(Boolean).flat();
546
546
  const installCommand = resolveCommand(packageManager?.agent ?? "npm", "add", inheritedFlags);
547
547
  if (!installCommand) return 0 /* none */;
548
- const installSpecifiers = await convertIntegrationsToInstallSpecifiers(integrations);
548
+ const installSpecifiers = await convertIntegrationsToInstallSpecifiers(integrations).then(
549
+ (specifiers) => installCommand.command === "deno" ? specifiers.map((specifier) => `npm:${specifier}`) : specifiers
550
+ );
549
551
  const coloredOutput = `${bold(installCommand.command)} ${installCommand.args.join(" ")} ${cyan(installSpecifiers.join(" "))}`;
550
552
  const message = `
551
553
  ${boxen(coloredOutput, {
@@ -43,6 +43,9 @@ async function installPackage(packageNames, options, logger) {
43
43
  });
44
44
  const installCommand = resolveCommand(packageManager?.agent ?? "npm", "add", []);
45
45
  if (!installCommand) return false;
46
+ if (installCommand.command === "deno") {
47
+ packageNames = packageNames.map((name) => `npm:${name}`);
48
+ }
46
49
  const coloredOutput = `${bold(installCommand.command)} ${installCommand.args.join(" ")} ${cyan(packageNames.join(" "))}`;
47
50
  const message = `
48
51
  ${boxen(coloredOutput, {
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
153
153
  logger.info("Content config changed");
154
154
  shouldClear = true;
155
155
  }
156
- if (previousAstroVersion && previousAstroVersion !== "5.6.0") {
156
+ if (previousAstroVersion && previousAstroVersion !== "5.6.2") {
157
157
  logger.info("Astro version changed");
158
158
  shouldClear = true;
159
159
  }
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
161
161
  logger.info("Clearing content store");
162
162
  this.#store.clearAll();
163
163
  }
164
- if ("5.6.0") {
165
- await this.#store.metaStore().set("astro-version", "5.6.0");
164
+ if ("5.6.2") {
165
+ await this.#store.metaStore().set("astro-version", "5.6.2");
166
166
  }
167
167
  if (currentConfigDigest) {
168
168
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -106,8 +106,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
106
106
  refreshContextData?: Record<string, unknown> | undefined;
107
107
  }) => unknown;
108
108
  name: string;
109
- render?: ((args_0: any) => unknown) | undefined;
110
109
  schema?: any;
110
+ render?: ((args_0: any) => unknown) | undefined;
111
111
  }, {
112
112
  load: (args_0: {
113
113
  collection: string;
@@ -122,8 +122,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
122
122
  refreshContextData?: Record<string, unknown> | undefined;
123
123
  }) => unknown;
124
124
  name: string;
125
- render?: ((args_0: any) => unknown) | undefined;
126
125
  schema?: any;
126
+ render?: ((args_0: any) => unknown) | undefined;
127
127
  }>]>;
128
128
  /** deprecated */
129
129
  _legacy: z.ZodOptional<z.ZodBoolean>;
@@ -143,8 +143,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
143
143
  refreshContextData?: Record<string, unknown> | undefined;
144
144
  }) => unknown;
145
145
  name: string;
146
- render?: ((args_0: any) => unknown) | undefined;
147
146
  schema?: any;
147
+ render?: ((args_0: any) => unknown) | undefined;
148
148
  };
149
149
  schema?: any;
150
150
  _legacy?: boolean | undefined;
@@ -164,8 +164,8 @@ declare const collectionConfigParser: z.ZodUnion<[z.ZodObject<{
164
164
  refreshContextData?: Record<string, unknown> | undefined;
165
165
  }) => unknown;
166
166
  name: string;
167
- render?: ((args_0: any) => unknown) | undefined;
168
167
  schema?: any;
168
+ render?: ((args_0: any) => unknown) | undefined;
169
169
  };
170
170
  schema?: any;
171
171
  _legacy?: boolean | undefined;
@@ -244,8 +244,8 @@ declare const contentConfigParser: z.ZodObject<{
244
244
  refreshContextData?: Record<string, unknown> | undefined;
245
245
  }) => unknown;
246
246
  name: string;
247
- render?: ((args_0: any) => unknown) | undefined;
248
247
  schema?: any;
248
+ render?: ((args_0: any) => unknown) | undefined;
249
249
  }, {
250
250
  load: (args_0: {
251
251
  collection: string;
@@ -260,8 +260,8 @@ declare const contentConfigParser: z.ZodObject<{
260
260
  refreshContextData?: Record<string, unknown> | undefined;
261
261
  }) => unknown;
262
262
  name: string;
263
- render?: ((args_0: any) => unknown) | undefined;
264
263
  schema?: any;
264
+ render?: ((args_0: any) => unknown) | undefined;
265
265
  }>]>;
266
266
  /** deprecated */
267
267
  _legacy: z.ZodOptional<z.ZodBoolean>;
@@ -281,8 +281,8 @@ declare const contentConfigParser: z.ZodObject<{
281
281
  refreshContextData?: Record<string, unknown> | undefined;
282
282
  }) => unknown;
283
283
  name: string;
284
- render?: ((args_0: any) => unknown) | undefined;
285
284
  schema?: any;
285
+ render?: ((args_0: any) => unknown) | undefined;
286
286
  };
287
287
  schema?: any;
288
288
  _legacy?: boolean | undefined;
@@ -302,8 +302,8 @@ declare const contentConfigParser: z.ZodObject<{
302
302
  refreshContextData?: Record<string, unknown> | undefined;
303
303
  }) => unknown;
304
304
  name: string;
305
- render?: ((args_0: any) => unknown) | undefined;
306
305
  schema?: any;
306
+ render?: ((args_0: any) => unknown) | undefined;
307
307
  };
308
308
  schema?: any;
309
309
  _legacy?: boolean | undefined;
@@ -331,8 +331,8 @@ declare const contentConfigParser: z.ZodObject<{
331
331
  refreshContextData?: Record<string, unknown> | undefined;
332
332
  }) => unknown;
333
333
  name: string;
334
- render?: ((args_0: any) => unknown) | undefined;
335
334
  schema?: any;
335
+ render?: ((args_0: any) => unknown) | undefined;
336
336
  };
337
337
  schema?: any;
338
338
  _legacy?: boolean | undefined;
@@ -360,8 +360,8 @@ declare const contentConfigParser: z.ZodObject<{
360
360
  refreshContextData?: Record<string, unknown> | undefined;
361
361
  }) => unknown;
362
362
  name: string;
363
- render?: ((args_0: any) => unknown) | undefined;
364
363
  schema?: any;
364
+ render?: ((args_0: any) => unknown) | undefined;
365
365
  };
366
366
  schema?: any;
367
367
  _legacy?: boolean | undefined;
@@ -122,7 +122,7 @@ function astroContentVirtualModPlugin({
122
122
  }
123
123
  if (id === RESOLVED_DATA_STORE_VIRTUAL_ID) {
124
124
  if (!fs.existsSync(dataStoreFile)) {
125
- return "export default new Map()";
125
+ return { code: "export default new Map()" };
126
126
  }
127
127
  const jsonData = await fs.promises.readFile(dataStoreFile, "utf-8");
128
128
  try {
@@ -140,17 +140,15 @@ function astroContentVirtualModPlugin({
140
140
  }
141
141
  if (id === ASSET_IMPORTS_RESOLVED_STUB_ID) {
142
142
  const assetImportsFile = new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir);
143
- if (!fs.existsSync(assetImportsFile)) {
144
- return "export default new Map()";
145
- }
146
- return fs.readFileSync(assetImportsFile, "utf-8");
143
+ return {
144
+ code: fs.existsSync(assetImportsFile) ? fs.readFileSync(assetImportsFile, "utf-8") : "export default new Map()"
145
+ };
147
146
  }
148
147
  if (id === MODULES_MJS_VIRTUAL_ID) {
149
148
  const modules = new URL(MODULES_IMPORTS_FILE, settings.dotAstroDir);
150
- if (!fs.existsSync(modules)) {
151
- return "export default new Map()";
152
- }
153
- return fs.readFileSync(modules, "utf-8");
149
+ return {
150
+ code: fs.existsSync(modules) ? fs.readFileSync(modules, "utf-8") : "export default new Map()"
151
+ };
154
152
  }
155
153
  },
156
154
  configureServer(server) {
@@ -44,7 +44,9 @@ function vitePluginComponentEntry(internals) {
44
44
  const componentId = id.slice(astroEntryPrefix.length);
45
45
  const exportNames = componentToExportNames.get(componentId);
46
46
  if (exportNames) {
47
- return `export { ${exportNames.join(", ")} } from ${JSON.stringify(componentId)}`;
47
+ return {
48
+ code: `export { ${exportNames.join(", ")} } from ${JSON.stringify(componentId)}`
49
+ };
48
50
  }
49
51
  }
50
52
  }
@@ -48,7 +48,7 @@ function vitePluginManifest(options, internals) {
48
48
  `_privateSetManifestDontUseThis(manifest);`
49
49
  ];
50
50
  const exports = [`export { manifest }`];
51
- return [...imports, ...contents, ...exports].join("\n");
51
+ return { code: [...imports, ...contents, ...exports].join("\n") };
52
52
  }
53
53
  },
54
54
  async generateBundle(_opts, bundle) {
@@ -40,7 +40,7 @@ function vitePluginPages(opts, internals) {
40
40
  exports.push(`export const page = () => _page`);
41
41
  imports.push(`import { renderers } from "${RENDERERS_MODULE_ID}";`);
42
42
  exports.push(`export { renderers };`);
43
- return `${imports.join("\n")}${exports.join("\n")}`;
43
+ return { code: `${imports.join("\n")}${exports.join("\n")}` };
44
44
  }
45
45
  }
46
46
  }
@@ -26,10 +26,10 @@ function vitePluginRenderers(opts) {
26
26
  i++;
27
27
  }
28
28
  exports.push(`export const renderers = [${rendererItems}];`);
29
- return `${imports.join("\n")}
30
- ${exports.join("\n")}`;
29
+ return { code: `${imports.join("\n")}
30
+ ${exports.join("\n")}` };
31
31
  } else {
32
- return `export const renderers = [];`;
32
+ return { code: `export const renderers = [];` };
33
33
  }
34
34
  }
35
35
  }
@@ -22,7 +22,7 @@ function vitePluginAdapter(adapter) {
22
22
  },
23
23
  async load(id) {
24
24
  if (id === RESOLVED_ADAPTER_VIRTUAL_MODULE_ID) {
25
- return `export * from ${JSON.stringify(adapter.serverEntrypoint)};`;
25
+ return { code: `export * from ${JSON.stringify(adapter.serverEntrypoint)};` };
26
26
  }
27
27
  }
28
28
  };
@@ -86,7 +86,7 @@ function vitePluginSSR(internals, adapter, options) {
86
86
  const ssrCode = generateSSRCode(adapter, middleware.id);
87
87
  imports.push(...ssrCode.imports);
88
88
  contents.push(...ssrCode.contents);
89
- return [...imports, ...contents, ...exports].join("\n");
89
+ return { code: [...imports, ...contents, ...exports].join("\n") };
90
90
  }
91
91
  },
92
92
  async generateBundle(_opts, bundle) {
@@ -171,10 +171,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
171
171
  open: string | boolean;
172
172
  headers?: OutgoingHttpHeaders | undefined;
173
173
  }, {
174
- headers?: OutgoingHttpHeaders | undefined;
175
174
  host?: string | boolean | undefined;
176
175
  port?: number | undefined;
177
176
  allowedHosts?: true | string[] | undefined;
177
+ headers?: OutgoingHttpHeaders | undefined;
178
178
  open?: string | boolean | undefined;
179
179
  }>>, {
180
180
  host: string | boolean;
@@ -211,8 +211,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
211
211
  route: string;
212
212
  entrypoint?: string | undefined;
213
213
  }, {
214
- route?: string | undefined;
215
214
  entrypoint?: string | undefined;
215
+ route?: string | undefined;
216
216
  }>>;
217
217
  service: z.ZodDefault<z.ZodObject<{
218
218
  entrypoint: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"astro/assets/services/sharp">, z.ZodString]>>;
@@ -267,8 +267,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
267
267
  experimentalBreakpoints?: number[] | undefined;
268
268
  }, {
269
269
  endpoint?: {
270
- route?: string | undefined;
271
270
  entrypoint?: string | undefined;
271
+ route?: string | undefined;
272
272
  } | undefined;
273
273
  service?: {
274
274
  entrypoint?: string | undefined;
@@ -490,10 +490,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
490
490
  endsWith?: string | undefined;
491
491
  startsWith?: string | undefined;
492
492
  default?: string | undefined;
493
- url?: boolean | undefined;
494
493
  optional?: boolean | undefined;
495
494
  max?: number | undefined;
496
495
  min?: number | undefined;
496
+ url?: boolean | undefined;
497
497
  }, {
498
498
  type: "string";
499
499
  length?: number | undefined;
@@ -501,10 +501,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
501
501
  endsWith?: string | undefined;
502
502
  startsWith?: string | undefined;
503
503
  default?: string | undefined;
504
- url?: boolean | undefined;
505
504
  optional?: boolean | undefined;
506
505
  max?: number | undefined;
507
506
  min?: number | undefined;
507
+ url?: boolean | undefined;
508
508
  }>, z.ZodObject<{
509
509
  type: z.ZodLiteral<"number">;
510
510
  optional: z.ZodOptional<z.ZodBoolean>;
@@ -589,10 +589,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
589
589
  endsWith?: string | undefined;
590
590
  startsWith?: string | undefined;
591
591
  default?: string | undefined;
592
- url?: boolean | undefined;
593
592
  optional?: boolean | undefined;
594
593
  max?: number | undefined;
595
594
  min?: number | undefined;
595
+ url?: boolean | undefined;
596
596
  } | {
597
597
  type: "number";
598
598
  default?: number | undefined;
@@ -630,10 +630,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
630
630
  endsWith?: string | undefined;
631
631
  startsWith?: string | undefined;
632
632
  default?: string | undefined;
633
- url?: boolean | undefined;
634
633
  optional?: boolean | undefined;
635
634
  max?: number | undefined;
636
635
  min?: number | undefined;
636
+ url?: boolean | undefined;
637
637
  } | {
638
638
  type: "number";
639
639
  default?: number | undefined;
@@ -861,10 +861,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
861
861
  endsWith?: string | undefined;
862
862
  startsWith?: string | undefined;
863
863
  default?: string | undefined;
864
- url?: boolean | undefined;
865
864
  optional?: boolean | undefined;
866
865
  max?: number | undefined;
867
866
  min?: number | undefined;
867
+ url?: boolean | undefined;
868
868
  } | {
869
869
  type: "number";
870
870
  default?: number | undefined;
@@ -990,8 +990,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
990
990
  } | undefined;
991
991
  image?: {
992
992
  endpoint?: {
993
- route?: string | undefined;
994
993
  entrypoint?: string | undefined;
994
+ route?: string | undefined;
995
995
  } | undefined;
996
996
  service?: {
997
997
  entrypoint?: string | undefined;
@@ -1068,10 +1068,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
1068
1068
  endsWith?: string | undefined;
1069
1069
  startsWith?: string | undefined;
1070
1070
  default?: string | undefined;
1071
- url?: boolean | undefined;
1072
1071
  optional?: boolean | undefined;
1073
1072
  max?: number | undefined;
1074
1073
  min?: number | undefined;
1074
+ url?: boolean | undefined;
1075
1075
  } | {
1076
1076
  type: "number";
1077
1077
  default?: number | undefined;
@@ -227,6 +227,7 @@ const AstroConfigSchema = z.object({
227
227
  routing: z.literal("manual").or(
228
228
  z.object({
229
229
  prefixDefaultLocale: z.boolean().optional().default(false),
230
+ // TODO: Astro 6.0 change to false
230
231
  redirectToDefaultLocale: z.boolean().optional().default(true),
231
232
  fallbackType: z.enum(["redirect", "rewrite"]).optional().default("redirect")
232
233
  })
@@ -24,13 +24,6 @@ const AstroConfigRefinedSchema = z.custom().superRefine((config, ctx) => {
24
24
  });
25
25
  }
26
26
  }
27
- if (config.i18n && typeof config.i18n.routing !== "string" && !config.i18n.routing.redirectToDefaultLocale && !config.i18n.routing.prefixDefaultLocale) {
28
- ctx.addIssue({
29
- code: z.ZodIssueCode.custom,
30
- message: "The option `i18n.routing.redirectToDefaultLocale` is only useful when the `i18n.routing.prefixDefaultLocale` is set to `true`. Remove the option `i18n.routing.redirectToDefaultLocale`, or change its value to `true`.",
31
- path: ["i18n", "routing", "redirectToDefaultLocale"]
32
- });
33
- }
34
27
  if (config.outDir.toString().startsWith(config.publicDir.toString())) {
35
28
  ctx.addIssue({
36
29
  code: z.ZodIssueCode.custom,