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.
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +3 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.d.ts +7 -3
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +1 -1
- package/dist/core/errors/errors-data.js +2 -2
- package/dist/core/messages.js +2 -2
- package/dist/types/public/config.d.ts +7 -3
- package/package.json +4 -3
package/dist/config/index.d.ts
CHANGED
|
@@ -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:
|
|
5
|
+
mode: "dev";
|
|
6
6
|
command: "serve" | "build";
|
|
7
7
|
}) => Promise<Record<string, any>>;
|
package/dist/config/index.js
CHANGED
|
@@ -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);
|
package/dist/core/constants.js
CHANGED
|
@@ -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
|
-
|
|
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 {};
|
package/dist/core/create-vite.js
CHANGED
|
@@ -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
|
|
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 }),
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -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-
|
|
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/
|
|
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: "
|
|
553
|
-
hint: "
|
|
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",
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.0.0-
|
|
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-
|
|
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:
|
|
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-
|
|
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/
|
|
172
|
-
"@astrojs/
|
|
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": {
|