astro 6.2.0 → 7.0.0-alpha.0

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 (52) hide show
  1. package/dist/assets/utils/assets.d.ts +4 -5
  2. package/dist/assets/utils/node.d.ts +2 -2
  3. package/dist/assets/vite-plugin-assets.js +1 -1
  4. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  5. package/dist/content/content-layer.js +3 -3
  6. package/dist/content/runtime-assets.d.ts +2 -2
  7. package/dist/content/utils.d.ts +2 -3
  8. package/dist/core/build/add-rolldown-input.d.ts +2 -0
  9. package/dist/core/build/{add-rollup-input.js → add-rolldown-input.js} +3 -3
  10. package/dist/core/build/graph.d.ts +8 -8
  11. package/dist/core/build/plugins/plugin-analyzer.js +1 -1
  12. package/dist/core/build/plugins/plugin-component-entry.d.ts +1 -1
  13. package/dist/core/build/plugins/plugin-component-entry.js +3 -3
  14. package/dist/core/build/plugins/plugin-internals.js +1 -1
  15. package/dist/core/build/plugins/plugin-prerender.js +1 -1
  16. package/dist/core/build/static-build.d.ts +2 -2
  17. package/dist/core/build/static-build.js +31 -31
  18. package/dist/core/build/util.d.ts +2 -2
  19. package/dist/core/build/util.js +2 -2
  20. package/dist/core/compile/compile.d.ts +1 -1
  21. package/dist/core/compile/compile.js +20 -16
  22. package/dist/core/config/schemas/base.d.ts +0 -2
  23. package/dist/core/config/schemas/base.js +0 -2
  24. package/dist/core/config/schemas/relative.d.ts +0 -3
  25. package/dist/core/constants.js +1 -1
  26. package/dist/core/create-vite.js +2 -0
  27. package/dist/core/dev/dev.js +1 -1
  28. package/dist/core/errors/dev/utils.js +1 -1
  29. package/dist/core/head-propagation/hint.d.ts +4 -0
  30. package/dist/core/head-propagation/hint.js +7 -0
  31. package/dist/core/messages/runtime.js +1 -1
  32. package/dist/core/middleware/vite-plugin.js +2 -2
  33. package/dist/toolbar/vite-plugin-dev-toolbar.js +1 -23
  34. package/dist/types/public/config.d.ts +0 -1
  35. package/dist/types/public/content.d.ts +3 -3
  36. package/dist/types/public/integrations.d.ts +2 -2
  37. package/dist/vite-plugin-adapter-config/index.js +1 -1
  38. package/dist/vite-plugin-astro/compile.d.ts +3 -5
  39. package/dist/vite-plugin-astro/compile.js +4 -60
  40. package/dist/vite-plugin-astro/index.js +15 -28
  41. package/dist/vite-plugin-astro/types.d.ts +2 -1
  42. package/dist/vite-plugin-head/index.js +9 -3
  43. package/dist/vite-plugin-pages/util.d.ts +1 -1
  44. package/package.json +7 -9
  45. package/templates/content/module.mjs +1 -1
  46. package/dist/core/build/add-rollup-input.d.ts +0 -2
  47. package/dist/core/compile/compile-rs.d.ts +0 -25
  48. package/dist/core/compile/compile-rs.js +0 -111
  49. package/dist/core/head-propagation/comment.d.ts +0 -7
  50. package/dist/core/head-propagation/comment.js +0 -7
  51. package/dist/vite-plugin-astro/compile-rs.d.ts +0 -12
  52. package/dist/vite-plugin-astro/compile-rs.js +0 -39
@@ -1,6 +1,5 @@
1
- import type { Environment, Rollup } from 'vite';
2
- type PluginContext = Rollup.PluginContext;
3
- type EmitFileOptions = Parameters<Rollup.PluginContext['emitFile']>[0];
1
+ import type { Environment, Rolldown } from 'vite';
2
+ type EmitFileOptions = Parameters<Rolldown.PluginContext['emitFile']>[0];
4
3
  /**
5
4
  * Gets or creates the handle set for an environment
6
5
  */
@@ -15,9 +14,9 @@ export declare function resetHandles(env: Environment): void;
15
14
  * Use this instead of pluginContext.emitFile for assets that should
16
15
  * be moved from the server/prerender directory to the client directory.
17
16
  *
18
- * Note: The pluginContext is typed as Rollup.PluginContext for compatibility
17
+ * Note: The pluginContext is typed as Rolldown.PluginContext for compatibility
19
18
  * with content entry types, but in practice it will always have the `environment`
20
19
  * property when running in Vite.
21
20
  */
22
- export declare function emitClientAsset(pluginContext: PluginContext, options: EmitFileOptions): string;
21
+ export declare function emitClientAsset(pluginContext: Rolldown.PluginContext, options: EmitFileOptions): string;
23
22
  export {};
@@ -1,7 +1,7 @@
1
- import type * as vite from 'vite';
1
+ import type { Rolldown } from 'vite';
2
2
  import type { ImageMetadata } from '../types.js';
3
3
  export { hashTransform, propsToFilename } from './hash.js';
4
- type FileEmitter = vite.Rollup.EmitFile;
4
+ type FileEmitter = (opts: Parameters<Rolldown.PluginContext['emitFile']>[0]) => string;
5
5
  type ImageMetadataWithContents = ImageMetadata & {
6
6
  contents?: Buffer;
7
7
  };
@@ -278,7 +278,7 @@ function assets({ fs, settings, sync, logger }) {
278
278
  });
279
279
  }
280
280
  if (isAstroServerEnvironment(this.environment)) {
281
- if (id.endsWith(".svg") && !isContentImage) {
281
+ if (id.endsWith(".svg")) {
282
282
  const contents = await fs.promises.readFile(imageMetadata.fsPath, {
283
283
  encoding: "utf8"
284
284
  });
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "6.2.0";
3
+ version = "7.0.0-alpha.0";
4
4
  }
5
5
  export {
6
6
  BuildTimeAstroVersionProvider
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
192
192
  logger.info("Content config changed");
193
193
  shouldClear = true;
194
194
  }
195
- if (previousAstroVersion && previousAstroVersion !== "6.2.0") {
195
+ if (previousAstroVersion && previousAstroVersion !== "7.0.0-alpha.0") {
196
196
  logger.info("Astro version changed");
197
197
  shouldClear = true;
198
198
  }
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
200
200
  logger.info("Clearing content store");
201
201
  this.#store.clearAll();
202
202
  }
203
- if ("6.2.0") {
204
- this.#store.metaStore().set("astro-version", "6.2.0");
203
+ if ("7.0.0-alpha.0") {
204
+ this.#store.metaStore().set("astro-version", "7.0.0-alpha.0");
205
205
  }
206
206
  if (currentConfigDigest) {
207
207
  this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -1,6 +1,6 @@
1
- import type { PluginContext } from 'rollup';
1
+ import type { Rolldown } from 'vite';
2
2
  import * as z from 'zod/v4';
3
- export declare function createImage(pluginContext: PluginContext, shouldEmitFile: boolean, entryFilePath: string): () => z.ZodPipe<z.ZodString, z.ZodTransform<z.ZodNever | {
3
+ export declare function createImage(pluginContext: Rolldown.PluginContext, shouldEmitFile: boolean, entryFilePath: string): () => z.ZodPipe<z.ZodString, z.ZodTransform<z.ZodNever | {
4
4
  ASTRO_ASSET: string;
5
5
  format: import("../assets/types.js").ImageInputFormat;
6
6
  src: string;
@@ -1,6 +1,5 @@
1
1
  import fsMod from 'node:fs';
2
- import type { PluginContext } from 'rollup';
3
- import type { RunnableDevEnvironment } from 'vite';
2
+ import type { RunnableDevEnvironment, Rolldown } from 'vite';
4
3
  import * as z from 'zod/v4';
5
4
  import type { AstroLogger } from '../core/logger/core.js';
6
5
  import type { AstroSettings } from '../types/astro.js';
@@ -96,7 +95,7 @@ export declare function getEntryData<TInputData extends Record<string, unknown>
96
95
  collection: string;
97
96
  unvalidatedData: TInputData;
98
97
  _internal: EntryInternal;
99
- }, collectionConfig: CollectionConfig, shouldEmitFile: boolean, pluginContext?: PluginContext): Promise<TOutputData>;
98
+ }, collectionConfig: CollectionConfig, shouldEmitFile: boolean, pluginContext?: Rolldown.PluginContext): Promise<TOutputData>;
100
99
  export declare function getContentEntryExts(settings: Pick<AstroSettings, 'contentEntryTypes'>): string[];
101
100
  export declare function getDataEntryExts(settings: Pick<AstroSettings, 'dataEntryTypes'>): string[];
102
101
  export declare function getEntryConfigByExtMap<TEntryType extends ContentEntryType | DataEntryType>(entryTypes: TEntryType[]): Map<string, TEntryType>;
@@ -0,0 +1,2 @@
1
+ import type { Rolldown } from 'vite';
2
+ export declare function addRolldownInput(inputOptions: Rolldown.InputOptions, newInputs: string[]): Rolldown.InputOptions;
@@ -5,7 +5,7 @@ function fromEntries(entries) {
5
5
  }
6
6
  return obj;
7
7
  }
8
- function addRollupInput(inputOptions, newInputs) {
8
+ function addRolldownInput(inputOptions, newInputs) {
9
9
  if (!inputOptions.input) {
10
10
  return { ...inputOptions, input: newInputs };
11
11
  }
@@ -30,8 +30,8 @@ function addRollupInput(inputOptions, newInputs) {
30
30
  }
31
31
  };
32
32
  }
33
- throw new Error(`Unknown rollup input type. Supported inputs are string, array and object.`);
33
+ throw new Error(`Unknown rolldown input type. Supported inputs are string, array and object.`);
34
34
  }
35
35
  export {
36
- addRollupInput
36
+ addRolldownInput
37
37
  };
@@ -1,17 +1,17 @@
1
- import type { GetModuleInfo, ModuleInfo } from 'rollup';
1
+ import type { Rolldown } from 'vite';
2
2
  interface ExtendedModuleInfo {
3
- info: ModuleInfo;
3
+ info: Rolldown.ModuleInfo;
4
4
  depth: number;
5
5
  order: number;
6
6
  }
7
7
  export declare function getParentExtendedModuleInfos(id: string, ctx: {
8
- getModuleInfo: GetModuleInfo;
8
+ getModuleInfo: Rolldown.GetModuleInfo;
9
9
  }, until?: (importer: string) => boolean, depth?: number, order?: number, childId?: string, seen?: Set<string>, accumulated?: ExtendedModuleInfo[]): ExtendedModuleInfo[];
10
10
  export declare function getParentModuleInfos(id: string, ctx: {
11
- getModuleInfo: GetModuleInfo;
12
- }, until?: (importer: string) => boolean, seen?: Set<string>, accumulated?: ModuleInfo[]): ModuleInfo[];
13
- export declare function moduleIsTopLevelPage(info: ModuleInfo): boolean;
11
+ getModuleInfo: Rolldown.GetModuleInfo;
12
+ }, until?: (importer: string) => boolean, seen?: Set<string>, accumulated?: Rolldown.ModuleInfo[]): Rolldown.ModuleInfo[];
13
+ export declare function moduleIsTopLevelPage(info: Rolldown.ModuleInfo): boolean;
14
14
  export declare function getTopLevelPageModuleInfos(id: string, ctx: {
15
- getModuleInfo: GetModuleInfo;
16
- }): ModuleInfo[];
15
+ getModuleInfo: Rolldown.GetModuleInfo;
16
+ }): Rolldown.ModuleInfo[];
17
17
  export {};
@@ -8,7 +8,7 @@ import {
8
8
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
9
9
  function pluginAnalyzer(internals) {
10
10
  return {
11
- name: "@astro/rollup-plugin-astro-analyzer",
11
+ name: "@astro/rolldown-plugin-astro-analyzer",
12
12
  applyToEnvironment(environment) {
13
13
  return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
14
14
  },
@@ -1,7 +1,7 @@
1
1
  import type { Plugin as VitePlugin } from 'vite';
2
2
  import type { BuildInternals } from '../internal.js';
3
3
  /**
4
- * When adding hydrated or client:only components as Rollup inputs, sometimes we're not using all
4
+ * When adding hydrated or client:only components as Rolldown inputs, sometimes we're not using all
5
5
  * of the export names, e.g. `import { Counter } from './ManyComponents.jsx'`. This plugin proxies
6
6
  * entries to re-export only the names that the user is using.
7
7
  */
@@ -27,9 +27,9 @@ function pluginComponentEntry(internals) {
27
27
  return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.client;
28
28
  },
29
29
  config(config) {
30
- const rollupInput = config.build?.rollupOptions?.input;
31
- if (Array.isArray(rollupInput)) {
32
- config.build.rollupOptions.input = rollupInput.map((id) => {
30
+ const rolldownInput = config.build?.rolldownOptions?.input;
31
+ if (Array.isArray(rolldownInput)) {
32
+ config.build.rolldownOptions.input = rolldownInput.map((id) => {
33
33
  if (componentToExportNames.has(id)) {
34
34
  return astroEntryPrefix + id;
35
35
  } else {
@@ -21,7 +21,7 @@ function pluginInternals(options, internals) {
21
21
  if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.prerender) {
22
22
  return {
23
23
  build: {
24
- rollupOptions: {
24
+ rolldownOptions: {
25
25
  // These packages as they're not bundle-friendly. Users with strict package installations
26
26
  // need to manually install these themselves if they use the related features.
27
27
  external: [
@@ -1,7 +1,7 @@
1
1
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
2
2
  function pluginPrerender(_opts, internals) {
3
3
  return {
4
- name: "astro:rollup-plugin-prerender",
4
+ name: "astro:rolldown-plugin-prerender",
5
5
  applyToEnvironment(environment) {
6
6
  return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
7
7
  },
@@ -2,8 +2,8 @@ import { type BuildInternals } from '../../core/build/internal.js';
2
2
  import type { RouteData } from '../../types/public/internal.js';
3
3
  import type { StaticBuildOptions } from './types.js';
4
4
  /**
5
- * Minimal chunk data extracted from RollupOutput for deferred manifest/content injection.
6
- * Allows releasing full RollupOutput objects early to reduce memory usage.
5
+ * Minimal chunk data extracted from RolldownOutput for deferred manifest/content injection.
6
+ * Allows releasing full RolldownOutput objects early to reduce memory usage.
7
7
  */
8
8
  export interface ExtractedChunk {
9
9
  fileName: string;
@@ -30,7 +30,7 @@ import {
30
30
  RESOLVED_LEGACY_SSR_ENTRY_VIRTUAL_MODULE
31
31
  } from "./plugins/plugin-ssr.js";
32
32
  import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from "./plugins/util.js";
33
- import { cleanChunkName, getTimeStat, viteBuildReturnToRollupOutputs } from "./util.js";
33
+ import { cleanChunkName, getTimeStat, viteBuildReturnToRolldownOutputs } from "./util.js";
34
34
  import { NOOP_MODULE_ID } from "./plugins/plugin-noop.js";
35
35
  import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../constants.js";
36
36
  import { getSSRAssets } from "./internal.js";
@@ -87,25 +87,25 @@ async function buildEnvironments(opts, internals) {
87
87
  const buildPlugins = getAllBuildPlugins(internals, opts);
88
88
  const flatPlugins = buildPlugins.flat().filter(Boolean);
89
89
  const plugins = [...flatPlugins, ...viteConfig.plugins || []];
90
- let currentRollupInput = void 0;
90
+ let currentRolldownInput = void 0;
91
91
  let buildPostHooks = [];
92
92
  plugins.push({
93
93
  name: "astro:resolve-input",
94
- // When the rollup input is safe to update, we normalize it to always be an object
94
+ // When the rolldown input is safe to update, we normalize it to always be an object
95
95
  // so we can reliably identify which entrypoint corresponds to the adapter
96
96
  enforce: "post",
97
97
  config(config) {
98
- if (typeof config.build?.rollupOptions?.input === "string") {
99
- config.build.rollupOptions.input = { index: config.build.rollupOptions.input };
100
- } else if (Array.isArray(config.build?.rollupOptions?.input)) {
101
- config.build.rollupOptions.input = Object.fromEntries(
102
- config.build.rollupOptions.input.map((v, i) => [`index_${i}`, v])
98
+ if (typeof config.build?.rolldownOptions?.input === "string") {
99
+ config.build.rolldownOptions.input = { index: config.build.rolldownOptions.input };
100
+ } else if (Array.isArray(config.build?.rolldownOptions?.input)) {
101
+ config.build.rolldownOptions.input = Object.fromEntries(
102
+ config.build.rolldownOptions.input.map((v, i) => [`index_${i}`, v])
103
103
  );
104
104
  }
105
105
  },
106
- // We save the rollup input to be able to check later on
106
+ // We save the rolldown input to be able to check later on
107
107
  configResolved(config) {
108
- currentRollupInput = config.build.rollupOptions.input;
108
+ currentRolldownInput = config.build.rolldownOptions.input;
109
109
  }
110
110
  });
111
111
  plugins.push({
@@ -137,16 +137,16 @@ async function buildEnvironments(opts, internals) {
137
137
  }
138
138
  }
139
139
  });
140
- function isRollupInput(moduleName) {
141
- if (!currentRollupInput || !moduleName) {
140
+ function isRolldownInput(moduleName) {
141
+ if (!currentRolldownInput || !moduleName) {
142
142
  return false;
143
143
  }
144
- if (typeof currentRollupInput === "string") {
145
- return currentRollupInput === moduleName;
146
- } else if (Array.isArray(currentRollupInput)) {
147
- return currentRollupInput.includes(moduleName);
144
+ if (typeof currentRolldownInput === "string") {
145
+ return currentRolldownInput === moduleName;
146
+ } else if (Array.isArray(currentRolldownInput)) {
147
+ return currentRolldownInput.includes(moduleName);
148
148
  } else {
149
- return Object.keys(currentRollupInput).includes(moduleName);
149
+ return Object.keys(currentRolldownInput).includes(moduleName);
150
150
  }
151
151
  }
152
152
  const viteBuildConfig = {
@@ -161,8 +161,8 @@ async function buildEnvironments(opts, internals) {
161
161
  emptyOutDir: false,
162
162
  copyPublicDir: false,
163
163
  manifest: false,
164
- rollupOptions: {
165
- ...viteConfig.build?.rollupOptions,
164
+ rolldownOptions: {
165
+ ...viteConfig.build?.rolldownOptions,
166
166
  // Setting as `exports-only` allows us to safely delete inputs that are only used during prerendering
167
167
  preserveEntrySignatures: "exports-only",
168
168
  ...legacyAdapter && settings.buildOutput === "server" ? { input: LEGACY_SSR_ENTRY_VIRTUAL_MODULE } : {},
@@ -187,7 +187,7 @@ async function buildEnvironments(opts, internals) {
187
187
  return [prefix, cleanChunkName(name), suffix].join("");
188
188
  },
189
189
  assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
190
- ...viteConfig.build?.rollupOptions?.output,
190
+ ...viteConfig.build?.rolldownOptions?.output,
191
191
  entryFileNames(chunkInfo) {
192
192
  if (chunkInfo.facadeModuleId?.startsWith(VIRTUAL_PAGE_RESOLVED_MODULE_ID)) {
193
193
  return makeAstroPageEntryPointFileName(
@@ -196,8 +196,8 @@ async function buildEnvironments(opts, internals) {
196
196
  routes
197
197
  );
198
198
  } else if (chunkInfo.facadeModuleId === RESOLVED_LEGACY_SSR_ENTRY_VIRTUAL_MODULE || // This catches the case when the adapter uses `entrypointResolution: 'auto'`. When doing so,
199
- // the adapter must set rollupOptions.input or Astro sets it from `serverEntrypoint`.
200
- isRollupInput(chunkInfo.name) || isRollupInput(chunkInfo.facadeModuleId)) {
199
+ // the adapter must set rolldownOptions.input or Astro sets it from `serverEntrypoint`.
200
+ isRolldownInput(chunkInfo.name) || isRolldownInput(chunkInfo.facadeModuleId)) {
201
201
  return opts.settings.config.build.serverEntry;
202
202
  } else {
203
203
  return "[name].mjs";
@@ -221,7 +221,7 @@ async function buildEnvironments(opts, internals) {
221
221
  let prerenderOutput = await builder2.build(builder2.environments.prerender);
222
222
  settings.timer.end("Prerender build");
223
223
  extractPrerenderEntryFileName(internals, prerenderOutput);
224
- const prerenderOutputs = viteBuildReturnToRollupOutputs(prerenderOutput);
224
+ const prerenderOutputs = viteBuildReturnToRolldownOutputs(prerenderOutput);
225
225
  const prerenderChunks = extractRelevantChunks(prerenderOutputs, true);
226
226
  prerenderOutput = void 0;
227
227
  let ssrChunks = [];
@@ -231,7 +231,7 @@ async function buildEnvironments(opts, internals) {
231
231
  builder2.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]
232
232
  );
233
233
  settings.timer.end("SSR build");
234
- const ssrOutputs = viteBuildReturnToRollupOutputs(ssrOutput);
234
+ const ssrOutputs = viteBuildReturnToRolldownOutputs(ssrOutput);
235
235
  ssrChunks = extractRelevantChunks(ssrOutputs, false);
236
236
  ssrOutput = void 0;
237
237
  }
@@ -259,14 +259,14 @@ async function buildEnvironments(opts, internals) {
259
259
  build: {
260
260
  emitAssets: true,
261
261
  outDir: fileURLToPath(getPrerenderOutputDirectory(settings)),
262
- rollupOptions: {
262
+ rolldownOptions: {
263
263
  // Only skip the default prerender entrypoint if an adapter with `entrypointResolution: 'self'` is used
264
264
  // AND provides a custom prerenderer. Otherwise, use the default.
265
265
  ...!legacyAdapter && settings.prerenderer ? {} : { input: "astro/entrypoints/prerender" },
266
266
  output: {
267
267
  entryFileNames: `${PRERENDER_ENTRY_FILENAME_PREFIX}.[hash].mjs`,
268
268
  format: "esm",
269
- ...viteConfig.environments?.prerender?.build?.rollupOptions?.output
269
+ ...viteConfig.environments?.prerender?.build?.rolldownOptions?.output
270
270
  }
271
271
  },
272
272
  ssr: true
@@ -280,7 +280,7 @@ async function buildEnvironments(opts, internals) {
280
280
  copyPublicDir: true,
281
281
  sourcemap: viteConfig.environments?.client?.build?.sourcemap ?? false,
282
282
  minify: true,
283
- rollupOptions: {
283
+ rolldownOptions: {
284
284
  preserveEntrySignatures: "exports-only",
285
285
  output: {
286
286
  entryFileNames(chunkInfo) {
@@ -290,7 +290,7 @@ async function buildEnvironments(opts, internals) {
290
290
  return `${settings.config.build.assets}/${cleanChunkName(chunkInfo.name)}.[hash].js`;
291
291
  },
292
292
  assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
293
- ...viteConfig.environments?.client?.build?.rollupOptions?.output
293
+ ...viteConfig.environments?.client?.build?.rolldownOptions?.output
294
294
  }
295
295
  }
296
296
  }
@@ -298,9 +298,9 @@ async function buildEnvironments(opts, internals) {
298
298
  [ASTRO_VITE_ENVIRONMENT_NAMES.ssr]: {
299
299
  build: {
300
300
  outDir: fileURLToPath(getServerOutputDirectory(settings)),
301
- rollupOptions: {
301
+ rolldownOptions: {
302
302
  output: {
303
- ...viteConfig.environments?.ssr?.build?.rollupOptions?.output
303
+ ...viteConfig.environments?.ssr?.build?.rolldownOptions?.output
304
304
  }
305
305
  }
306
306
  }
@@ -318,7 +318,7 @@ async function buildEnvironments(opts, internals) {
318
318
  await builder.buildApp();
319
319
  }
320
320
  function getPrerenderEntryFileName(prerenderOutput) {
321
- const outputs = viteBuildReturnToRollupOutputs(prerenderOutput);
321
+ const outputs = viteBuildReturnToRolldownOutputs(prerenderOutput);
322
322
  for (const output of outputs) {
323
323
  for (const chunk of output.output) {
324
324
  if (chunk.type !== "asset" && "fileName" in chunk) {
@@ -1,4 +1,4 @@
1
- import type { Rollup } from 'vite';
1
+ import type { Rolldown } from 'vite';
2
2
  import type { AstroConfig } from '../../types/public/config.js';
3
3
  import type { ViteBuildReturn } from './types.js';
4
4
  export declare function getTimeStat(timeStart: number, timeEnd: number): string;
@@ -12,4 +12,4 @@ export declare function shouldAppendForwardSlash(trailingSlash: AstroConfig['tra
12
12
  * and break deploys on platforms like Netlify.
13
13
  */
14
14
  export declare function cleanChunkName(name: string): string;
15
- export declare function viteBuildReturnToRollupOutputs(viteBuildReturn: ViteBuildReturn): Rollup.RollupOutput[];
15
+ export declare function viteBuildReturnToRolldownOutputs(viteBuildReturn: ViteBuildReturn): Rolldown.RolldownOutput[];
@@ -34,7 +34,7 @@ function encodeName(name) {
34
34
  }
35
35
  return name;
36
36
  }
37
- function viteBuildReturnToRollupOutputs(viteBuildReturn) {
37
+ function viteBuildReturnToRolldownOutputs(viteBuildReturn) {
38
38
  const result = [];
39
39
  if (Array.isArray(viteBuildReturn)) {
40
40
  result.push(...viteBuildReturn);
@@ -47,5 +47,5 @@ export {
47
47
  cleanChunkName,
48
48
  getTimeStat,
49
49
  shouldAppendForwardSlash,
50
- viteBuildReturnToRollupOutputs
50
+ viteBuildReturnToRolldownOutputs
51
51
  };
@@ -1,4 +1,4 @@
1
- import type { TransformResult } from '@astrojs/compiler';
1
+ import { type TransformResult } from '@astrojs/compiler-rs';
2
2
  import type { ResolvedConfig } from 'vite';
3
3
  import type { AstroConfig } from '../../types/public/config.js';
4
4
  import type { CompileCssResult } from './types.js';
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from "node:url";
2
- import { transform } from "@astrojs/compiler";
2
+ import { preprocessStyles, transform } from "@astrojs/compiler-rs";
3
3
  import { AggregateError, CompilerError } from "../errors/errors.js";
4
4
  import { AstroErrorData } from "../errors/index.js";
5
5
  import { normalizePath, resolvePath } from "../viteUtils.js";
@@ -15,7 +15,17 @@ async function compile({
15
15
  const cssTransformErrors = [];
16
16
  let transformResult;
17
17
  try {
18
- transformResult = await transform(source, {
18
+ const preprocessedStyles = await preprocessStyles(
19
+ source,
20
+ createStylePreprocessor({
21
+ filename,
22
+ viteConfig,
23
+ astroConfig,
24
+ cssPartialCompileResults,
25
+ cssTransformErrors
26
+ })
27
+ );
28
+ transformResult = transform(source, {
19
29
  compact: astroConfig.compressHTML,
20
30
  filename,
21
31
  normalizedFilename: normalizeFilename(filename, astroConfig.root),
@@ -27,14 +37,8 @@ async function compile({
27
37
  resultScopedSlot: true,
28
38
  transitionsAnimationURL: "astro/components/viewtransitions.css",
29
39
  annotateSourceFile: viteConfig.command === "serve" && astroConfig.devToolbar && astroConfig.devToolbar.enabled && toolbarEnabled,
30
- preprocessStyle: createStylePreprocessor({
31
- filename,
32
- viteConfig,
33
- astroConfig,
34
- cssPartialCompileResults,
35
- cssTransformErrors
36
- }),
37
- async resolvePath(specifier) {
40
+ preprocessedStyles,
41
+ resolvePath(specifier) {
38
42
  return resolvePath(specifier, filename);
39
43
  }
40
44
  });
@@ -48,7 +52,7 @@ async function compile({
48
52
  }
49
53
  });
50
54
  }
51
- handleCompileResultErrors(transformResult, cssTransformErrors);
55
+ handleCompileResultErrors(filename, transformResult, cssTransformErrors);
52
56
  return {
53
57
  ...transformResult,
54
58
  css: transformResult.css.map((code, i) => ({
@@ -57,16 +61,16 @@ async function compile({
57
61
  }))
58
62
  };
59
63
  }
60
- function handleCompileResultErrors(result, cssTransformErrors) {
61
- const compilerError = result.diagnostics.find((diag) => diag.severity === 1);
64
+ function handleCompileResultErrors(filename, result, cssTransformErrors) {
65
+ const compilerError = result.diagnostics.find((diag) => diag.severity === "error");
62
66
  if (compilerError) {
63
67
  throw new CompilerError({
64
68
  name: "CompilerError",
65
69
  message: compilerError.text,
66
70
  location: {
67
- line: compilerError.location.line,
68
- column: compilerError.location.column,
69
- file: compilerError.location.file
71
+ line: compilerError.labels[0].line,
72
+ column: compilerError.labels[0].column,
73
+ file: filename
70
74
  },
71
75
  hint: compilerError.hint
72
76
  });
@@ -78,7 +78,6 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
78
78
  clientPrerender: false;
79
79
  contentIntellisense: false;
80
80
  chromeDevtoolsWorkspace: false;
81
- rustCompiler: false;
82
81
  queuedRendering: {
83
82
  enabled: false;
84
83
  };
@@ -517,7 +516,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
517
516
  swr: z.ZodOptional<z.ZodNumber>;
518
517
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
519
518
  }, z.core.$strip>>>;
520
- rustCompiler: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
521
519
  queuedRendering: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
522
520
  enabled: z.ZodPrefault<z.ZodOptional<z.ZodBoolean>>;
523
521
  poolSize: z.ZodOptional<z.ZodNumber>;
@@ -63,7 +63,6 @@ const ASTRO_CONFIG_DEFAULTS = {
63
63
  clientPrerender: false,
64
64
  contentIntellisense: false,
65
65
  chromeDevtoolsWorkspace: false,
66
- rustCompiler: false,
67
66
  queuedRendering: {
68
67
  enabled: false
69
68
  },
@@ -313,7 +312,6 @@ const AstroConfigSchema = z.object({
313
312
  svgOptimizer: SvgOptimizerSchema.optional(),
314
313
  cache: CacheSchema.optional(),
315
314
  routeRules: RouteRulesSchema.optional(),
316
- rustCompiler: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.rustCompiler),
317
315
  queuedRendering: z.object({
318
316
  enabled: z.boolean().optional().prefault(false),
319
317
  poolSize: z.number().int().nonnegative().optional(),
@@ -400,7 +400,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
400
400
  swr: z.ZodOptional<z.ZodNumber>;
401
401
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
402
  }, z.core.$strip>>>;
403
- rustCompiler: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
404
403
  queuedRendering: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
405
404
  enabled: z.ZodPrefault<z.ZodOptional<z.ZodBoolean>>;
406
405
  poolSize: z.ZodOptional<z.ZodNumber>;
@@ -577,7 +576,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
577
576
  clientPrerender: boolean;
578
577
  contentIntellisense: boolean;
579
578
  chromeDevtoolsWorkspace: boolean;
580
- rustCompiler: boolean;
581
579
  queuedRendering: {
582
580
  enabled: boolean;
583
581
  poolSize?: number | undefined;
@@ -826,7 +824,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
826
824
  clientPrerender: boolean;
827
825
  contentIntellisense: boolean;
828
826
  chromeDevtoolsWorkspace: boolean;
829
- rustCompiler: boolean;
830
827
  queuedRendering: {
831
828
  enabled: boolean;
832
829
  poolSize?: number | undefined;
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "6.2.0";
1
+ const ASTRO_VERSION = "7.0.0-alpha.0";
2
2
  const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`;
3
3
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
4
4
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
@@ -279,6 +279,7 @@ const COMMON_PREFIXES_NOT_ASTRO = [
279
279
  "@webcomponents/",
280
280
  "@fontsource/",
281
281
  "@postcss-plugins/",
282
+ "@rolldown/",
282
283
  "@rollup/",
283
284
  "@astrojs/renderer-",
284
285
  "@types/",
@@ -289,6 +290,7 @@ const COMMON_PREFIXES_NOT_ASTRO = [
289
290
  "prettier-plugin-",
290
291
  "remark-",
291
292
  "rehype-",
293
+ "rolldown-plugin-",
292
294
  "rollup-plugin-",
293
295
  "vite-plugin-"
294
296
  ];
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
37
37
  await telemetry.record([]);
38
38
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
39
39
  const logger = restart.container.logger;
40
- const currentVersion = "6.2.0";
40
+ const currentVersion = "7.0.0-alpha.0";
41
41
  const isPrerelease = currentVersion.includes("-");
42
42
  if (!isPrerelease) {
43
43
  try {
@@ -50,7 +50,7 @@ function collectErrorMetadata(e, rootFolder) {
50
50
  });
51
51
  if (!AggregateError.is(e) && Array.isArray(e.errors)) {
52
52
  e.errors.forEach((buildError, i) => {
53
- const { location, pluginName, text } = buildError;
53
+ const { loc: location, plugin: pluginName, message: text } = buildError;
54
54
  if (text) {
55
55
  try {
56
56
  err[i].message = text;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns true when source contains the `"use astro:head-inject"` directive.
3
+ */
4
+ export declare function hasHeadPropagationCall(source: string): boolean;
@@ -0,0 +1,7 @@
1
+ const HEAD_PROPAGATION_HINT = '"use astro:head-inject"';
2
+ function hasHeadPropagationCall(source) {
3
+ return source.includes(HEAD_PROPAGATION_HINT);
4
+ }
5
+ export {
6
+ hasHeadPropagationCall
7
+ };
@@ -276,7 +276,7 @@ function printHelp({
276
276
  message.push(
277
277
  linebreak(),
278
278
  ` ${bgGreen(black(` ${commandName} `))} ${green(
279
- `v${"6.2.0"}`
279
+ `v${"7.0.0-alpha.0"}`
280
280
  )} ${headline}`
281
281
  );
282
282
  }