diff --git a/.changeset/blue-spiders-carry.md b/.changeset/blue-spiders-carry.md new file mode 100644 index 0000000000..a9819f5db5 --- /dev/null +++ b/.changeset/blue-spiders-carry.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a bug where MDX files with certain characters in the name would cause builds to fail diff --git a/.changeset/famous-teachers-hug.md b/.changeset/famous-teachers-hug.md new file mode 100644 index 0000000000..988f2993f9 --- /dev/null +++ b/.changeset/famous-teachers-hug.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix a bug that caused builds to fail if an image had a quote mark in its name diff --git a/.changeset/fast-adults-lick.md b/.changeset/fast-adults-lick.md new file mode 100644 index 0000000000..22b2617bed --- /dev/null +++ b/.changeset/fast-adults-lick.md @@ -0,0 +1,6 @@ +--- +'@astrojs/markdoc': patch +'astro': patch +--- + +Fixes a bug where the experimental feature `experimental.svg` was incorrectly used when generating ESM images diff --git a/.changeset/green-coins-tie.md b/.changeset/green-coins-tie.md new file mode 100644 index 0000000000..349bf67244 --- /dev/null +++ b/.changeset/green-coins-tie.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vue': patch +--- + +fix vite peer dependency issue for vue integration diff --git a/.changeset/shy-worms-talk.md b/.changeset/shy-worms-talk.md new file mode 100644 index 0000000000..c22501e2d2 --- /dev/null +++ b/.changeset/shy-worms-talk.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes astro info copy to clipboard process not returning to prompt in certain cases. diff --git a/.changeset/unlucky-kids-compete.md b/.changeset/unlucky-kids-compete.md deleted file mode 100644 index e4b59791ea..0000000000 --- a/.changeset/unlucky-kids-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes a regression where Astro was trying to access `Request.headers` diff --git a/.github/ISSUE_TEMPLATE/---01-bug-report.yml b/.github/ISSUE_TEMPLATE/---01-bug-report.yml index 3a2ec98666..9f9bb166de 100644 --- a/.github/ISSUE_TEMPLATE/---01-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/---01-bug-report.yml @@ -42,7 +42,7 @@ body: id: bug-reproduction attributes: label: Link to Minimal Reproducible Example - description: 'Use [astro.new](https://astro.new) to create a minimal reproduction of the problem. **A minimal reproduction is required** so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed. Not sure how to create a minimal example? [Read our guide](https://docs.astro.build/en/guides/troubleshooting/#creating-minimal-reproductions)' + description: 'Use [StackBlitz](https://astro.new/repro) to create a minimal reproduction of the problem. **A minimal reproduction is required** so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed. Not sure how to create a minimal example? [Read our guide](https://docs.astro.build/en/guides/troubleshooting/#creating-minimal-reproductions)' placeholder: 'https://stackblitz.com/abcd1234' validations: required: true diff --git a/.github/labeler.yml b/.github/labeler.yml index c1025ad117..b0d27800ba 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -40,5 +40,5 @@ - packages/integrations/vue/** 'docs pr': -- packages/astro/src/@types/astro.ts +- packages/astro/src/types/public/** - packages/astro/src/core/errors/errors-data.ts diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 527ef6df7d..ead596c395 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -16,6 +16,7 @@ "@biomejs/biome", "@types/node", "@preact/preset-vite", // v2.8.3 starts to use Vite's esbuild for perf, but this conflicts with the react plugin + "astro-embed", // TODO: investigate upgrade (zod import issues with atproto) "drizzle-orm", // TODO: investigate upgrade (has type issues) "sharp", diff --git a/.github/scripts/announce.mjs b/.github/scripts/announce.mjs index 2e05a7ae8a..df73040372 100755 --- a/.github/scripts/announce.mjs +++ b/.github/scripts/announce.mjs @@ -6,7 +6,7 @@ import { setOutput } from './utils.mjs'; const { GITHUB_REF = 'main' } = process.env; const baseUrl = new URL(`https://github.com/withastro/astro/blob/${GITHUB_REF}/`); -const emojis = ['🎉', '🥳', '🚀', '🧑‍🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌']; +const emojis = ['🎉', '🥳', '🚀', '🧑', '🎊', '🏆', '✅', '🤩', '🤖', '🙌']; const descriptors = [ 'new releases', 'hot and fresh updates', @@ -141,7 +141,7 @@ async function generateMessage() { message += `\nAlso ${item(extraVerbs)}:`; const remainingPackages = packages.filter((p) => p.name !== name); - for (const { name, version, url } of remainingPackages) { + for (const { name, version, _url } of remainingPackages) { message += `\n• \`${name}@${version}\``; } @@ -159,7 +159,7 @@ async function generateMessage() { async function run() { const content = await generateMessage(); - console.log(content); + console.info(content); setOutput('DISCORD_MESSAGE', content); } diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index f265b5fedb..85dbb1c948 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -39,7 +39,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c1b4919901..f8c7ceb49d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ on: - "examples/**" - ".github/workflows/check.yml" - "scripts/smoke/check.js" - - "packages/astro/src/@types/astro.ts" + - "packages/astro/src/types/public/**" - "pnpm-lock.yaml" - "packages/astro/types.d.ts" @@ -36,7 +36,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cde351c7c2..e7bb0eb7b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - next merge_group: pull_request: paths-ignore: @@ -39,7 +38,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] + NODE_VERSION: [22] fail-fast: true steps: # Disable crlf so all OS can share the same Turbo cache @@ -86,7 +85,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies @@ -109,12 +108,12 @@ jobs: strategy: matrix: OS: [ubuntu-latest] - NODE_VERSION: [18, 20] + NODE_VERSION: [18, 20, 22] include: - os: macos-14 - NODE_VERSION: 18 + NODE_VERSION: 22 - os: windows-latest - NODE_VERSION: 18 + NODE_VERSION: 22 fail-fast: false env: NODE_VERSION: ${{ matrix.NODE_VERSION }} @@ -151,7 +150,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] + NODE_VERSION: [22] fail-fast: false env: NODE_VERSION: ${{ matrix.NODE_VERSION }} @@ -188,7 +187,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] + NODE_VERSION: [22] env: NODE_VERSION: ${{ matrix.NODE_VERSION }} steps: @@ -238,7 +237,7 @@ jobs: filters: | docs: - 'packages/integrations/*/README.md' - - 'packages/astro/src/@types/astro.ts' + - "packages/astro/src/types/public/**" - 'packages/astro/src/core/errors/errors-data.ts' - name: Build autogenerated docs pages from current astro branch diff --git a/.github/workflows/continuous_benchmark.yml b/.github/workflows/continuous_benchmark.yml index 00a7e0c5b1..1b382f8dc6 100644 --- a/.github/workflows/continuous_benchmark.yml +++ b/.github/workflows/continuous_benchmark.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies @@ -47,9 +47,10 @@ jobs: run: pnpm run build - name: Run the benchmarks - uses: CodSpeedHQ/action@fa1dcde8d58f2ab0b407a6a24d6cc5a8c1444a8c # v3.1.0 + uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2.0 timeout-minutes: 30 with: - run: pnpm benchmark codspeed + working-directory: ./benchmark + run: pnpm bench token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/.github/workflows/examples-deploy.yml b/.github/workflows/examples-deploy.yml new file mode 100644 index 0000000000..91ef304f01 --- /dev/null +++ b/.github/workflows/examples-deploy.yml @@ -0,0 +1,22 @@ +# This workflow runs when changes to examples are pushed to main. +# It calls a build hook on Netlify that will redeploy preview.astro.new with the latest changes. + +name: Redeploy preview.astro.new + +on: + push: + branches: + - main + paths: + - 'examples/**' + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Send a POST request to Netlify to rebuild preview.astro.new + run: 'curl -X POST -d {} ${{ env.BUILD_HOOK }}' + env: + BUILD_HOOK: ${{ secrets.NETLIFY_PREVIEWS_BUILD_HOOK }} diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 8723639c7f..b0a0e80c77 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -26,5 +26,5 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | - Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://astro.new). Issues marked with `needs repro` will be closed if they have no activity within 3 days. + Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://astro.new/repro). Issues marked with `needs repro` will be closed if they have no activity within 3 days. labels: "needs triage" diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index df6a44f484..bba55c028e 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -47,7 +47,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb5cd362e5..738028a744 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: - "1-legacy" - "2-legacy" - "3-legacy" - - next + - "4-legacy" defaults: run: @@ -35,7 +35,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index df934876ab..542f943ac3 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/snapshot-release.yml b/.github/workflows/snapshot-release.yml index ae8d3060fa..c12834264c 100644 --- a/.github/workflows/snapshot-release.yml +++ b/.github/workflows/snapshot-release.yml @@ -63,7 +63,13 @@ jobs: ref: ${{ steps.refs.outputs.head_ref }} fetch-depth: 0 - - run: git fetch origin main:main + - name: Extract base branch from .changeset/config.json + id: getBaseBranch + run: | + baseBranch=$(jq -r '.baseBranch' .changeset/config.json) + echo "baseBranch=${baseBranch}" >> $GITHUB_OUTPUT + + - run: git fetch origin ${{ steps.getBaseBranch.outputs.baseBranch }}:${{ steps.getBaseBranch.outputs.baseBranch }} - name: Setup PNPM uses: pnpm/action-setup@v3 @@ -71,7 +77,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 registry-url: "https://registry.npmjs.org" cache: "pnpm" diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml index a18d62738e..8603a951e8 100644 --- a/.github/workflows/sync-examples.yml +++ b/.github/workflows/sync-examples.yml @@ -12,7 +12,6 @@ on: push: branches: - main - - next # Automatically cancel in-progress actions on the same branch concurrency: diff --git a/.github/workflows/test-hosts.yml b/.github/workflows/test-hosts.yml index e26e250d23..546d82e07a 100644 --- a/.github/workflows/test-hosts.yml +++ b/.github/workflows/test-hosts.yml @@ -27,7 +27,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 cache: 'pnpm' - name: Install dependencies diff --git a/.vscode/settings.json b/.vscode/settings.json index a626d0892c..97aeabec0f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,7 +15,7 @@ "editor.defaultFormatter": "biomejs.biome" }, "editor.codeActionsOnSave": { - "quickFix.biome": "explicit", - "source.fixAll.biome": "explicit" - } + "quickFix.biome": "explicit", + "source.fixAll.biome": "explicit" + } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4464b99fbe..d44be03b8c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -289,7 +289,7 @@ Server-side rendering (SSR) can be complicated. The Astro package (`packages/ast - `components/`: Built-in components to use in your project (e.g. `import Code from 'astro/components/Code.astro'`) - `src/`: Astro source - - `@types/`: TypeScript types. These are centralized to cut down on circular dependencies + - `types/`: TypeScript types. These are centralized to cut down on circular dependencies - `cli/`: Code that powers the `astro` CLI command - `core/`: Code that executes **in the top-level scope** (in Node). Within, you’ll find code that powers the `astro build` and `astro dev` commands, as well as top-level SSR code. - `runtime/`: Code that executes **in different scopes** (i.e. not in a pure Node context). You’ll have to think about code differently here. @@ -369,20 +369,22 @@ Full documentation: https://github.com/changesets/changesets/blob/main/docs/prer ### Entering prerelease mode -If you have gotten permission from the core contributors, you can enter into prerelease mode by following the following steps: +If you have gotten permission from the core contributors, you can enter into prerelease mode with the following steps: - Run: `pnpm exec changeset pre enter next` in the project root +- Update `.changeset/config.json` with `"baseBranch": "next"` (for easier changesets creation) - Create a new PR from the changes created by this command -- Review, approve, and more the PR to enter prerelease mode. +- Review, approve, and merge the PR to enter prerelease mode. - If successful, The "[ci] release" PR (if one exists) will now say "[ci] release (next)". ### Exiting prerelease mode -Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor run these steps. These steps should be run before +Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor can run these steps: - Run: `pnpm exec changeset pre exit` in the project root +- Update `.changeset/config.json` with `"baseBranch": "main"` - Create a new PR from the changes created by this command. -- Review, approve, and more the PR to enter prerelease mode. +- Review, approve, and merge the PR to enter prerelease mode. - If successful, The "[ci] release (next)" PR (if one exists) will now say "[ci] release". ### Releasing `astro@latest` while in prerelease mode diff --git a/README.md b/README.md index 668594fdf5..f42323a863 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@
[![main](https://github.com/withastro/astro/actions/workflows/ci.yml/badge.svg)](https://github.com/withastro/astro/actions/workflows/ci.yml) -[![next](https://github.com/withastro/astro/actions/workflows/ci.yml/badge.svg?branch=next)](https://github.com/withastro/astro/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/withastro/astro/blob/main/LICENSE) [![npm version](https://badge.fury.io/js/astro.svg)](https://badge.fury.io/js/astro) diff --git a/benchmark/bench/_template.js b/benchmark/bench/_template.js index 867ecf13b6..ae96d72ad5 100644 --- a/benchmark/bench/_template.js +++ b/benchmark/bench/_template.js @@ -6,7 +6,7 @@ export const defaultProject = 'project-name'; * Use `console.log` to report the results too. Logs that start with 10 `=` * and end with 10 `=` will be extracted by CI to display in the PR comment. * Usually after the first 10 `=` you'll want to add a title like `#### Test`. - * @param {URL} projectDir - * @param {URL} outputFile + * @param {URL} _projectDir + * @param {URL} _outputFile */ -export async function run(projectDir, outputFile) {} +export async function run(_projectDir, _outputFile) {} diff --git a/benchmark/bench/_util.js b/benchmark/bench/_util.js index b16a16e1ce..d9dfe5b190 100644 --- a/benchmark/bench/_util.js +++ b/benchmark/bench/_util.js @@ -19,3 +19,14 @@ export function calculateStat(numbers) { const max = Math.max(...numbers); return { avg, stdev, max }; } + +export async function makeProject(name) { + console.log('Making project:', name); + const projectDir = new URL(`../projects/${name}/`, import.meta.url); + + const makeProjectMod = await import(`../make-project/${name}.js`); + await makeProjectMod.run(projectDir); + + console.log('Finished making project:', name); + return projectDir; +} diff --git a/benchmark/bench/codspeed.bench.js b/benchmark/bench/codspeed.bench.js new file mode 100644 index 0000000000..4073ebed85 --- /dev/null +++ b/benchmark/bench/codspeed.bench.js @@ -0,0 +1,48 @@ +import { fileURLToPath } from 'node:url'; +import { exec } from 'tinyexec'; +import { beforeAll, bench, describe } from 'vitest'; +import { astroBin, makeProject } from './_util.js'; +let streamingApp; +let nonStreamingApp; +beforeAll(async () => { + const render = await makeProject('render-bench'); + const root = fileURLToPath(render); + await exec(astroBin, ['build'], { + nodeOptions: { + cwd: root, + stdio: 'inherit', + }, + }); + const entry = new URL('./dist/server/entry.mjs', `file://${root}`); + const { manifest, createApp } = await import(entry); + streamingApp = createApp(manifest, true); + nonStreamingApp = createApp(manifest, false); +}, 900000); + +describe('Bench rendering', () => { + bench('Rendering: streaming [true], .astro file', async () => { + const request = new Request(new URL('http://exmpale.com/astro')); + await streamingApp.render(request); + }); + bench('Rendering: streaming [true], .md file', async () => { + const request = new Request(new URL('http://exmpale.com/md')); + await streamingApp.render(request); + }); + bench('Rendering: streaming [true], .mdx file', async () => { + const request = new Request(new URL('http://exmpale.com/mdx')); + await streamingApp.render(request); + }); + + bench('Rendering: streaming [false], .astro file', async () => { + const request = new Request(new URL('http://exmpale.com/astro')); + await nonStreamingApp.render(request); + }); + bench('Rendering: streaming [false], .md file', async () => { + const request = new Request(new URL('http://exmpale.com/md')); + await nonStreamingApp.render(request); + }); + bench('Rendering: streaming [false], .mdx file', async () => { + const request = new Request(new URL('http://exmpale.com/mdx')); + await nonStreamingApp.render(request); + }); +}); diff --git a/benchmark/bench/codspeed.js b/benchmark/bench/codspeed.js deleted file mode 100644 index 2643b1ec8a..0000000000 --- a/benchmark/bench/codspeed.js +++ /dev/null @@ -1,64 +0,0 @@ -import path from 'node:path'; -import { withCodSpeed } from '@codspeed/tinybench-plugin'; -import { Bench } from 'tinybench'; -import { exec } from 'tinyexec'; -import { astroBin } from './_util.js'; - -export async function run({ memory: _memory, render, stress: _stress }) { - const options = { - iterations: 10, - }; - const bench = process.env.CODSPEED ? withCodSpeed(new Bench(options)) : new Bench(options); - await exec(astroBin, ['build'], { - nodeOptions: { - cwd: render.root, - stdio: 'inherit', - }, - }); - - const entry = new URL('./dist/server/entry.mjs', `file://${render.root}`); - const { manifest, createApp } = await import(entry); - const streamingApp = createApp(manifest, true); - const nonStreamingApp = createApp(manifest, false); - bench - .add('Rendering: streaming [true], .astro file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/astro')); - await streamingApp.render(request); - console.info('Finish task.'); - }) - .add('Rendering: streaming [true], .md file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/md')); - await streamingApp.render(request); - console.info('Finish task.'); - }) - .add('Rendering: streaming [true], .mdx file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/mdx')); - await streamingApp.render(request); - console.info('Finish task.'); - }) - - .add('Rendering: streaming [false], .astro file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/astro')); - await nonStreamingApp.render(request); - console.info('Finish task.'); - }) - .add('Rendering: streaming [false], .md file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/md')); - await nonStreamingApp.render(request); - console.info('Finish task.'); - }) - .add('Rendering: streaming [false], .mdx file', async () => { - console.info('Start task.'); - const request = new Request(new URL('http://exmpale.com/mdx')); - await nonStreamingApp.render(request); - console.info('Finish task.'); - }); - - await bench.run(); - console.table(bench.table()); -} diff --git a/benchmark/index.js b/benchmark/index.js index 2f2846e1db..956b9c3afa 100755 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -1,7 +1,8 @@ -import mri from 'mri'; import fs from 'node:fs/promises'; import path from 'node:path'; -import {fileURLToPath, pathToFileURL} from 'node:url'; +import { fileURLToPath, pathToFileURL } from 'node:url'; +import mri from 'mri'; +import { makeProject } from './bench/_util.js'; const args = mri(process.argv.slice(2)); @@ -14,7 +15,6 @@ Command memory Run build memory and speed test render Run rendering speed test server-stress Run server stress test - codspeed Run codspeed test cli-startup Run CLI startup speed test Options @@ -30,7 +30,6 @@ const benchmarks = { render: () => import('./bench/render.js'), 'server-stress': () => import('./bench/server-stress.js'), 'cli-startup': () => import('./bench/cli-startup.js'), - codspeed: () => import('./bench/codspeed.js') }; if (commandName && !(commandName in benchmarks)) { @@ -39,26 +38,12 @@ if (commandName && !(commandName in benchmarks)) { } if (commandName) { - if (commandName === 'codspeed') { - const render = await makeProject('render-bench'); - const rootRender = fileURLToPath(render); - const bench = benchmarks[commandName]; - const benchMod = await bench(); - const payload = { - render: { - root: rootRender, - output: await getOutputFile('render') - }, - }; - await benchMod.run(payload); - } else { - // Run single benchmark - const bench = benchmarks[commandName]; - const benchMod = await bench(); - const projectDir = await makeProject(args.project || benchMod.defaultProject); - const outputFile = await getOutputFile(commandName); - await benchMod.run(projectDir, outputFile); - } + // Run single benchmark + const bench = benchmarks[commandName]; + const benchMod = await bench(); + const projectDir = await makeProject(args.project || benchMod.defaultProject); + const outputFile = await getOutputFile(commandName); + await benchMod.run(projectDir, outputFile); } else { // Run all benchmarks for (const name in benchmarks) { @@ -70,21 +55,10 @@ if (commandName) { } } -export async function makeProject(name) { - console.log('Making project:', name); - const projectDir = new URL(`./projects/${name}/`, import.meta.url); - - const makeProjectMod = await import(`./make-project/${name}.js`); - await makeProjectMod.run(projectDir); - - console.log('Finished making project:', name); - return projectDir; -} - /** * @param {string} benchmarkName */ -async function getOutputFile(benchmarkName) { +export async function getOutputFile(benchmarkName) { let file; if (args.output) { file = pathToFileURL(path.resolve(args.output)); diff --git a/benchmark/make-project/markdown-cc1.js b/benchmark/make-project/markdown-cc1.js index 6c83959601..1e3aaa5177 100644 --- a/benchmark/make-project/markdown-cc1.js +++ b/benchmark/make-project/markdown-cc1.js @@ -8,11 +8,13 @@ export async function run(projectDir) { await fs.rm(projectDir, { recursive: true, force: true }); await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true }); await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true }); - await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir)); + await fs.copyFile( + new URL('./image.jpg', import.meta.url), + new URL('./src/image.jpg', projectDir), + ); const promises = []; - for (let i = 0; i < 10000; i++) { const content = `\ # Article ${i} @@ -24,11 +26,10 @@ ${loremIpsumMd} `; promises.push( - fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8'), ); } - await fs.writeFile( new URL(`./src/pages/blog/[...slug].astro`, projectDir), `\ @@ -46,7 +47,7 @@ const { Content } = await entry.render();

{entry.data.title}

`, - 'utf-8' + 'utf-8', ); await Promise.all(promises); @@ -58,6 +59,6 @@ import { defineConfig } from 'astro/config'; export default defineConfig({ });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/markdown-cc2.js b/benchmark/make-project/markdown-cc2.js index 73c6afe7a8..ba60813c0d 100644 --- a/benchmark/make-project/markdown-cc2.js +++ b/benchmark/make-project/markdown-cc2.js @@ -23,7 +23,7 @@ ${loremIpsumMd} `; promises.push( - fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8'), ); } @@ -39,7 +39,7 @@ ${loremIpsumMd} export const collections = { blog } - ` + `, ); await fs.writeFile( @@ -60,7 +60,7 @@ const { Content } = await render(entry);

{entry.data.title}

`, - 'utf-8' + 'utf-8', ); await Promise.all(promises); @@ -70,11 +70,7 @@ const { Content } = await render(entry); `\ import { defineConfig } from 'astro/config'; -export default defineConfig({ - experimental: { - contentLayer: true - } -});`, - 'utf-8' +export default defineConfig({});`, + 'utf-8', ); } diff --git a/benchmark/make-project/mdx-cc1.js b/benchmark/make-project/mdx-cc1.js index 98e1495d13..a948ce1940 100644 --- a/benchmark/make-project/mdx-cc1.js +++ b/benchmark/make-project/mdx-cc1.js @@ -8,11 +8,13 @@ export async function run(projectDir) { await fs.rm(projectDir, { recursive: true, force: true }); await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true }); await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true }); - await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir)); + await fs.copyFile( + new URL('./image.jpg', import.meta.url), + new URL('./src/image.jpg', projectDir), + ); const promises = []; - for (let i = 0; i < 10000; i++) { const content = `\ # Article ${i} @@ -24,11 +26,10 @@ ${loremIpsumMd} `; promises.push( - fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8'), ); } - await fs.writeFile( new URL(`./src/pages/blog/[...slug].astro`, projectDir), `\ @@ -46,7 +47,7 @@ const { Content } = await entry.render();

{entry.data.title}

`, - 'utf-8' + 'utf-8', ); await Promise.all(promises); @@ -61,6 +62,6 @@ import mdx from '@astrojs/mdx'; export default defineConfig({ integrations: [mdx()], });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/mdx-cc2.js b/benchmark/make-project/mdx-cc2.js index c08c2fb9fe..f50b63c9ee 100644 --- a/benchmark/make-project/mdx-cc2.js +++ b/benchmark/make-project/mdx-cc2.js @@ -23,7 +23,7 @@ ${loremIpsumMd} `; promises.push( - fs.writeFile(new URL(`./data/blog/article-${i}.mdx`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./data/blog/article-${i}.mdx`, projectDir), content, 'utf-8'), ); } @@ -39,7 +39,7 @@ ${loremIpsumMd} export const collections = { blog } - ` + `, ); await fs.writeFile( @@ -60,7 +60,7 @@ const { Content } = await render(entry);

{entry.data.title}

`, - 'utf-8' + 'utf-8', ); await Promise.all(promises); @@ -74,10 +74,7 @@ import mdx from '@astrojs/mdx'; export default defineConfig({ integrations: [mdx()], - experimental: { - contentLayer: true - } });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/memory-default.js b/benchmark/make-project/memory-default.js index e3652dd579..1087c3d4aa 100644 --- a/benchmark/make-project/memory-default.js +++ b/benchmark/make-project/memory-default.js @@ -20,7 +20,7 @@ const i = ${i}; {i} `; promises.push( - fs.writeFile(new URL(`./src/pages/page-${i}.astro`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./src/pages/page-${i}.astro`, projectDir), content, 'utf-8'), ); } @@ -31,7 +31,7 @@ const i = ${i}; ${loremIpsum} `; promises.push( - fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8'), ); } @@ -42,7 +42,7 @@ ${loremIpsum} ${loremIpsum} `; promises.push( - fs.writeFile(new URL(`./src/content/blog/post-${i}.mdx`, projectDir), content, 'utf-8') + fs.writeFile(new URL(`./src/content/blog/post-${i}.mdx`, projectDir), content, 'utf-8'), ); } @@ -63,7 +63,7 @@ const { Content } = await entry.render();

{entry.data.title}

`, - 'utf-8' + 'utf-8', ); await Promise.all(promises); @@ -77,6 +77,6 @@ import mdx from '@astrojs/mdx'; export default defineConfig({ integrations: [mdx()], });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/render-bench.js b/benchmark/make-project/render-bench.js index 9d10d9bf5f..e2964fbd23 100644 --- a/benchmark/make-project/render-bench.js +++ b/benchmark/make-project/render-bench.js @@ -112,7 +112,7 @@ export async function run(projectDir) { await Promise.all( Object.entries(renderFiles).map(([name, content]) => { return fs.writeFile(new URL(`./src/${name}`, projectDir), content, 'utf-8'); - }) + }), ); await fs.writeFile( @@ -127,6 +127,6 @@ export default defineConfig({ output: 'server', adapter: adapter(), });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/render-default.js b/benchmark/make-project/render-default.js index f42340fd3b..7ea54b936e 100644 --- a/benchmark/make-project/render-default.js +++ b/benchmark/make-project/render-default.js @@ -112,7 +112,7 @@ export async function run(projectDir) { await Promise.all( Object.entries(renderFiles).map(([name, content]) => { return fs.writeFile(new URL(`./src/${name}`, projectDir), content, 'utf-8'); - }) + }), ); await fs.writeFile( @@ -127,6 +127,6 @@ export default defineConfig({ output: 'server', adapter: timer(), });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/make-project/server-stress-default.js b/benchmark/make-project/server-stress-default.js index 79e8b260af..1724f8f825 100644 --- a/benchmark/make-project/server-stress-default.js +++ b/benchmark/make-project/server-stress-default.js @@ -38,13 +38,13 @@ const content = "${loremIpsum}"
`, - 'utf-8' + 'utf-8', ); await fs.writeFile( new URL('./src/components/Paragraph.astro', projectDir), `
{Astro.props.num} {Astro.props.str}
`, - 'utf-8' + 'utf-8', ); await fs.writeFile( @@ -57,6 +57,6 @@ export default defineConfig({ output: 'server', adapter: nodejs({ mode: 'standalone' }), });`, - 'utf-8' + 'utf-8', ); } diff --git a/benchmark/package.json b/benchmark/package.json index 428afe56d2..708ee14d12 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -6,6 +6,9 @@ "bin": { "astro-benchmark": "./index.js" }, + "scripts": { + "bench": "pnpm vitest bench --run" + }, "dependencies": { "@astrojs/mdx": "workspace:*", "@astrojs/node": "^8.3.4", @@ -21,7 +24,7 @@ "tinyexec": "^0.3.1" }, "devDependencies": { - "@codspeed/tinybench-plugin": "^3.1.1", - "tinybench": "^2.9.0" + "@codspeed/vitest-plugin": "3.1.1", + "vitest": "2.1.8" } } diff --git a/benchmark/vitest.config.js b/benchmark/vitest.config.js new file mode 100644 index 0000000000..b8b6e5e52a --- /dev/null +++ b/benchmark/vitest.config.js @@ -0,0 +1,7 @@ +import codspeedPlugin from '@codspeed/vitest-plugin'; +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + plugins: process.env.CODSPEED ? [codspeedPlugin()] : [], + include: ['./bench/codspeed.bench.js'], +}); diff --git a/biome.jsonc b/biome.jsonc index adadd8f597..bab1f1a05b 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -2,7 +2,7 @@ "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json", "files": { "ignore": ["**/smoke/**", "**/fixtures/**", "**/_temp-fixtures/**", "**/vendor/**"], - "include": ["test/**", "e2e/**", "packages/**", "scripts/**", "benchmark/bench"], + "include": ["test/**", "e2e/**", "packages/**", "scripts/**", "benchmark"], }, "vcs": { "enabled": true, diff --git a/examples/basics/README.md b/examples/basics/README.md index 1db3fb3991..ff19a3e7ec 100644 --- a/examples/basics/README.md +++ b/examples/basics/README.md @@ -21,8 +21,6 @@ Inside of your Astro project, you'll see the following folders and files: ├── public/ │ └── favicon.svg ├── src/ -│ ├── components/ -│ │ └── Card.astro │ ├── layouts/ │ │ └── Layout.astro │ └── pages/ @@ -30,11 +28,7 @@ Inside of your Astro project, you'll see the following folders and files: └── package.json ``` -Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. - -There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. - -Any static assets, like images, can be placed in the `public/` directory. +To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/). ## 🧞 Commands diff --git a/examples/basics/astro.config.mjs b/examples/basics/astro.config.mjs index 882e6515a6..e762ba5cf6 100644 --- a/examples/basics/astro.config.mjs +++ b/examples/basics/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; // https://astro.build/config diff --git a/examples/basics/package.json b/examples/basics/package.json index c97f2010ed..405176a207 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -5,12 +5,11 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "astro": "^4.16.14" + "astro": "^5.0.4" } } diff --git a/examples/basics/src/assets/astro.svg b/examples/basics/src/assets/astro.svg new file mode 100644 index 0000000000..8cf8fb0c7d --- /dev/null +++ b/examples/basics/src/assets/astro.svg @@ -0,0 +1 @@ + diff --git a/examples/basics/src/assets/background.svg b/examples/basics/src/assets/background.svg new file mode 100644 index 0000000000..4b2be0ac0e --- /dev/null +++ b/examples/basics/src/assets/background.svg @@ -0,0 +1 @@ + diff --git a/examples/basics/src/components/Card.astro b/examples/basics/src/components/Card.astro deleted file mode 100644 index bd6d5971eb..0000000000 --- a/examples/basics/src/components/Card.astro +++ /dev/null @@ -1,61 +0,0 @@ ---- -interface Props { - title: string; - body: string; - href: string; -} - -const { href, title, body } = Astro.props; ---- - - - diff --git a/examples/basics/src/components/Welcome.astro b/examples/basics/src/components/Welcome.astro new file mode 100644 index 0000000000..6b7b9c70e8 --- /dev/null +++ b/examples/basics/src/components/Welcome.astro @@ -0,0 +1,209 @@ +--- +import astroLogo from '../assets/astro.svg'; +import background from '../assets/background.svg'; +--- + +
+ +
+
+ Astro Homepage +

+ To get started, open the
src/pages
directory in your project. +

+ +
+
+ + + +

What's New in Astro 5.0?

+

+ From content layers to server islands, click to learn more about the new features and + improvements in Astro 5.0 +

+
+
+ + diff --git a/examples/basics/src/env.d.ts b/examples/basics/src/env.d.ts deleted file mode 100644 index 9bc5cb41c2..0000000000 --- a/examples/basics/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// \ No newline at end of file diff --git a/examples/basics/src/layouts/Layout.astro b/examples/basics/src/layouts/Layout.astro index 181097125d..e455c61067 100644 --- a/examples/basics/src/layouts/Layout.astro +++ b/examples/basics/src/layouts/Layout.astro @@ -1,50 +1,22 @@ ---- -interface Props { - title: string; -} - -const { title } = Astro.props; ---- - - - {title} + Astro Basics - diff --git a/examples/basics/src/pages/index.astro b/examples/basics/src/pages/index.astro index fb6262872d..c04f3602b5 100644 --- a/examples/basics/src/pages/index.astro +++ b/examples/basics/src/pages/index.astro @@ -1,123 +1,11 @@ --- +import Welcome from '../components/Welcome.astro'; import Layout from '../layouts/Layout.astro'; -import Card from '../components/Card.astro'; + +// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build +// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh. --- - -
- -

Welcome to Astro

-

- To get started, open the directory src/pages in your project.
- Code Challenge: Tweak the "Welcome to Astro" message above. -

- -
+ + - - diff --git a/examples/basics/tsconfig.json b/examples/basics/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/basics/tsconfig.json +++ b/examples/basics/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/blog/astro.config.mjs b/examples/blog/astro.config.mjs index 3b2f75c840..d45f3951e1 100644 --- a/examples/blog/astro.config.mjs +++ b/examples/blog/astro.config.mjs @@ -1,6 +1,6 @@ +// @ts-check import { defineConfig } from 'astro/config'; import mdx from '@astrojs/mdx'; - import sitemap from '@astrojs/sitemap'; // https://astro.build/config diff --git a/examples/blog/package.json b/examples/blog/package.json index 2dea4dac49..bee6d8b2e0 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -5,15 +5,14 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^3.1.9", - "@astrojs/rss": "^4.0.9", + "@astrojs/mdx": "^4.0.2", + "@astrojs/rss": "^4.0.10", "@astrojs/sitemap": "^3.2.1", - "astro": "^4.16.14" + "astro": "^5.0.4" } } diff --git a/examples/blog/src/components/HeaderLink.astro b/examples/blog/src/components/HeaderLink.astro index bb600fb65a..41da8462e8 100644 --- a/examples/blog/src/components/HeaderLink.astro +++ b/examples/blog/src/components/HeaderLink.astro @@ -4,10 +4,9 @@ import type { HTMLAttributes } from 'astro/types'; type Props = HTMLAttributes<'a'>; const { href, class: className, ...props } = Astro.props; - -const { pathname } = Astro.url; +const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); const subpath = pathname.match(/[^\/]+/g); -const isActive = href === pathname || href === '/' + subpath?.[0]; +const isActive = href === pathname || href === '/' + (subpath?.[0] || ''); --- diff --git a/examples/blog/src/content/config.ts b/examples/blog/src/content.config.ts similarity index 68% rename from examples/blog/src/content/config.ts rename to examples/blog/src/content.config.ts index 667a31cc73..7d92b1a3bf 100644 --- a/examples/blog/src/content/config.ts +++ b/examples/blog/src/content.config.ts @@ -1,7 +1,9 @@ +import { glob } from 'astro/loaders'; import { defineCollection, z } from 'astro:content'; const blog = defineCollection({ - type: 'content', + // Load Markdown and MDX files in the `src/content/blog/` directory. + loader: glob({ base: './src/content/blog', pattern: '**/*.{md,mdx}' }), // Type-check frontmatter using a schema schema: z.object({ title: z.string(), diff --git a/examples/blog/src/env.d.ts b/examples/blog/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/blog/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/blog/src/pages/blog/[...slug].astro b/examples/blog/src/pages/blog/[...slug].astro index 07dbce26bc..096bd1e828 100644 --- a/examples/blog/src/pages/blog/[...slug].astro +++ b/examples/blog/src/pages/blog/[...slug].astro @@ -1,18 +1,19 @@ --- import { type CollectionEntry, getCollection } from 'astro:content'; import BlogPost from '../../layouts/BlogPost.astro'; +import { render } from 'astro:content'; export async function getStaticPaths() { const posts = await getCollection('blog'); return posts.map((post) => ({ - params: { slug: post.slug }, + params: { slug: post.id }, props: post, })); } type Props = CollectionEntry<'blog'>; const post = Astro.props; -const { Content } = await post.render(); +const { Content } = await render(post); --- diff --git a/examples/blog/src/pages/blog/index.astro b/examples/blog/src/pages/blog/index.astro index a1019da5b9..1d8d02aa5b 100644 --- a/examples/blog/src/pages/blog/index.astro +++ b/examples/blog/src/pages/blog/index.astro @@ -93,7 +93,7 @@ const posts = (await getCollection('blog')).sort( { posts.map((post) => (
  • - +

    {post.data.title}

    diff --git a/examples/blog/src/pages/rss.xml.js b/examples/blog/src/pages/rss.xml.js index 9ff9801e0b..ae5e4c4ec6 100644 --- a/examples/blog/src/pages/rss.xml.js +++ b/examples/blog/src/pages/rss.xml.js @@ -10,7 +10,7 @@ export async function GET(context) { site: context.site, items: posts.map((post) => ({ ...post.data, - link: `/blog/${post.slug}/`, + link: `/blog/${post.id}/`, })), }); } diff --git a/examples/blog/tsconfig.json b/examples/blog/tsconfig.json index e51e062706..0dc098dd7e 100644 --- a/examples/blog/tsconfig.json +++ b/examples/blog/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { "strictNullChecks": true } diff --git a/examples/component/package.json b/examples/component/package.json index 9d76784313..9c4252bca6 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.16.14" + "astro": "^5.0.4" }, "peerDependencies": { - "astro": "^4.0.0" + "astro": "^4.0.0 || ^5.0.0" } } diff --git a/examples/component/tsconfig.json b/examples/component/tsconfig.json index 26f2fc53dd..f85ec795bf 100644 --- a/examples/component/tsconfig.json +++ b/examples/component/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { "jsx": "preserve" } diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 9525e9627e..b202ff1f26 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -5,18 +5,17 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro", "test": "vitest run" }, "dependencies": { - "astro": "^4.16.14", - "@astrojs/react": "^3.6.3", + "@astrojs/react": "^4.0.0", + "astro": "^5.0.4", "react": "^18.3.1", "react-dom": "^18.3.1", - "vitest": "^2.1.4" + "vitest": "^2.1.6" }, "devDependencies": { "@types/react": "^18.3.12", diff --git a/examples/container-with-vitest/tsconfig.json b/examples/container-with-vitest/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/container-with-vitest/tsconfig.json +++ b/examples/container-with-vitest/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/framework-alpine/astro.config.mjs b/examples/framework-alpine/astro.config.mjs index 60bfc7d45d..5fddf77176 100644 --- a/examples/framework-alpine/astro.config.mjs +++ b/examples/framework-alpine/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import alpine from '@astrojs/alpinejs'; diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index ab1f6169e8..9970749bd5 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -5,7 +5,6 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" @@ -14,6 +13,6 @@ "@astrojs/alpinejs": "^0.4.0", "@types/alpinejs": "^3.13.10", "alpinejs": "^3.14.3", - "astro": "^4.16.14" + "astro": "^5.0.4" } } diff --git a/examples/framework-alpine/src/env.d.ts b/examples/framework-alpine/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-alpine/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-alpine/tsconfig.json b/examples/framework-alpine/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/framework-alpine/tsconfig.json +++ b/examples/framework-alpine/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/framework-lit/.codesandbox/Dockerfile b/examples/framework-lit/.codesandbox/Dockerfile deleted file mode 100644 index c3b5c81a12..0000000000 --- a/examples/framework-lit/.codesandbox/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM node:18-bullseye diff --git a/examples/framework-lit/.gitignore b/examples/framework-lit/.gitignore deleted file mode 100644 index 16d54bb13c..0000000000 --- a/examples/framework-lit/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# build output -dist/ -# generated types -.astro/ - -# dependencies -node_modules/ - -# logs -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - - -# environment variables -.env -.env.production - -# macOS-specific files -.DS_Store - -# jetbrains setting folder -.idea/ diff --git a/examples/framework-lit/.npmrc b/examples/framework-lit/.npmrc deleted file mode 100644 index b417e450e1..0000000000 --- a/examples/framework-lit/.npmrc +++ /dev/null @@ -1 +0,0 @@ -public-hoist-pattern[]=*lit* diff --git a/examples/framework-lit/.vscode/extensions.json b/examples/framework-lit/.vscode/extensions.json deleted file mode 100644 index 22a15055d6..0000000000 --- a/examples/framework-lit/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "recommendations": ["astro-build.astro-vscode"], - "unwantedRecommendations": [] -} diff --git a/examples/framework-lit/.vscode/launch.json b/examples/framework-lit/.vscode/launch.json deleted file mode 100644 index d642209762..0000000000 --- a/examples/framework-lit/.vscode/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "command": "./node_modules/.bin/astro dev", - "name": "Development server", - "request": "launch", - "type": "node-terminal" - } - ] -} diff --git a/examples/framework-lit/README.md b/examples/framework-lit/README.md deleted file mode 100644 index 714d179da2..0000000000 --- a/examples/framework-lit/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Astro + Lit Example - -```sh -npm create astro@latest -- --template framework-lit -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/framework-lit) -[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/framework-lit) -[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/framework-lit/devcontainer.json) - -This example showcases Astro working with [Lit](https://lit.dev/). diff --git a/examples/framework-lit/astro.config.mjs b/examples/framework-lit/astro.config.mjs deleted file mode 100644 index 99733e9337..0000000000 --- a/examples/framework-lit/astro.config.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'astro/config'; -import lit from '@astrojs/lit'; - -// https://astro.build/config -export default defineConfig({ - // Enable Lit to support LitHTML components and templates. - integrations: [lit()], -}); diff --git a/examples/framework-lit/public/assets/logo.svg b/examples/framework-lit/public/assets/logo.svg deleted file mode 100644 index d751556b23..0000000000 --- a/examples/framework-lit/public/assets/logo.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/framework-lit/public/favicon.svg b/examples/framework-lit/public/favicon.svg deleted file mode 100644 index f157bd1c5e..0000000000 --- a/examples/framework-lit/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/examples/framework-lit/src/components/Lorem.astro b/examples/framework-lit/src/components/Lorem.astro deleted file mode 100644 index d742ef6a52..0000000000 --- a/examples/framework-lit/src/components/Lorem.astro +++ /dev/null @@ -1,106 +0,0 @@ -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quam arcu, rhoncus et dui at, - volutpat viverra augue. Suspendisse placerat libero tellus, ut consequat ligula rutrum id. - Vestibulum lectus libero, viverra in lacus eget, porttitor tincidunt leo. Integer sit amet turpis - et felis fringilla lacinia in id nibh. Proin vitae dapibus odio. Mauris ornare eget urna id - volutpat. Duis tellus nisi, hendrerit id sodales in, rutrum a quam. Proin tempor velit turpis, et - tempor lacus sagittis in. Sed congue mauris quis nibh posuere, nec semper lacus auctor. Morbi sit - amet enim sit amet arcu ullamcorper sollicitudin. Donec dignissim posuere tincidunt. Donec - ultrices quam nec orci venenatis suscipit. Maecenas sapien quam, pretium sit amet ullamcorper at, - vulputate sit amet urna. Suspendisse potenti. Integer in sapien turpis. Nulla accumsan viverra - diam, quis convallis magna finibus eget. Integer sed eros bibendum, consequat velit sit amet, - tincidunt orci. Mauris varius id metus in fringilla. Vestibulum dignissim massa eget erat luctus, - ac congue mauris pellentesque. In et tempor dolor. Cras blandit congue lorem at facilisis. Aenean - vel lacinia quam. Pellentesque luctus metus ut scelerisque efficitur. Mauris laoreet sodales - libero eget luctus. Proin at congue dui, a cursus risus. Pellentesque lorem sem, rhoncus fermentum - arcu ut, euismod fermentum ligula. Nullam eu orci posuere, laoreet leo in, commodo dolor. Fusce at - felis elementum, commodo justo at, placerat justo. Nam feugiat scelerisque arcu, ut fermentum - tellus elementum in. Sed ut vulputate ante. Morbi cursus arcu quis odio convallis egestas. Donec - vulputate vestibulum dolor eget tristique. Nullam tempor semper augue, vitae lobortis neque tempor - ac. Pellentesque massa leo, congue id ligula auctor, sollicitudin pharetra lorem. Curabitur a - lacus porttitor, venenatis est quis, mattis velit. Fusce hendrerit lobortis mi ac efficitur. - Mauris ornare, lorem sed varius faucibus, nisi dui pretium urna, sit amet lacinia nibh ligula in - ipsum. Phasellus gravida, metus eget ornare ultrices, dolor ipsum consectetur erat, ac aliquet - eros metus sed lectus. Nullam eleifend posuere rhoncus. Curabitur semper ligula vel ante posuere, - at blandit orci accumsan. Vivamus accumsan metus in lorem laoreet, a luctus arcu tempus. Donec - posuere sollicitudin nulla at vulputate. Nulla condimentum imperdiet purus, et lobortis ligula - iaculis in. Donec suscipit viverra neque, ut elementum eros lacinia ut. Fusce at odio enim. Donec - rutrum lectus sit amet est auctor, ac rhoncus lorem imperdiet. Curabitur commodo ex est, non - tempus massa pulvinar nec. Sed fermentum, lectus eget ultricies luctus, enim sem sodales quam, sed - laoreet tortor sem feugiat nisi. Morbi molestie vehicula viverra. Integer accumsan mi in orci - ultrices posuere. Integer mi quam, faucibus et aliquet imperdiet, ornare ac ex. Nunc mattis - molestie nisi, eu venenatis nibh vehicula at. Aliquam ut elit consectetur, finibus lorem sed, - condimentum sapien. Praesent fermentum iaculis orci, vitae tincidunt est viverra nec. Morbi semper - turpis sed lectus ornare tristique. Sed congue dui ex. Maecenas orci ligula, imperdiet sit amet - accumsan et, finibus a velit. Ut vitae blandit eros. Nam gravida nec ipsum non volutpat. Integer - quam metus, porttitor id ante sed, rutrum porta quam. Aenean at mattis ante. Morbi id libero eget - risus sagittis gravida. Proin consequat sapien a dignissim posuere. Ut luctus sed metus ut - elementum. Mauris tincidunt condimentum risus at bibendum. Aenean a sapien justo. Morbi vel neque - in eros venenatis scelerisque vitae nec justo. Vestibulum lacinia, dui eu sollicitudin ornare, est - elit vestibulum arcu, nec ultrices augue turpis in massa. Duis commodo lectus sed est posuere, et - mollis nisi dapibus. Sed id ultrices arcu. Praesent tempor sodales aliquet. Donec suscipit ipsum - eu odio cursus, quis sodales metus sodales. Nunc vestibulum massa at felis ullamcorper cursus. - Pellentesque facilisis ante ut lectus vulputate vestibulum. Nullam pharetra felis ac lacus - sodales, vel suscipit metus faucibus. Donec facilisis imperdiet risus, in volutpat odio tincidunt - a. Aliquam vitae leo lorem. Proin scelerisque efficitur velit, vel cursus ipsum accumsan id. Morbi - nibh nulla, pretium quis venenatis et, pharetra et sapien. Cras lobortis, massa sit amet blandit - pulvinar, mi magna condimentum ex, quis commodo ipsum est quis metus. Maecenas pulvinar, leo sit - amet congue pulvinar, neque magna ultrices mi, et rhoncus massa sapien quis libero. Etiam a nunc - et ipsum faucibus pretium. Nulla facilisi. Nunc nec dolor velit. In semper semper mi non - condimentum. Pellentesque vehicula volutpat odio, a semper sem porta a. In sit amet lectus rutrum, - sollicitudin augue auctor, maximus quam. Mauris congue, nisl non fermentum iaculis, leo erat - interdum lorem, quis bibendum arcu eros et elit. Fusce tortor ante, gravida a arcu in, lacinia - finibus ante. Phasellus facilisis lectus vitae sapien feugiat laoreet. Curabitur ultricies libero - sit amet condimentum suscipit. Duis at vestibulum mi. Suspendisse at neque augue. Duis ornare a - mauris id efficitur. Suspendisse in dui nec dolor dignissim venenatis. Curabitur a magna turpis. - Aliquam at commodo tellus. In id sem interdum, suscipit felis at, mattis velit. Proin accumsan - sodales felis a lacinia. Curabitur at magna a massa varius maximus. Vestibulum in auctor ante. - Donec aliquam tortor sed nulla rutrum, et egestas mi efficitur. Sed viverra quam tellus, quis - vulputate felis ultrices sed. Mauris sagittis, neque quis laoreet gravida, nisi est ultrices mi, - at tempus nunc justo non dui. Suspendisse porttitor tortor nulla, eget luctus quam finibus id. - Proin sodales eros mollis tellus euismod luctus a eu mi. Quisque consectetur iaculis nibh, at - mollis tellus volutpat eu. Aenean a nulla vel lectus rhoncus aliquam. Donec vitae lacinia neque. - Donec non lectus eget sem finibus ultrices vel nec felis. Proin fringilla mi a leo rhoncus aliquam - sit amet quis augue. Duis congue ligula at est suscipit fringilla. Proin aliquam erat ut consequat - dapibus. Suspendisse non nisi orci. Donec ac erat vel libero egestas laoreet. Nullam felis odio, - tincidunt eget eleifend a, porttitor eu nisi. Suspendisse tristique eros at dolor scelerisque - hendrerit. Etiam id dignissim lectus. Fusce lacinia metus eu risus placerat, et eleifend nunc - ultrices. Ut gravida a dui sed volutpat. Sed semper quis erat sed ornare. Pellentesque sapien sem, - fermentum vel nunc at, auctor posuere nisl. Maecenas aliquet lobortis leo. Vivamus tellus urna, - dignissim consectetur sapien vitae, hendrerit varius sem. Nunc dictum tristique fermentum. Duis eu - suscipit odio. Curabitur quis egestas neque. Fusce eu fringilla orci, vitae euismod sapien. Donec - sit amet iaculis urna. Phasellus maximus nisl in libero bibendum volutpat. Nulla at vehicula - lorem. Phasellus varius, elit ac suscipit pretium, turpis ipsum porttitor lectus, vitae - ullamcorper orci velit ut ligula. Proin mollis, orci vel commodo auctor, sapien ipsum vulputate - enim, sit amet aliquam nulla sapien ut sapien. Proin tincidunt ex non massa aliquet, quis aliquam - nulla egestas. Maecenas mollis turpis dapibus, dignissim lectus tincidunt, egestas ligula. - Suspendisse in lobortis purus. Sed tellus tellus, mollis eget tempor sed, interdum ut lectus. - Nulla sed ex efficitur, porta dui cursus, tristique elit. Maecenas tincidunt tortor vitae massa - laoreet ultricies. Mauris ac elit vitae orci eleifend ornare non eu ligula. Curabitur venenatis - nulla ut neque tristique, non tincidunt justo pretium. Suspendisse mattis semper dui, eget - vestibulum risus elementum sed. In consequat nisi sit amet nulla euismod, at convallis tortor - tincidunt. Aliquam hendrerit venenatis risus in interdum. Duis ullamcorper imperdiet elit sit amet - blandit. Mauris placerat lacinia velit id pharetra. Nam nec iaculis dui. Etiam odio mi, fringilla - in rutrum in, viverra quis tellus. Aliquam egestas mauris id nisi facilisis, in laoreet nibh - malesuada. Ut eu dui laoreet, venenatis tellus ac, feugiat mauris. Nunc in velit laoreet, - venenatis tellus quis, blandit dolor. Nulla ultrices et neque id placerat. Nulla eu interdum - nulla. Aliquam molestie enim quis rutrum finibus. Nulla bibendum orci vel scelerisque posuere. - Praesent quis magna molestie, luctus tortor tincidunt, gravida neque. Quisque et ligula eget magna - viverra interdum at a sapien. Mauris ornare efficitur nunc sed vulputate. Praesent laoreet mollis - tincidunt. Vestibulum id arcu vulputate, eleifend enim vel, accumsan turpis. Morbi faucibus - convallis tellus, semper laoreet justo lacinia nec. Sed sodales ligula consectetur dui rhoncus, et - convallis metus accumsan. Sed ullamcorper non ex sit amet ultricies. Donec finibus nulla nec - blandit porttitor. Etiam aliquam quis leo a imperdiet. Cras at lobortis est. In convallis semper - enim, ac porta ligula fringilla at. Donec augue est, facilisis et odio sit amet, viverra - ullamcorper nisl. Ut porta velit nec sem lacinia, sit amet mollis magna auctor. Nulla lobortis - lacinia mauris nec sagittis. Suspendisse rutrum ex vel nisi interdum hendrerit et ut purus. Sed - consectetur sodales nibh eget tempus. Aenean egestas luctus viverra. Integer fermentum tincidunt - tellus, nec rhoncus velit hendrerit vitae. Proin quis neque porttitor, scelerisque risus gravida, - volutpat sem. Fusce nec ex rhoncus, tempor libero nec, pellentesque ex. Integer quis iaculis - purus. Nullam vitae imperdiet orci. Sed sit amet eros condimentum, scelerisque turpis facilisis, - dignissim ante. Proin quis tristique lacus, sed sagittis nisl. Cras pharetra ultrices purus, sed - ullamcorper nisi fringilla eu. Praesent risus turpis, auctor in fringilla a, fringilla eu dolor. - Phasellus auctor tristique enim, eleifend molestie diam venenatis ut. Mauris dapibus, enim eget - pharetra semper, nulla dui porttitor mi, auctor hendrerit augue nulla quis urna. Aliquam in cursus - justo. -

    diff --git a/examples/framework-lit/src/components/calc-add.js b/examples/framework-lit/src/components/calc-add.js deleted file mode 100644 index b0b3978bf7..0000000000 --- a/examples/framework-lit/src/components/calc-add.js +++ /dev/null @@ -1,17 +0,0 @@ -import { LitElement, html } from 'lit'; - -export class CalcAdd extends LitElement { - static get properties() { - return { - num: { - type: Number, - }, - }; - } - - render() { - return html`
    Number: ${this.num}
    `; - } -} - -customElements.define('calc-add', CalcAdd); diff --git a/examples/framework-lit/src/components/my-counter.js b/examples/framework-lit/src/components/my-counter.js deleted file mode 100644 index adc9e4a3d4..0000000000 --- a/examples/framework-lit/src/components/my-counter.js +++ /dev/null @@ -1,32 +0,0 @@ -import { LitElement, html } from 'lit'; - -export class MyCounter extends LitElement { - static get properties() { - return { - count: { - type: Number, - }, - }; - } - - constructor() { - super(); - this.count = 0; - } - - increment() { - this.count++; - } - - render() { - return html` -
    -

    Count: ${this.count}

    - - -
    - `; - } -} - -customElements.define('my-counter', MyCounter); diff --git a/examples/framework-lit/src/env.d.ts b/examples/framework-lit/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-lit/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-lit/src/pages/index.astro b/examples/framework-lit/src/pages/index.astro deleted file mode 100644 index 5fa6fed67f..0000000000 --- a/examples/framework-lit/src/pages/index.astro +++ /dev/null @@ -1,35 +0,0 @@ ---- -import Lorem from '../components/Lorem.astro'; -import { CalcAdd } from '../components/calc-add.js'; -import { MyCounter } from '../components/my-counter.js'; - -// Full Astro Component Syntax: -// https://docs.astro.build/basics/astro-components/ ---- - - - - - - - - Demo - - -

    Test app

    - - - - { - ( - /** - * Our editor tooling does not currently properly typecheck attributes on imported Lit components. As such, without a - * pragma directive telling TypeScript to ignore the error, the line below will result in an error in the editor. - * Nonetheless, this code works in Astro itself! - */ - // @ts-expect-error - - ) - } - - diff --git a/examples/framework-lit/tsconfig.json b/examples/framework-lit/tsconfig.json deleted file mode 100644 index d78f81ec4e..0000000000 --- a/examples/framework-lit/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "astro/tsconfigs/base" -} diff --git a/examples/framework-multiple/astro.config.mjs b/examples/framework-multiple/astro.config.mjs index 36f75aec26..7609d3fc6f 100644 --- a/examples/framework-multiple/astro.config.mjs +++ b/examples/framework-multiple/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import preact from '@astrojs/preact'; import react from '@astrojs/react'; diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index fddfe3a6ed..cc1a53493c 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -5,20 +5,19 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.5.4", - "@astrojs/react": "^3.6.3", - "@astrojs/solid-js": "^4.4.4", - "@astrojs/svelte": "^6.0.2", - "@astrojs/vue": "^4.5.3", + "@astrojs/preact": "^4.0.0", + "@astrojs/react": "^4.0.0", + "@astrojs/solid-js": "^5.0.0", + "@astrojs/svelte": "^7.0.1", + "@astrojs/vue": "^5.0.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "astro": "^4.16.14", + "astro": "^5.0.4", "preact": "^10.24.3", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-multiple/src/env.d.ts b/examples/framework-multiple/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-multiple/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-multiple/tsconfig.json b/examples/framework-multiple/tsconfig.json index 2d48ed5fd9..a19c58a62c 100644 --- a/examples/framework-multiple/tsconfig.json +++ b/examples/framework-multiple/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { // Needed for TypeScript intellisense in the template inside Vue files "jsx": "preserve" diff --git a/examples/framework-preact/astro.config.mjs b/examples/framework-preact/astro.config.mjs index b1c8d1150e..1d726f9fe1 100644 --- a/examples/framework-preact/astro.config.mjs +++ b/examples/framework-preact/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import preact from '@astrojs/preact'; diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 13196eda3e..952656d3cc 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -5,15 +5,14 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.5.4", + "@astrojs/preact": "^4.0.0", "@preact/signals": "^1.3.0", - "astro": "^4.16.14", + "astro": "^5.0.4", "preact": "^10.24.3" } } diff --git a/examples/framework-preact/src/env.d.ts b/examples/framework-preact/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-preact/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-preact/tsconfig.json b/examples/framework-preact/tsconfig.json index bdd1b5a88e..c8983c2ef0 100644 --- a/examples/framework-preact/tsconfig.json +++ b/examples/framework-preact/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { // Preact specific settings "jsx": "react-jsx", diff --git a/examples/framework-react/astro.config.mjs b/examples/framework-react/astro.config.mjs index 4b5a68ec00..36ed34a5e0 100644 --- a/examples/framework-react/astro.config.mjs +++ b/examples/framework-react/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import react from '@astrojs/react'; diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index eaa28be2cb..3f666d4c1b 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -5,16 +5,15 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/react": "^3.6.3", + "@astrojs/react": "^4.0.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "astro": "^4.16.14", + "astro": "^5.0.4", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-react/src/env.d.ts b/examples/framework-react/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-react/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-react/tsconfig.json b/examples/framework-react/tsconfig.json index e726bd0b9a..92a18df905 100644 --- a/examples/framework-react/tsconfig.json +++ b/examples/framework-react/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" diff --git a/examples/framework-solid/astro.config.mjs b/examples/framework-solid/astro.config.mjs index 623fb8ea5e..8bdaa26796 100644 --- a/examples/framework-solid/astro.config.mjs +++ b/examples/framework-solid/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import solid from '@astrojs/solid-js'; diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 839f263da2..018099983f 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -5,14 +5,13 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/solid-js": "^4.4.4", - "astro": "^4.16.14", + "@astrojs/solid-js": "^5.0.0", + "astro": "^5.0.4", "solid-js": "^1.9.3" } } diff --git a/examples/framework-solid/src/env.d.ts b/examples/framework-solid/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-solid/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-solid/tsconfig.json b/examples/framework-solid/tsconfig.json index 6e107fd322..76e1efdbae 100644 --- a/examples/framework-solid/tsconfig.json +++ b/examples/framework-solid/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { // Solid specific settings "jsx": "preserve", diff --git a/examples/framework-svelte/astro.config.mjs b/examples/framework-svelte/astro.config.mjs index 194e459176..5eeedb56ec 100644 --- a/examples/framework-svelte/astro.config.mjs +++ b/examples/framework-svelte/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import svelte from '@astrojs/svelte'; diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index b367c95883..6ccaa6dbc7 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -5,14 +5,13 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/svelte": "^6.0.2", - "astro": "^4.16.14", + "@astrojs/svelte": "^7.0.1", + "astro": "^5.0.4", "svelte": "^5.1.16" } } diff --git a/examples/framework-svelte/src/env.d.ts b/examples/framework-svelte/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-svelte/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-svelte/tsconfig.json b/examples/framework-svelte/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/framework-svelte/tsconfig.json +++ b/examples/framework-svelte/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/framework-vue/astro.config.mjs b/examples/framework-vue/astro.config.mjs index f30130a953..5afe92269a 100644 --- a/examples/framework-vue/astro.config.mjs +++ b/examples/framework-vue/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import vue from '@astrojs/vue'; diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 72b1eae2d2..fe56cf7eff 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -5,14 +5,13 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^4.5.3", - "astro": "^4.16.14", + "@astrojs/vue": "^5.0.1", + "astro": "^5.0.4", "vue": "^3.5.12" } } diff --git a/examples/framework-vue/src/env.d.ts b/examples/framework-vue/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/framework-vue/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-vue/tsconfig.json b/examples/framework-vue/tsconfig.json index 2d48ed5fd9..a19c58a62c 100644 --- a/examples/framework-vue/tsconfig.json +++ b/examples/framework-vue/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "astro/tsconfigs/base", + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], "compilerOptions": { // Needed for TypeScript intellisense in the template inside Vue files "jsx": "preserve" diff --git a/examples/hackernews/astro.config.mjs b/examples/hackernews/astro.config.mjs index 68ba7fac58..bf6f1a0228 100644 --- a/examples/hackernews/astro.config.mjs +++ b/examples/hackernews/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; import node from '@astrojs/node'; diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 7706bac81d..f2f624df70 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -5,13 +5,12 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "@astrojs/node": "^8.3.4", - "astro": "^4.16.14" + "@astrojs/node": "^9.0.0", + "astro": "^5.0.4" } } diff --git a/examples/hackernews/src/env.d.ts b/examples/hackernews/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/hackernews/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/hackernews/tsconfig.json b/examples/hackernews/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/hackernews/tsconfig.json +++ b/examples/hackernews/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/integration/index.ts b/examples/integration/index.ts index 8b34afd233..1fafd4e157 100644 --- a/examples/integration/index.ts +++ b/examples/integration/index.ts @@ -11,8 +11,8 @@ export default function createIntegration(): AstroIntegration { // https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts }, 'astro:build:setup': () => { - // See the @astrojs/lit integration for an example - // https://github.com/withastro/astro/blob/main/packages/integrations/lit/src/index.ts + // See the @astrojs/react integration for an example + // https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts }, 'astro:build:done': () => { // See the @astrojs/partytown integration for an example diff --git a/examples/integration/package.json b/examples/integration/package.json index 4d39c18f75..41da0a86c2 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.16.14" + "astro": "^5.0.4" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/integration/tsconfig.json b/examples/integration/tsconfig.json index d78f81ec4e..bcbf8b5090 100644 --- a/examples/integration/tsconfig.json +++ b/examples/integration/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict" } diff --git a/examples/minimal/astro.config.mjs b/examples/minimal/astro.config.mjs index 882e6515a6..e762ba5cf6 100644 --- a/examples/minimal/astro.config.mjs +++ b/examples/minimal/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; // https://astro.build/config diff --git a/examples/minimal/package.json b/examples/minimal/package.json index dc07957095..1a58ed5178 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -5,12 +5,11 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "astro": "^4.16.14" + "astro": "^5.0.4" } } diff --git a/examples/minimal/src/env.d.ts b/examples/minimal/src/env.d.ts deleted file mode 100644 index e16c13c695..0000000000 --- a/examples/minimal/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/minimal/tsconfig.json b/examples/minimal/tsconfig.json index d78f81ec4e..8bf91d3bb9 100644 --- a/examples/minimal/tsconfig.json +++ b/examples/minimal/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] } diff --git a/examples/portfolio/astro.config.mjs b/examples/portfolio/astro.config.mjs index 882e6515a6..e762ba5cf6 100644 --- a/examples/portfolio/astro.config.mjs +++ b/examples/portfolio/astro.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from 'astro/config'; // https://astro.build/config diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 648b405826..4a8e47a67a 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -5,12 +5,11 @@ "private": true, "scripts": { "dev": "astro dev", - "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { - "astro": "^4.16.14" + "astro": "^5.0.4" } } diff --git a/examples/portfolio/src/components/Nav.astro b/examples/portfolio/src/components/Nav.astro index f75c230ceb..9d69707b30 100644 --- a/examples/portfolio/src/components/Nav.astro +++ b/examples/portfolio/src/components/Nav.astro @@ -19,6 +19,14 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[] { label: 'dribbble', href: 'https://dribbble.com/me', icon: 'dribbble-logo' }, { label: 'YouTube', href: 'https://www.youtube.com/@me/', icon: 'youtube-logo' }, ]; + +/** Test if a link is pointing to the current page. */ +const isCurrentPage = (href: string) => { + let pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); + if (pathname.at(0) !== '/') pathname = '/' + pathname; + if (pathname.at(-1) !== '/') pathname += '/'; + return pathname === href || (href !== '/' && pathname.startsWith(href)); +}; ---