Skip to content

Commit

Permalink
Merge branch 'next' into feat/beta-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Sep 16, 2024
2 parents a811eca + 948ad8e commit 1e52746
Show file tree
Hide file tree
Showing 44 changed files with 335 additions and 72 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-pandas-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a type and an example in documenting the `security.checkOrigin` property of Astro config.
2 changes: 2 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eighty-boxes-applaud",
"five-jars-hear",
"fluffy-jars-live",
"fresh-pandas-drive",
"fuzzy-pugs-live",
"giant-rocks-thank",
"healthy-ads-scream",
Expand Down Expand Up @@ -77,6 +78,7 @@
"selfish-cats-crash",
"selfish-impalas-grin",
"sharp-worms-sniff",
"slimy-mice-dance",
"slimy-queens-hang",
"small-ties-sort",
"spotty-garlics-cheat",
Expand Down
5 changes: 5 additions & 0 deletions .changeset/slimy-mice-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes use of Vitest with Astro 5
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/mdx": "^4.0.0-alpha.2",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/container-with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest run"
},
"dependencies": {
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"@astrojs/react": "^3.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.1",
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@astrojs/vue": "^5.0.0-alpha.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"preact": "^10.23.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.5.3",
"@preact/signals": "^1.3.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"preact": "^10.23.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.6.2",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.4.1",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"solid-js": "^1.8.22"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^6.0.0-alpha.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"svelte": "^4.2.19"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^5.0.0-alpha.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"vue": "^3.4.38"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"html-minifier": "^4.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/server-islands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@tailwindcss/forms": "^0.5.9",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"postcss": "^8.4.45",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
"@astrojs/svelte": "^6.0.0-alpha.0",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"svelte": "^4.2.19"
}
}
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"sass": "^1.78.0",
"sharp": "^0.33.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/toolbar-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"./app": "./dist/app.js"
},
"devDependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/view-transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"devDependencies": {
"@astrojs/tailwind": "^6.0.0-alpha.0",
"@astrojs/node": "^9.0.0-alpha.1",
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^1.0.0-alpha.1",
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^6.0.0-alpha.1",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"hast-util-select": "^6.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.8"
"astro": "^5.0.0-alpha.9"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/mdx": "^4.0.0-alpha.2",
"@astrojs/preact": "^3.5.3",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"preact": "^10.23.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.5.3",
"@nanostores/preact": "^0.5.2",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"nanostores": "^0.11.3",
"preact": "^10.23.2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/mdx": "^4.0.0-alpha.2",
"@astrojs/tailwind": "^6.0.0-alpha.0",
"@types/canvas-confetti": "^1.6.4",
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.45",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^5.0.0-alpha.8",
"astro": "^5.0.0-alpha.9",
"vitest": "^2.0.5"
}
}
8 changes: 8 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# astro

## 5.0.0-alpha.9

### Patch Changes

- [#12011](https://github.com/withastro/astro/pull/12011) [`cfdaab2`](https://github.com/withastro/astro/commit/cfdaab257cd167e0d4631ab66d9406754b3c1836) Thanks [@ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes a type and an example in documenting the `security.checkOrigin` property of Astro config.

- [#12009](https://github.com/withastro/astro/pull/12009) [`f10a3b7`](https://github.com/withastro/astro/commit/f10a3b7fe6892bd2f4f98ad602a64cfe6efde061) Thanks [@matthewp](https://github.com/matthewp)! - Fixes use of Vitest with Astro 5

## 5.0.0-alpha.8

### Major Changes
Expand Down
5 changes: 3 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "5.0.0-alpha.8",
"version": "5.0.0-alpha.9",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down Expand Up @@ -224,7 +224,8 @@
"rollup": "^4.21.2",
"sass": "^1.78.0",
"undici": "^6.19.8",
"unified": "^11.0.5"
"unified": "^11.0.5",
"vitest": "^2.1.1"
},
"engines": {
"node": "^18.17.1 || ^20.3.0 || >=21.0.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/astro/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { UserConfig as ViteUserConfig } from 'vite';
import { Logger } from '../core/logger/core.js';
import { createRouteManifest } from '../core/routing/index.js';
import type { AstroInlineConfig, AstroUserConfig } from '../types/public/config.js';
import { createDevelopmentManifest } from '../vite-plugin-astro-server/plugin.js';

export function defineConfig(config: AstroUserConfig) {
return config;
Expand All @@ -12,7 +13,7 @@ export function getViteConfig(
inlineAstroConfig: AstroInlineConfig = {},
) {
// Return an async Vite config getter which exposes a resolved `mode` and `command`
return async ({ mode, command }: { mode: string; command: 'serve' | 'build' }) => {
return async ({ mode, command }: { mode: 'dev'; command: 'serve' | 'build' }) => {
// Vite `command` is `serve | build`, but Astro uses `dev | build`
const cmd = command === 'serve' ? 'dev' : command;

Expand Down Expand Up @@ -42,6 +43,7 @@ export function getViteConfig(
let settings = await createSettings(config, userViteConfig.root);
settings = await runHookConfigSetup({ settings, command: cmd, logger });
const manifest = await createRouteManifest({ settings }, logger);
const devSSRManifest = createDevelopmentManifest(settings);
const viteConfig = await createVite(
{
mode,
Expand All @@ -50,7 +52,7 @@ export function getViteConfig(
astroContentListenPlugin({ settings, logger, fs }),
],
},
{ settings, logger, mode, sync: false, manifest },
{ settings, logger, mode, sync: false, manifest, ssrManifest: devSSRManifest },
);
await runHookConfigDone({ settings, logger });
return mergeConfig(viteConfig, userViteConfig);
Expand Down
18 changes: 12 additions & 6 deletions packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,24 @@ import { joinPaths } from './path.js';
import { vitePluginServerIslands } from './server-islands/vite-plugin-server-islands.js';
import { isObject } from './util.js';

interface CreateViteOptions {
type CreateViteOptions = {
settings: AstroSettings;
logger: Logger;
mode: 'dev' | 'build' | string;
// will be undefined when using `getViteConfig`
command?: 'dev' | 'build';
fs?: typeof nodeFs;
sync: boolean;
manifest: ManifestData;
ssrManifest?: SSRManifest;
}
} & (
| {
mode: 'dev';
ssrManifest: SSRManifest;
}
| {
mode: 'build';
ssrManifest?: SSRManifest;
}
);

const ALWAYS_NOEXTERNAL = [
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
Expand Down Expand Up @@ -134,8 +141,7 @@ export async function createVite(
astroScriptsPlugin({ settings }),
// The server plugin is for dev only and having it run during the build causes
// the build to run very slow as the filewatcher is triggered often.
mode !== 'build' &&
vitePluginAstroServer({ settings, logger, fs, manifest, ssrManifest: ssrManifest! }), // ssrManifest is only required in dev mode, where it gets created before a Vite instance is created, and get passed to this function
mode === 'dev' && vitePluginAstroServer({ settings, logger, fs, manifest, ssrManifest }), // ssrManifest is only required in dev mode, where it gets created before a Vite instance is created, and get passed to this function
envVitePlugin({ settings }),
astroEnv({ settings, mode, sync }),
markdownVitePlugin({ settings, logger }),
Expand Down
Loading

0 comments on commit 1e52746

Please sign in to comment.