astro 5.0.0-alpha.8 → 5.0.0-beta.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.
@@ -2,6 +2,6 @@ import type { UserConfig as ViteUserConfig } from 'vite';
2
2
  import type { AstroInlineConfig, AstroUserConfig } from '../types/public/config.js';
3
3
  export declare function defineConfig(config: AstroUserConfig): AstroUserConfig;
4
4
  export declare function getViteConfig(userViteConfig: ViteUserConfig, inlineAstroConfig?: AstroInlineConfig): ({ mode, command }: {
5
- mode: string;
5
+ mode: "dev";
6
6
  command: "serve" | "build";
7
7
  }) => Promise<Record<string, any>>;
@@ -1,5 +1,6 @@
1
1
  import { Logger } from "../core/logger/core.js";
2
2
  import { createRouteManifest } from "../core/routing/index.js";
3
+ import { createDevelopmentManifest } from "../vite-plugin-astro-server/plugin.js";
3
4
  function defineConfig(config) {
4
5
  return config;
5
6
  }
@@ -31,6 +32,7 @@ function getViteConfig(userViteConfig, inlineAstroConfig = {}) {
31
32
  let settings = await createSettings(config, userViteConfig.root);
32
33
  settings = await runHookConfigSetup({ settings, command: cmd, logger });
33
34
  const manifest = await createRouteManifest({ settings }, logger);
35
+ const devSSRManifest = createDevelopmentManifest(settings);
34
36
  const viteConfig = await createVite(
35
37
  {
36
38
  mode,
@@ -39,7 +41,7 @@ function getViteConfig(userViteConfig, inlineAstroConfig = {}) {
39
41
  astroContentListenPlugin({ settings, logger, fs })
40
42
  ]
41
43
  },
42
- { settings, logger, mode, sync: false, manifest }
44
+ { settings, logger, mode, sync: false, manifest, ssrManifest: devSSRManifest }
43
45
  );
44
46
  await runHookConfigDone({ settings, logger });
45
47
  return mergeConfig(viteConfig, userViteConfig);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.0.0-alpha.8";
1
+ const ASTRO_VERSION = "5.0.0-beta.1";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -3,16 +3,20 @@ import * as vite from 'vite';
3
3
  import type { AstroSettings, ManifestData } from '../types/astro.js';
4
4
  import type { SSRManifest } from './app/types.js';
5
5
  import type { Logger } from './logger/core.js';
6
- interface CreateViteOptions {
6
+ type CreateViteOptions = {
7
7
  settings: AstroSettings;
8
8
  logger: Logger;
9
- mode: 'dev' | 'build' | string;
10
9
  command?: 'dev' | 'build';
11
10
  fs?: typeof nodeFs;
12
11
  sync: boolean;
13
12
  manifest: ManifestData;
13
+ } & ({
14
+ mode: 'dev';
15
+ ssrManifest: SSRManifest;
16
+ } | {
17
+ mode: 'build';
14
18
  ssrManifest?: SSRManifest;
15
- }
19
+ });
16
20
  /** Return a base vite config as a common starting point for all Vite commands. */
17
21
  export declare function createVite(commandConfig: vite.InlineConfig, { settings, logger, mode, command, fs, sync, manifest, ssrManifest }: CreateViteOptions): Promise<vite.InlineConfig>;
18
22
  export {};
@@ -101,7 +101,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
101
101
  astroScriptsPlugin({ settings }),
102
102
  // The server plugin is for dev only and having it run during the build causes
103
103
  // the build to run very slow as the filewatcher is triggered often.
104
- mode !== "build" && vitePluginAstroServer({ settings, logger, fs, manifest, ssrManifest }),
104
+ mode === "dev" && vitePluginAstroServer({ settings, logger, fs, manifest, ssrManifest }),
105
105
  // ssrManifest is only required in dev mode, where it gets created before a Vite instance is created, and get passed to this function
106
106
  envVitePlugin({ settings }),
107
107
  astroEnv({ settings, mode, sync }),
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "5.0.0-alpha.8";
25
+ const currentVersion = "5.0.0-beta.1";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -1435,7 +1435,7 @@ export declare const UnsupportedConfigTransformError: {
1435
1435
  /**
1436
1436
  * @docs
1437
1437
  * @see
1438
- * - [On-demand rendering](https://docs.astro.build/en/basics/rendering-modes/#on-demand-rendered)
1438
+ * - [On-demand rendering](https://5-0-0-beta.docs.astro.build/en/guides/on-demand-rendering/)
1439
1439
  * @description
1440
1440
  * Your project must have a server output to create backend functions with Actions.
1441
1441
  */
@@ -549,8 +549,8 @@ Full error: ${parseError}`,
549
549
  const ActionsWithoutServerOutputError = {
550
550
  name: "ActionsWithoutServerOutputError",
551
551
  title: "Actions must be used with server output.",
552
- message: "Actions enabled without setting a server build output. A server is required to create callable backend functions. To deploy routes to a server, add a server adapter to your astro config.",
553
- hint: "Learn about on-demand rendering: https://docs.astro.build/en/basics/rendering-modes/#on-demand-rendered"
552
+ message: "A server is required to create callable backend functions. To deploy routes to a server, add an adapter to your Astro config and configure your route for on-demand rendering",
553
+ hint: "Add an adapter and enable on-demand rendering: https://5-0-0-beta.docs.astro.build/en/guides/on-demand-rendering/"
554
554
  };
555
555
  const ActionsReturnedInvalidDataError = {
556
556
  name: "ActionsReturnedInvalidDataError",
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "5.0.0-alpha.8";
41
+ const version = "5.0.0-beta.1";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -270,7 +270,7 @@ function printHelp({
270
270
  message.push(
271
271
  linebreak(),
272
272
  ` ${bgGreen(black(` ${commandName} `))} ${green(
273
- `v${"5.0.0-alpha.8"}`
273
+ `v${"5.0.0-beta.1"}`
274
274
  )} ${headline}`
275
275
  );
276
276
  }
@@ -402,8 +402,8 @@ export interface AstroUserConfig {
402
402
  /**
403
403
  * @docs
404
404
  * @name security
405
- * @type {boolean}
406
- * @default `{}`
405
+ * @type {Record<"checkOrigin", boolean> | undefined}
406
+ * @default `{checkOrigin: true}`
407
407
  * @version 4.9.0
408
408
  * @description
409
409
  *
@@ -411,12 +411,16 @@ export interface AstroUserConfig {
411
411
  *
412
412
  * These features only exist for pages rendered on demand (SSR) using `server` mode or pages that opt out of prerendering in `static` mode.
413
413
  *
414
+ * By default, Astro will automatically check that the “origin” header
415
+ * matches the URL sent by each request in on-demand rendered pages. You can
416
+ * disable this behavior by setting `checkOrigin` to `false`:
417
+ *
414
418
  * ```js
415
419
  * // astro.config.mjs
416
420
  * export default defineConfig({
417
421
  * output: "server",
418
422
  * security: {
419
- * checkOrigin: true
423
+ * checkOrigin: false
420
424
  * }
421
425
  * })
422
426
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.0.0-alpha.8",
3
+ "version": "5.0.0-beta.1",
4
4
  "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
5
5
  "type": "module",
6
6
  "author": "withastro",
@@ -168,8 +168,8 @@
168
168
  "zod-to-json-schema": "^3.23.2",
169
169
  "zod-to-ts": "^1.2.0",
170
170
  "@astrojs/internal-helpers": "0.4.1",
171
- "@astrojs/telemetry": "3.1.0",
172
- "@astrojs/markdown-remark": "6.0.0-alpha.1"
171
+ "@astrojs/markdown-remark": "6.0.0-beta.1",
172
+ "@astrojs/telemetry": "3.1.0"
173
173
  },
174
174
  "optionalDependencies": {
175
175
  "sharp": "^0.33.3"
@@ -209,6 +209,7 @@
209
209
  "sass": "^1.78.0",
210
210
  "undici": "^6.19.8",
211
211
  "unified": "^11.0.5",
212
+ "vitest": "^2.1.1",
212
213
  "astro-scripts": "0.0.14"
213
214
  },
214
215
  "engines": {