Skip to content

Commit fc486fa

Browse files
authored
Merge branch 'main' into fix-first-image-cached
2 parents 2c62a17 + cec4af8 commit fc486fa

143 files changed

Lines changed: 849 additions & 855 deletions

File tree

Some content is hidden

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

.changeset/breezy-plums-clap.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/dull-lemons-check.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

.changeset/nine-mayflies-film.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@ jobs:
9595
- name: Build Packages
9696
run: pnpm run build
9797

98-
- name: Lint
98+
- name: Lint source code
9999
run: pnpm run lint:ci
100100

101+
- name: Lint publish code
102+
run: pnpm run publint
103+
101104
test:
102105
name: "Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
103106
runs-on: ${{ matrix.os }}

benchmark/bench/codspeed.js

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,62 @@ import path from 'node:path';
22
import { withCodSpeed } from '@codspeed/tinybench-plugin';
33
import { Bench } from 'tinybench';
44
import { exec } from 'tinyexec';
5-
import { renderPages } from '../make-project/render-default.js';
65
import { astroBin } from './_util.js';
76

87
export async function run({ memory: _memory, render, stress: _stress }) {
98
const options = {
109
iterations: 10,
1110
};
1211
const bench = process.env.CODSPEED ? withCodSpeed(new Bench(options)) : new Bench(options);
13-
let app;
14-
bench.add(
15-
'Rendering',
16-
async () => {
12+
await exec(astroBin, ['build'], {
13+
nodeOptions: {
14+
cwd: render.root,
15+
stdio: 'inherit',
16+
},
17+
});
18+
19+
const entry = new URL('./dist/server/entry.mjs', `file://${render.root}`);
20+
const { manifest, createApp } = await import(entry);
21+
const streamingApp = createApp(manifest, true);
22+
const nonStreamingApp = createApp(manifest, false);
23+
bench
24+
.add('Rendering: streaming [true], .astro file', async () => {
1725
console.info('Start task.');
18-
const result = {};
19-
for (const fileName of renderPages) {
20-
const pathname = '/' + fileName.slice(0, -path.extname(fileName).length);
21-
const request = new Request(new URL(pathname, 'http://exmpale.com'));
22-
const response = await app.render(request);
23-
const html = await response.text();
24-
if (!result[pathname]) result[pathname] = [];
25-
result[pathname].push(html);
26-
}
26+
const request = new Request(new URL('http://exmpale.com/astro'));
27+
await streamingApp.render(request);
2728
console.info('Finish task.');
28-
return result;
29-
},
30-
{
31-
async beforeAll() {
32-
// build for rendering
33-
await exec(astroBin, ['build'], {
34-
nodeOptions: {
35-
cwd: render.root,
36-
stdio: 'inherit',
37-
},
38-
});
29+
})
30+
.add('Rendering: streaming [true], .md file', async () => {
31+
console.info('Start task.');
32+
const request = new Request(new URL('http://exmpale.com/md'));
33+
await streamingApp.render(request);
34+
console.info('Finish task.');
35+
})
36+
.add('Rendering: streaming [true], .mdx file', async () => {
37+
console.info('Start task.');
38+
const request = new Request(new URL('http://exmpale.com/mdx'));
39+
await streamingApp.render(request);
40+
console.info('Finish task.');
41+
})
3942

40-
const entry = new URL('./dist/server/entry.mjs', `file://${render.root}`);
41-
const { manifest, createApp } = await import(entry);
42-
app = createApp(manifest);
43-
app.manifest = manifest;
44-
},
45-
},
46-
);
43+
.add('Rendering: streaming [false], .astro file', async () => {
44+
console.info('Start task.');
45+
const request = new Request(new URL('http://exmpale.com/astro'));
46+
await nonStreamingApp.render(request);
47+
console.info('Finish task.');
48+
})
49+
.add('Rendering: streaming [false], .md file', async () => {
50+
console.info('Start task.');
51+
const request = new Request(new URL('http://exmpale.com/md'));
52+
await nonStreamingApp.render(request);
53+
console.info('Finish task.');
54+
})
55+
.add('Rendering: streaming [false], .mdx file', async () => {
56+
console.info('Start task.');
57+
const request = new Request(new URL('http://exmpale.com/mdx'));
58+
await nonStreamingApp.render(request);
59+
console.info('Finish task.');
60+
});
4761

4862
await bench.run();
4963
console.table(bench.table());

benchmark/packages/adapter/src/server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ applyPolyfills();
77

88
class MyApp extends App {
99
#manifest: SSRManifest | undefined;
10-
#streaming: boolean;
1110
constructor(manifest: SSRManifest, streaming = false) {
1211
super(manifest, streaming);
1312
this.#manifest = manifest;
14-
this.#streaming = streaming;
1513
}
1614

1715
async render(request: Request) {

examples/basics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.16.10"
14+
"astro": "^4.16.13"
1515
}
1616
}

examples/blog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"@astrojs/mdx": "^3.1.9",
1515
"@astrojs/rss": "^4.0.9",
1616
"@astrojs/sitemap": "^3.2.1",
17-
"astro": "^4.16.10"
17+
"astro": "^4.16.13"
1818
}
1919
}

examples/component/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"scripts": {},
1717
"devDependencies": {
18-
"astro": "^4.16.10"
18+
"astro": "^4.16.13"
1919
},
2020
"peerDependencies": {
2121
"astro": "^4.0.0"

examples/container-with-vitest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test": "vitest run"
1313
},
1414
"dependencies": {
15-
"astro": "^4.16.10",
15+
"astro": "^4.16.13",
1616
"@astrojs/react": "^3.6.2",
1717
"react": "^18.3.1",
1818
"react-dom": "^18.3.1",

0 commit comments

Comments
 (0)