Skip to content

Commit a116f13

Browse files
authored
Merge branch 'main' into arpan-withastro#12506-ref
2 parents ddb82a5 + 350b3da commit a116f13

File tree

77 files changed

+773
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+773
-348
lines changed

.changeset/chatty-knives-confess.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Removes the misleading log message telling that a custom renderer is not recognized while it clearly is and works.

.changeset/little-rules-relate.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/upgrade': patch
3+
---
4+
5+
Fixes an issue where running `upgrade` in a directory without `astro` installed shows a false success message

.changeset/rare-cooks-battle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes an issue where the `experimental.svg` had incorrect type, resulting in some errors in the editors.

.changeset/red-emus-repair.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/db': patch
3+
---
4+
5+
Fixes a bug that caused an error to be logged about invalid entrypoints

.changeset/six-toes-sort.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Correctly handles images in content collections with uppercase file extensions

.github/ISSUE_TEMPLATE/---01-bug-report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ body:
4242
id: bug-reproduction
4343
attributes:
4444
label: Link to Minimal Reproducible Example
45-
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)'
45+
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)'
4646
placeholder: 'https://stackblitz.com/abcd1234'
4747
validations:
4848
required: true

.github/workflows/continuous_benchmark.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2.0
5151
timeout-minutes: 30
5252
with:
53-
run: pnpm benchmark codspeed
53+
working-directory: ./benchmark
54+
run: pnpm bench
5455
token: ${{ secrets.CODSPEED_TOKEN }}
5556

.github/workflows/issue-labeled.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ jobs:
2626
token: ${{ secrets.GITHUB_TOKEN }}
2727
issue-number: ${{ github.event.issue.number }}
2828
body: |
29-
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.
29+
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.
3030
labels: "needs triage"

benchmark/bench/_util.js

+11
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ export function calculateStat(numbers) {
1919
const max = Math.max(...numbers);
2020
return { avg, stdev, max };
2121
}
22+
23+
export async function makeProject(name) {
24+
console.log('Making project:', name);
25+
const projectDir = new URL(`../projects/${name}/`, import.meta.url);
26+
27+
const makeProjectMod = await import(`../make-project/${name}.js`);
28+
await makeProjectMod.run(projectDir);
29+
30+
console.log('Finished making project:', name);
31+
return projectDir;
32+
}

benchmark/bench/codspeed.bench.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { fileURLToPath } from 'node:url';
2+
import { exec } from 'tinyexec';
3+
import { beforeAll, bench, describe } from 'vitest';
4+
import { astroBin, makeProject } from './_util.js';
5+
let streamingApp;
6+
let nonStreamingApp;
7+
beforeAll(async () => {
8+
const render = await makeProject('render-bench');
9+
const root = fileURLToPath(render);
10+
await exec(astroBin, ['build'], {
11+
nodeOptions: {
12+
cwd: root,
13+
stdio: 'inherit',
14+
},
15+
});
16+
const entry = new URL('./dist/server/entry.mjs', `file://${root}`);
17+
const { manifest, createApp } = await import(entry);
18+
streamingApp = createApp(manifest, true);
19+
nonStreamingApp = createApp(manifest, false);
20+
}, 900000);
21+
22+
describe('Bench rendering', () => {
23+
bench('Rendering: streaming [true], .astro file', async () => {
24+
const request = new Request(new URL('http://exmpale.com/astro'));
25+
await streamingApp.render(request);
26+
});
27+
bench('Rendering: streaming [true], .md file', async () => {
28+
const request = new Request(new URL('http://exmpale.com/md'));
29+
await streamingApp.render(request);
30+
});
31+
bench('Rendering: streaming [true], .mdx file', async () => {
32+
const request = new Request(new URL('http://exmpale.com/mdx'));
33+
await streamingApp.render(request);
34+
});
35+
36+
bench('Rendering: streaming [false], .astro file', async () => {
37+
const request = new Request(new URL('http://exmpale.com/astro'));
38+
await nonStreamingApp.render(request);
39+
});
40+
bench('Rendering: streaming [false], .md file', async () => {
41+
const request = new Request(new URL('http://exmpale.com/md'));
42+
await nonStreamingApp.render(request);
43+
});
44+
bench('Rendering: streaming [false], .mdx file', async () => {
45+
const request = new Request(new URL('http://exmpale.com/mdx'));
46+
await nonStreamingApp.render(request);
47+
});
48+
});

benchmark/bench/codspeed.js

-64
This file was deleted.

benchmark/index.js

+10-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import mri from 'mri';
21
import fs from 'node:fs/promises';
32
import path from 'node:path';
4-
import {fileURLToPath, pathToFileURL} from 'node:url';
3+
import { fileURLToPath, pathToFileURL } from 'node:url';
4+
import mri from 'mri';
5+
import { makeProject } from './bench/_util.js';
56

67
const args = mri(process.argv.slice(2));
78

@@ -14,7 +15,6 @@ Command
1415
memory Run build memory and speed test
1516
render Run rendering speed test
1617
server-stress Run server stress test
17-
codspeed Run codspeed test
1818
cli-startup Run CLI startup speed test
1919
2020
Options
@@ -30,7 +30,6 @@ const benchmarks = {
3030
render: () => import('./bench/render.js'),
3131
'server-stress': () => import('./bench/server-stress.js'),
3232
'cli-startup': () => import('./bench/cli-startup.js'),
33-
codspeed: () => import('./bench/codspeed.js')
3433
};
3534

3635
if (commandName && !(commandName in benchmarks)) {
@@ -39,26 +38,12 @@ if (commandName && !(commandName in benchmarks)) {
3938
}
4039

4140
if (commandName) {
42-
if (commandName === 'codspeed') {
43-
const render = await makeProject('render-bench');
44-
const rootRender = fileURLToPath(render);
45-
const bench = benchmarks[commandName];
46-
const benchMod = await bench();
47-
const payload = {
48-
render: {
49-
root: rootRender,
50-
output: await getOutputFile('render')
51-
},
52-
};
53-
await benchMod.run(payload);
54-
} else {
55-
// Run single benchmark
56-
const bench = benchmarks[commandName];
57-
const benchMod = await bench();
58-
const projectDir = await makeProject(args.project || benchMod.defaultProject);
59-
const outputFile = await getOutputFile(commandName);
60-
await benchMod.run(projectDir, outputFile);
61-
}
41+
// Run single benchmark
42+
const bench = benchmarks[commandName];
43+
const benchMod = await bench();
44+
const projectDir = await makeProject(args.project || benchMod.defaultProject);
45+
const outputFile = await getOutputFile(commandName);
46+
await benchMod.run(projectDir, outputFile);
6247
} else {
6348
// Run all benchmarks
6449
for (const name in benchmarks) {
@@ -70,21 +55,10 @@ if (commandName) {
7055
}
7156
}
7257

73-
export async function makeProject(name) {
74-
console.log('Making project:', name);
75-
const projectDir = new URL(`./projects/${name}/`, import.meta.url);
76-
77-
const makeProjectMod = await import(`./make-project/${name}.js`);
78-
await makeProjectMod.run(projectDir);
79-
80-
console.log('Finished making project:', name);
81-
return projectDir;
82-
}
83-
8458
/**
8559
* @param {string} benchmarkName
8660
*/
87-
async function getOutputFile(benchmarkName) {
61+
export async function getOutputFile(benchmarkName) {
8862
let file;
8963
if (args.output) {
9064
file = pathToFileURL(path.resolve(args.output));

benchmark/make-project/markdown-cc1.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ export async function run(projectDir) {
88
await fs.rm(projectDir, { recursive: true, force: true });
99
await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true });
1010
await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true });
11-
await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir));
11+
await fs.copyFile(
12+
new URL('./image.jpg', import.meta.url),
13+
new URL('./src/image.jpg', projectDir),
14+
);
1215

1316
const promises = [];
1417

15-
1618
for (let i = 0; i < 10000; i++) {
1719
const content = `\
1820
# Article ${i}
@@ -24,11 +26,10 @@ ${loremIpsumMd}
2426
2527
`;
2628
promises.push(
27-
fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8')
29+
fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8'),
2830
);
2931
}
3032

31-
3233
await fs.writeFile(
3334
new URL(`./src/pages/blog/[...slug].astro`, projectDir),
3435
`\
@@ -46,7 +47,7 @@ const { Content } = await entry.render();
4647
<h1>{entry.data.title}</h1>
4748
<Content />
4849
`,
49-
'utf-8'
50+
'utf-8',
5051
);
5152

5253
await Promise.all(promises);
@@ -58,6 +59,6 @@ import { defineConfig } from 'astro/config';
5859
5960
export default defineConfig({
6061
});`,
61-
'utf-8'
62+
'utf-8',
6263
);
6364
}

benchmark/make-project/markdown-cc2.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ${loremIpsumMd}
2323
2424
`;
2525
promises.push(
26-
fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8')
26+
fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8'),
2727
);
2828
}
2929

@@ -39,7 +39,7 @@ ${loremIpsumMd}
3939
4040
export const collections = { blog }
4141
42-
`
42+
`,
4343
);
4444

4545
await fs.writeFile(
@@ -60,7 +60,7 @@ const { Content } = await render(entry);
6060
<h1>{entry.data.title}</h1>
6161
<Content />
6262
`,
63-
'utf-8'
63+
'utf-8',
6464
);
6565

6666
await Promise.all(promises);
@@ -71,6 +71,6 @@ const { Content } = await render(entry);
7171
import { defineConfig } from 'astro/config';
7272
7373
export default defineConfig({});`,
74-
'utf-8'
74+
'utf-8',
7575
);
7676
}

benchmark/make-project/mdx-cc1.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ export async function run(projectDir) {
88
await fs.rm(projectDir, { recursive: true, force: true });
99
await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true });
1010
await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true });
11-
await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir));
11+
await fs.copyFile(
12+
new URL('./image.jpg', import.meta.url),
13+
new URL('./src/image.jpg', projectDir),
14+
);
1215

1316
const promises = [];
1417

15-
1618
for (let i = 0; i < 10000; i++) {
1719
const content = `\
1820
# Article ${i}
@@ -24,11 +26,10 @@ ${loremIpsumMd}
2426
2527
`;
2628
promises.push(
27-
fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8')
29+
fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8'),
2830
);
2931
}
3032

31-
3233
await fs.writeFile(
3334
new URL(`./src/pages/blog/[...slug].astro`, projectDir),
3435
`\
@@ -46,7 +47,7 @@ const { Content } = await entry.render();
4647
<h1>{entry.data.title}</h1>
4748
<Content />
4849
`,
49-
'utf-8'
50+
'utf-8',
5051
);
5152

5253
await Promise.all(promises);
@@ -61,6 +62,6 @@ import mdx from '@astrojs/mdx';
6162
export default defineConfig({
6263
integrations: [mdx()],
6364
});`,
64-
'utf-8'
65+
'utf-8',
6566
);
6667
}

0 commit comments

Comments
 (0)