mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
Merge branch 'main' into remote-assets-use-etag
This commit is contained in:
commit
093dbdb425
1152 changed files with 21770 additions and 29106 deletions
5
.changeset/blue-spiders-carry.md
Normal file
5
.changeset/blue-spiders-carry.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes a bug where MDX files with certain characters in the name would cause builds to fail
|
5
.changeset/famous-teachers-hug.md
Normal file
5
.changeset/famous-teachers-hug.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fix a bug that caused builds to fail if an image had a quote mark in its name
|
6
.changeset/fast-adults-lick.md
Normal file
6
.changeset/fast-adults-lick.md
Normal file
|
@ -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
|
5
.changeset/green-coins-tie.md
Normal file
5
.changeset/green-coins-tie.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/vue': patch
|
||||
---
|
||||
|
||||
fix vite peer dependency issue for vue integration
|
5
.changeset/shy-worms-talk.md
Normal file
5
.changeset/shy-worms-talk.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes astro info copy to clipboard process not returning to prompt in certain cases.
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes a regression where Astro was trying to access `Request.headers`
|
2
.github/ISSUE_TEMPLATE/---01-bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/---01-bug-report.yml
vendored
|
@ -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
|
||||
|
|
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
|
@ -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
|
||||
|
|
1
.github/renovate.json5
vendored
1
.github/renovate.json5
vendored
|
@ -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",
|
||||
|
||||
|
|
6
.github/scripts/announce.mjs
vendored
6
.github/scripts/announce.mjs
vendored
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
2
.github/workflows/benchmark.yml
vendored
2
.github/workflows/benchmark.yml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/check.yml
vendored
4
.github/workflows/check.yml
vendored
|
@ -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
|
||||
|
|
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
|
@ -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
|
||||
|
|
7
.github/workflows/continuous_benchmark.yml
vendored
7
.github/workflows/continuous_benchmark.yml
vendored
|
@ -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 }}
|
||||
|
||||
|
|
22
.github/workflows/examples-deploy.yml
vendored
Normal file
22
.github/workflows/examples-deploy.yml
vendored
Normal file
|
@ -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 }}
|
2
.github/workflows/issue-labeled.yml
vendored
2
.github/workflows/issue-labeled.yml
vendored
|
@ -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"
|
||||
|
|
2
.github/workflows/preview-release.yml
vendored
2
.github/workflows/preview-release.yml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -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
|
||||
|
|
2
.github/workflows/scripts.yml
vendored
2
.github/workflows/scripts.yml
vendored
|
@ -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
|
||||
|
|
10
.github/workflows/snapshot-release.yml
vendored
10
.github/workflows/snapshot-release.yml
vendored
|
@ -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"
|
||||
|
||||
|
|
1
.github/workflows/sync-examples.yml
vendored
1
.github/workflows/sync-examples.yml
vendored
|
@ -12,7 +12,6 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
- next
|
||||
|
||||
# Automatically cancel in-progress actions on the same branch
|
||||
concurrency:
|
||||
|
|
2
.github/workflows/test-hosts.yml
vendored
2
.github/workflows/test-hosts.yml
vendored
|
@ -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
|
||||
|
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
@ -15,7 +15,7 @@
|
|||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
"editor.codeActionsOnSave": {
|
||||
"quickFix.biome": "explicit",
|
||||
"source.fixAll.biome": "explicit"
|
||||
}
|
||||
"quickFix.biome": "explicit",
|
||||
"source.fixAll.biome": "explicit"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<div align="center">
|
||||
|
||||
[](https://github.com/withastro/astro/actions/workflows/ci.yml)
|
||||
[](https://github.com/withastro/astro/actions/workflows/ci.yml)
|
||||
[](https://github.com/withastro/astro/blob/main/LICENSE)
|
||||
[](https://badge.fury.io/js/astro)
|
||||
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
48
benchmark/bench/codspeed.bench.js
Normal file
48
benchmark/bench/codspeed.bench.js
Normal file
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -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());
|
||||
}
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
|||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
`,
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
await Promise.all(promises);
|
||||
|
@ -58,6 +59,6 @@ import { defineConfig } from 'astro/config';
|
|||
|
||||
export default defineConfig({
|
||||
});`,
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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);
|
|||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
`,
|
||||
'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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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();
|
|||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
`,
|
||||
'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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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);
|
|||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
`,
|
||||
'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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const i = ${i};
|
|||
<span>{i}</span>
|
||||
`;
|
||||
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();
|
|||
<h1>{entry.data.title}</h1>
|
||||
<Content />
|
||||
`,
|
||||
'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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,13 +38,13 @@ const content = "${loremIpsum}"
|
|||
</div>
|
||||
</body>
|
||||
</html>`,
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
new URL('./src/components/Paragraph.astro', projectDir),
|
||||
`<div>{Astro.props.num} {Astro.props.str}</div>`,
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
|
@ -57,6 +57,6 @@ export default defineConfig({
|
|||
output: 'server',
|
||||
adapter: nodejs({ mode: 'standalone' }),
|
||||
});`,
|
||||
'utf-8'
|
||||
'utf-8',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
7
benchmark/vitest.config.js
Normal file
7
benchmark/vitest.config.js
Normal file
|
@ -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'],
|
||||
});
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// https://astro.build/config
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
1
examples/basics/src/assets/astro.svg
Normal file
1
examples/basics/src/assets/astro.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="115" height="48"><path fill="#17191E" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="url(#a)" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="#17191E" d="M.02 30.31s4.02-1.95 8.05-1.95l3.04-9.4c.11-.45.44-.76.82-.76.37 0 .7.31.82.76l3.04 9.4c4.77 0 8.05 1.95 8.05 1.95L17 11.71c-.2-.56-.53-.91-.98-.91H7.83c-.44 0-.76.35-.97.9L.02 30.31Zm42.37-5.97c0 1.64-2.05 2.62-4.88 2.62-1.85 0-2.5-.45-2.5-1.41 0-1 .8-1.49 2.65-1.49 1.67 0 3.09.03 4.73.23v.05Zm.03-2.04a21.37 21.37 0 0 0-4.37-.36c-5.32 0-7.82 1.25-7.82 4.18 0 3.04 1.71 4.2 5.68 4.2 3.35 0 5.63-.84 6.46-2.92h.14c-.03.5-.05 1-.05 1.4 0 1.07.18 1.16 1.06 1.16h4.15a16.9 16.9 0 0 1-.36-4c0-1.67.06-2.93.06-4.62 0-3.45-2.07-5.64-8.56-5.64-2.8 0-5.9.48-8.26 1.19.22.93.54 2.83.7 4.06 2.04-.96 4.95-1.37 7.2-1.37 3.11 0 3.97.71 3.97 2.15v.57Zm11.37 3c-.56.07-1.33.07-2.12.07-.83 0-1.6-.03-2.12-.1l-.02.58c0 2.85 1.87 4.52 8.45 4.52 6.2 0 8.2-1.64 8.2-4.55 0-2.74-1.33-4.09-7.2-4.39-4.58-.2-4.99-.7-4.99-1.28 0-.66.59-1 3.65-1 3.18 0 4.03.43 4.03 1.35v.2a46.13 46.13 0 0 1 4.24.03l.02-.55c0-3.36-2.8-4.46-8.2-4.46-6.08 0-8.13 1.49-8.13 4.39 0 2.6 1.64 4.23 7.48 4.48 4.3.14 4.77.62 4.77 1.28 0 .7-.7 1.03-3.71 1.03-3.47 0-4.35-.48-4.35-1.47v-.13Zm19.82-12.05a17.5 17.5 0 0 1-6.24 3.48c.03.84.03 2.4.03 3.24l1.5.02c-.02 1.63-.04 3.6-.04 4.9 0 3.04 1.6 5.32 6.58 5.32 2.1 0 3.5-.23 5.23-.6a43.77 43.77 0 0 1-.46-4.13c-1.03.34-2.34.53-3.78.53-2 0-2.82-.55-2.82-2.13 0-1.37 0-2.65.03-3.84 2.57.02 5.13.07 6.64.11-.02-1.18.03-2.9.1-4.04-2.2.04-4.65.07-6.68.07l.07-2.93h-.16Zm13.46 6.04a767.33 767.33 0 0 1 .07-3.18H82.6c.07 1.96.07 3.98.07 6.92 0 2.95-.03 4.99-.07 6.93h5.18c-.09-1.37-.11-3.68-.11-5.65 0-3.1 1.26-4 4.12-4 1.33 0 2.28.16 3.1.46.03-1.16.26-3.43.4-4.43-.86-.25-1.81-.41-2.96-.41-2.46-.03-4.26.98-5.1 3.38l-.17-.02Zm22.55 3.65c0 2.5-1.8 3.66-4.64 3.66-2.81 0-4.61-1.1-4.61-3.66s1.82-3.52 4.61-3.52c2.82 0 4.64 1.03 4.64 3.52Zm4.71-.11c0-4.96-3.87-7.18-9.35-7.18-5.5 0-9.23 2.22-9.23 7.18 0 4.94 3.49 7.59 9.21 7.59 5.77 0 9.37-2.65 9.37-7.6Z"/><defs><linearGradient id="a" x1="6.33" x2="19.43" y1="40.8" y2="34.6" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient></defs></svg>
|
After Width: | Height: | Size: 2.8 KiB |
1
examples/basics/src/assets/background.svg
Normal file
1
examples/basics/src/assets/background.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="1024" fill="none"><path fill="url(#a)" fill-rule="evenodd" d="M-217.58 475.75c91.82-72.02 225.52-29.38 341.2-44.74C240 415.56 372.33 315.14 466.77 384.9c102.9 76.02 44.74 246.76 90.31 366.31 29.83 78.24 90.48 136.14 129.48 210.23 57.92 109.99 169.67 208.23 155.9 331.77-13.52 121.26-103.42 264.33-224.23 281.37-141.96 20.03-232.72-220.96-374.06-196.99-151.7 25.73-172.68 330.24-325.85 315.72-128.6-12.2-110.9-230.73-128.15-358.76-12.16-90.14 65.87-176.25 44.1-264.57-26.42-107.2-167.12-163.46-176.72-273.45-10.15-116.29 33.01-248.75 124.87-320.79Z" clip-rule="evenodd" style="opacity:.154"/><path fill="url(#b)" fill-rule="evenodd" d="M1103.43 115.43c146.42-19.45 275.33-155.84 413.5-103.59 188.09 71.13 409 212.64 407.06 413.88-1.94 201.25-259.28 278.6-414.96 405.96-130 106.35-240.24 294.39-405.6 265.3-163.7-28.8-161.93-274.12-284.34-386.66-134.95-124.06-436-101.46-445.82-284.6-9.68-180.38 247.41-246.3 413.54-316.9 101.01-42.93 207.83 21.06 316.62 6.61Z" clip-rule="evenodd" style="opacity:.154"/><defs><linearGradient id="b" x1="373" x2="1995.44" y1="1100" y2="118.03" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient><linearGradient id="a" x1="107.37" x2="1130.66" y1="1993.35" y2="1026.31" gradientUnits="userSpaceOnUse"><stop stop-color="#3245FF"/><stop offset="1" stop-color="#BC52EE"/></linearGradient></defs></svg>
|
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,61 +0,0 @@
|
|||
---
|
||||
interface Props {
|
||||
title: string;
|
||||
body: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
const { href, title, body } = Astro.props;
|
||||
---
|
||||
|
||||
<li class="link-card">
|
||||
<a href={href}>
|
||||
<h2>
|
||||
{title}
|
||||
<span>→</span>
|
||||
</h2>
|
||||
<p>
|
||||
{body}
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
<style>
|
||||
.link-card {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
padding: 1px;
|
||||
background-color: #23262d;
|
||||
background-image: none;
|
||||
background-size: 400%;
|
||||
border-radius: 7px;
|
||||
background-position: 100%;
|
||||
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.link-card > a {
|
||||
width: 100%;
|
||||
text-decoration: none;
|
||||
line-height: 1.4;
|
||||
padding: calc(1.5rem - 1px);
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
background-color: #23262d;
|
||||
opacity: 0.8;
|
||||
}
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
p {
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.link-card:is(:hover, :focus-within) {
|
||||
background-position: 0;
|
||||
background-image: var(--accent-gradient);
|
||||
}
|
||||
.link-card:is(:hover, :focus-within) h2 {
|
||||
color: rgb(var(--accent-light));
|
||||
}
|
||||
</style>
|
209
examples/basics/src/components/Welcome.astro
Normal file
209
examples/basics/src/components/Welcome.astro
Normal file
|
@ -0,0 +1,209 @@
|
|||
---
|
||||
import astroLogo from '../assets/astro.svg';
|
||||
import background from '../assets/background.svg';
|
||||
---
|
||||
|
||||
<div id="container">
|
||||
<img id="background" src={background.src} alt="" fetchpriority="high" />
|
||||
<main>
|
||||
<section id="hero">
|
||||
<a href="https://astro.build"
|
||||
><img src={astroLogo.src} width="115" height="48" alt="Astro Homepage" /></a
|
||||
>
|
||||
<h1>
|
||||
To get started, open the <code><pre>src/pages</pre></code> directory in your project.
|
||||
</h1>
|
||||
<section id="links">
|
||||
<a class="button" href="https://docs.astro.build">Read our docs</a>
|
||||
<a href="https://astro.build/chat"
|
||||
>Join our Discord <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 127.14 96.36"
|
||||
><path
|
||||
fill="currentColor"
|
||||
d="M107.7 8.07A105.15 105.15 0 0 0 81.47 0a72.06 72.06 0 0 0-3.36 6.83 97.68 97.68 0 0 0-29.11 0A72.37 72.37 0 0 0 45.64 0a105.89 105.89 0 0 0-26.25 8.09C2.79 32.65-1.71 56.6.54 80.21a105.73 105.73 0 0 0 32.17 16.15 77.7 77.7 0 0 0 6.89-11.11 68.42 68.42 0 0 1-10.85-5.18c.91-.66 1.8-1.34 2.66-2a75.57 75.57 0 0 0 64.32 0c.87.71 1.76 1.39 2.66 2a68.68 68.68 0 0 1-10.87 5.19 77 77 0 0 0 6.89 11.1 105.25 105.25 0 0 0 32.19-16.14c2.64-27.38-4.51-51.11-18.9-72.15ZM42.45 65.69C36.18 65.69 31 60 31 53s5-12.74 11.43-12.74S54 46 53.89 53s-5.05 12.69-11.44 12.69Zm42.24 0C78.41 65.69 73.25 60 73.25 53s5-12.74 11.44-12.74S96.23 46 96.12 53s-5.04 12.69-11.43 12.69Z"
|
||||
></path></svg
|
||||
>
|
||||
</a>
|
||||
</section>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<a href="https://astro.build/blog/astro-5/" id="news" class="box">
|
||||
<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg"
|
||||
><path
|
||||
d="M24.667 12c1.333 1.414 2 3.192 2 5.334 0 4.62-4.934 5.7-7.334 12C18.444 28.567 18 27.456 18 26c0-4.642 6.667-7.053 6.667-14Zm-5.334-5.333c1.6 1.65 2.4 3.43 2.4 5.333 0 6.602-8.06 7.59-6.4 17.334C13.111 27.787 12 25.564 12 22.666c0-4.434 7.333-8 7.333-16Zm-6-5.333C15.111 3.555 16 5.556 16 7.333c0 8.333-11.333 10.962-5.333 22-3.488-.774-6-4-6-8 0-8.667 8.666-10 8.666-20Z"
|
||||
fill="#111827"></path></svg
|
||||
>
|
||||
<h2>What's New in Astro 5.0?</h2>
|
||||
<p>
|
||||
From content layers to server islands, click to learn more about the new features and
|
||||
improvements in Astro 5.0
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#background {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
filter: blur(100px);
|
||||
}
|
||||
|
||||
#container {
|
||||
font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
main {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#hero {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px;
|
||||
margin-top: 0.25em;
|
||||
}
|
||||
|
||||
#links {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
#links a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
color: #111827;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
#links a:hover {
|
||||
color: rgb(78, 80, 86);
|
||||
}
|
||||
|
||||
#links a svg {
|
||||
height: 1em;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
#links a.button {
|
||||
color: white;
|
||||
background: linear-gradient(83.21deg, #3245ff 0%, #bc52ee 100%);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.12),
|
||||
inset 0 -2px 0 rgba(0, 0, 0, 0.24);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#links a.button:hover {
|
||||
color: rgb(230, 230, 230);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas,
|
||||
'DejaVu Sans Mono', monospace;
|
||||
font-weight: normal;
|
||||
background: linear-gradient(14deg, #d83333 0%, #f041ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 1em;
|
||||
font-weight: normal;
|
||||
color: #111827;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #4b5563;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
letter-spacing: -0.006em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
code {
|
||||
display: inline-block;
|
||||
background:
|
||||
linear-gradient(66.77deg, #f3cddd 0%, #f5cee7 100%) padding-box,
|
||||
linear-gradient(155deg, #d83333 0%, #f041ff 18%, #f5cee7 45%) border-box;
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 16px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border-radius: 16px;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
#news {
|
||||
position: absolute;
|
||||
bottom: 16px;
|
||||
right: 16px;
|
||||
max-width: 300px;
|
||||
text-decoration: none;
|
||||
transition: background 0.2s;
|
||||
backdrop-filter: blur(50px);
|
||||
}
|
||||
|
||||
#news:hover {
|
||||
background: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
@media screen and (max-height: 368px) {
|
||||
#news {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
#container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#hero {
|
||||
display: block;
|
||||
padding-top: 10%;
|
||||
}
|
||||
|
||||
#links {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
#links a.button {
|
||||
padding: 14px 18px;
|
||||
}
|
||||
|
||||
#news {
|
||||
right: 16px;
|
||||
left: 16px;
|
||||
bottom: 2.5rem;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
</style>
|
1
examples/basics/src/env.d.ts
vendored
1
examples/basics/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -1,50 +1,22 @@
|
|||
---
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
|
||||
const { title } = Astro.props;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="description" content="Astro description" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title}</title>
|
||||
<title>Astro Basics</title>
|
||||
</head>
|
||||
<body>
|
||||
<slot />
|
||||
</body>
|
||||
</html>
|
||||
<style is:global>
|
||||
:root {
|
||||
--accent: 136, 58, 234;
|
||||
--accent-light: 224, 204, 250;
|
||||
--accent-dark: 49, 10, 101;
|
||||
--accent-gradient: linear-gradient(
|
||||
45deg,
|
||||
rgb(var(--accent)),
|
||||
rgb(var(--accent-light)) 30%,
|
||||
white 60%
|
||||
);
|
||||
}
|
||||
html {
|
||||
font-family: system-ui, sans-serif;
|
||||
background: #13151a;
|
||||
}
|
||||
code {
|
||||
font-family:
|
||||
Menlo,
|
||||
Monaco,
|
||||
Lucida Console,
|
||||
Liberation Mono,
|
||||
DejaVu Sans Mono,
|
||||
Bitstream Vera Sans Mono,
|
||||
Courier New,
|
||||
monospace;
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -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.
|
||||
---
|
||||
|
||||
<Layout title="Welcome to Astro.">
|
||||
<main>
|
||||
<svg
|
||||
class="astro-a"
|
||||
width="495"
|
||||
height="623"
|
||||
viewBox="0 0 495 623"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M167.19 364.254C83.4786 364.254 0 404.819 0 404.819C0 404.819 141.781 19.4876 142.087 18.7291C146.434 7.33701 153.027 0 162.289 0H332.441C341.703 0 348.574 7.33701 352.643 18.7291C352.92 19.5022 494.716 404.819 494.716 404.819C494.716 404.819 426.67 364.254 327.525 364.254L264.41 169.408C262.047 159.985 255.147 153.581 247.358 153.581C239.569 153.581 232.669 159.985 230.306 169.408L167.19 364.254ZM160.869 530.172C160.877 530.18 160.885 530.187 160.894 530.195L160.867 530.181C160.868 530.178 160.868 530.175 160.869 530.172ZM136.218 411.348C124.476 450.467 132.698 504.458 160.869 530.172C160.997 529.696 161.125 529.242 161.248 528.804C161.502 527.907 161.737 527.073 161.917 526.233C165.446 509.895 178.754 499.52 195.577 500.01C211.969 500.487 220.67 508.765 223.202 527.254C224.141 534.12 224.23 541.131 224.319 548.105C224.328 548.834 224.337 549.563 224.347 550.291C224.563 566.098 228.657 580.707 237.264 593.914C245.413 606.426 256.108 615.943 270.749 622.478C270.593 621.952 270.463 621.508 270.35 621.126C270.045 620.086 269.872 619.499 269.685 618.911C258.909 585.935 266.668 563.266 295.344 543.933C298.254 541.971 301.187 540.041 304.12 538.112C310.591 533.854 317.059 529.599 323.279 525.007C345.88 508.329 360.09 486.327 363.431 457.844C364.805 446.148 363.781 434.657 359.848 423.275C358.176 424.287 356.587 425.295 355.042 426.275C351.744 428.366 348.647 430.33 345.382 431.934C303.466 452.507 259.152 455.053 214.03 448.245C184.802 443.834 156.584 436.019 136.218 411.348Z"
|
||||
fill="url(#paint0_linear_1805_24383)"></path>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="paint0_linear_1805_24383"
|
||||
x1="247.358"
|
||||
y1="0"
|
||||
x2="247.358"
|
||||
y2="622.479"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stop-opacity="0.9"></stop>
|
||||
<stop offset="1" stop-opacity="0.2"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
|
||||
<p class="instructions">
|
||||
To get started, open the directory <code>src/pages</code> in your project.<br />
|
||||
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
||||
</p>
|
||||
<ul role="list" class="link-card-grid">
|
||||
<Card
|
||||
href="https://docs.astro.build/"
|
||||
title="Documentation"
|
||||
body="Learn how Astro works and explore the official API docs."
|
||||
/>
|
||||
<Card
|
||||
href="https://astro.build/integrations/"
|
||||
title="Integrations"
|
||||
body="Supercharge your project with new frameworks and libraries."
|
||||
/>
|
||||
<Card
|
||||
href="https://astro.build/themes/"
|
||||
title="Themes"
|
||||
body="Explore a galaxy of community-built starter themes."
|
||||
/>
|
||||
<Card
|
||||
href="https://astro.build/chat/"
|
||||
title="Community"
|
||||
body="Come say hi to our amazing Discord community. ❤️"
|
||||
/>
|
||||
</ul>
|
||||
</main>
|
||||
<Layout>
|
||||
<Welcome />
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
main {
|
||||
margin: auto;
|
||||
padding: 1rem;
|
||||
width: 800px;
|
||||
max-width: calc(100% - 2rem);
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.astro-a {
|
||||
position: absolute;
|
||||
top: -32px;
|
||||
left: 50%;
|
||||
transform: translatex(-50%);
|
||||
width: 220px;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
}
|
||||
h1 {
|
||||
font-size: 4rem;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.text-gradient {
|
||||
background-image: var(--accent-gradient);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-size: 400%;
|
||||
background-position: 0%;
|
||||
}
|
||||
.instructions {
|
||||
margin-bottom: 2rem;
|
||||
border: 1px solid rgba(var(--accent-light), 25%);
|
||||
background: linear-gradient(rgba(var(--accent-dark), 66%), rgba(var(--accent-dark), 33%));
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.instructions code {
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
background: rgba(var(--accent-light), 12%);
|
||||
color: rgb(var(--accent-light));
|
||||
border-radius: 4px;
|
||||
padding: 0.3em 0.4em;
|
||||
}
|
||||
.instructions strong {
|
||||
color: rgb(var(--accent-light));
|
||||
}
|
||||
.link-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
||||
gap: 2rem;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base"
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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] || '');
|
||||
---
|
||||
|
||||
<a href={href} class:list={[className, { active: isActive }]} {...props}>
|
||||
|
|
|
@ -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(),
|
1
examples/blog/src/env.d.ts
vendored
1
examples/blog/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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);
|
||||
---
|
||||
|
||||
<BlogPost {...post.data}>
|
||||
|
|
|
@ -93,7 +93,7 @@ const posts = (await getCollection('blog')).sort(
|
|||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<a href={`/blog/${post.slug}/`}>
|
||||
<a href={`/blog/${post.id}/`}>
|
||||
<img width={720} height={360} src={post.data.heroImage} alt="" />
|
||||
<h4 class="title">{post.data.title}</h4>
|
||||
<p class="date">
|
||||
|
|
|
@ -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}/`,
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base",
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"],
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base",
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"],
|
||||
"compilerOptions": {
|
||||
"jsx": "preserve"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base"
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import alpine from '@astrojs/alpinejs';
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
1
examples/framework-alpine/src/env.d.ts
vendored
1
examples/framework-alpine/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base"
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
FROM node:18-bullseye
|
24
examples/framework-lit/.gitignore
vendored
24
examples/framework-lit/.gitignore
vendored
|
@ -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/
|
|
@ -1 +0,0 @@
|
|||
public-hoist-pattern[]=*lit*
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"unwantedRecommendations": []
|
||||
}
|
11
examples/framework-lit/.vscode/launch.json
vendored
11
examples/framework-lit/.vscode/launch.json
vendored
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "./node_modules/.bin/astro dev",
|
||||
"name": "Development server",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# Astro + Lit Example
|
||||
|
||||
```sh
|
||||
npm create astro@latest -- --template framework-lit
|
||||
```
|
||||
|
||||
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/framework-lit)
|
||||
[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/framework-lit)
|
||||
[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/framework-lit/devcontainer.json)
|
||||
|
||||
This example showcases Astro working with [Lit](https://lit.dev/).
|
|
@ -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()],
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
<svg width="193" height="256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
#flame { fill: #FF5D01; }
|
||||
#a { fill: #000014; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
#a { fill: #fff; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<path id="a" fill-rule="evenodd" clip-rule="evenodd" d="M131.496 18.929c1.943 2.413 2.935 5.67 4.917 12.181l43.309 142.27a180.277 180.277 0 00-51.778-17.53L99.746 60.56a3.67 3.67 0 00-7.042.01l-27.857 95.232a180.224 180.224 0 00-52.01 17.557l43.52-142.281c1.989-6.502 2.983-9.752 4.927-12.16a15.999 15.999 0 016.484-4.798c2.872-1.154 6.271-1.154 13.07-1.154h31.085c6.807 0 10.211 0 13.085 1.157a16 16 0 016.488 4.806z" fill="url(#paint0_linear)"/>
|
||||
<path id="flame" fill-rule="evenodd" clip-rule="evenodd" d="M136.678 180.151c-7.14 6.105-21.39 10.268-37.804 10.268-20.147 0-37.033-6.272-41.513-14.707-1.602 4.835-1.962 10.367-1.962 13.902 0 0-1.055 17.355 11.016 29.426 0-6.268 5.081-11.349 11.349-11.349 10.743 0 10.731 9.373 10.721 16.977v.679c0 11.542 7.054 21.436 17.086 25.606a23.27 23.27 0 01-2.339-10.2c0-11.008 6.463-15.107 13.973-19.87 5.977-3.79 12.616-8.001 17.192-16.449a31.013 31.013 0 003.744-14.82c0-3.299-.513-6.479-1.463-9.463z" />
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB |
|
@ -1,9 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
||||
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
||||
<style>
|
||||
path { fill: #000; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
path { fill: #FFF; }
|
||||
}
|
||||
</style>
|
||||
</svg>
|
Before Width: | Height: | Size: 749 B |
|
@ -1,106 +0,0 @@
|
|||
<p>
|
||||
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.
|
||||
</p>
|
|
@ -1,17 +0,0 @@
|
|||
import { LitElement, html } from 'lit';
|
||||
|
||||
export class CalcAdd extends LitElement {
|
||||
static get properties() {
|
||||
return {
|
||||
num: {
|
||||
type: Number,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return html` <div>Number: ${this.num}</div> `;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('calc-add', CalcAdd);
|
|
@ -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`
|
||||
<div>
|
||||
<p>Count: ${this.count}</p>
|
||||
|
||||
<button type="button" @click=${this.increment}>Increment</button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('my-counter', MyCounter);
|
1
examples/framework-lit/src/env.d.ts
vendored
1
examples/framework-lit/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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/
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<title>Demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test app</h1>
|
||||
<MyCounter client:load />
|
||||
<Lorem />
|
||||
|
||||
{
|
||||
(
|
||||
/**
|
||||
* 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
|
||||
<CalcAdd num={0} />
|
||||
)
|
||||
}
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/base"
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import preact from '@astrojs/preact';
|
||||
import react from '@astrojs/react';
|
||||
|
|
|
@ -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",
|
||||
|
|
1
examples/framework-multiple/src/env.d.ts
vendored
1
examples/framework-multiple/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import preact from '@astrojs/preact';
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
1
examples/framework-preact/src/env.d.ts
vendored
1
examples/framework-preact/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import react from '@astrojs/react';
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
1
examples/framework-react/src/env.d.ts
vendored
1
examples/framework-react/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import solid from '@astrojs/solid-js';
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
1
examples/framework-solid/src/env.d.ts
vendored
1
examples/framework-solid/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
|
@ -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",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue