Skip to content

Commit e39dcdf

Browse files
committed
chore: update for no-ssr
1 parent 7523ab8 commit e39dcdf

File tree

9 files changed

+80
-0
lines changed

9 files changed

+80
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"\n <!doctype html>\n <html lang=\"\">\n <head>\n <script type=\"module\" src=\"/@vite/client\"></script>\n\n <meta charset=\"UTF-8\" />\n \n <title></title>\n\n \n \n \n </head>\n <body>\n <div id=\"app\"><h1>Hello World</h1></div>\n <script type='module' src=\"/virtual:adex:client\"></script></body>\n </html>\n "
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"\n <!doctype html>\n <html lang=\"\">\n <head>\n <script type=\"module\" src=\"/@vite/client\"></script>\n\n <meta charset=\"UTF-8\" />\n \n <title></title>\n\n \n \n \n </head>\n <body>\n <div id=\"app\"><h2>About</h2></div>\n <script type='module' src=\"/virtual:adex:client\"></script></body>\n </html>\n "
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"import { createHotContext as __vite__createHotContext } from \"/@vite/client\";import.meta.hot = __vite__createHotContext(\"/@id/__x00__virtual:adex:global.css\");import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from \"/@vite/client\"\nconst __vite__id = \"\\u0000virtual:adex:global.css\"\nconst __vite__css = \"\"\n__vite__updateStyle(__vite__id, __vite__css)\nimport.meta.hot.accept()\nimport.meta.hot.prune(() => __vite__removeStyle(__vite__id))"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions":{
3+
"jsx":"react-jsx",
4+
"jsxImportSource": "preact"
5+
}
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "minimal",
3+
"type": "module",
4+
"private": true,
5+
"version": "0.0.0",
6+
"dependencies": {
7+
"adex": "workspace:*",
8+
"preact": "catalog:",
9+
"@preact/preset-vite": "catalog:"
10+
},
11+
"devDependencies": {
12+
"vite": "^5.4.8"
13+
}
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function AboutPage() {
2+
return <h2>About</h2>
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <h1>Hello World</h1>
3+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'vite'
2+
import { adex } from 'adex'
3+
import preact from '@preact/preset-vite'
4+
5+
export default defineConfig({
6+
plugins: [
7+
adex({
8+
islands: false,
9+
ssr: false,
10+
}),
11+
preact(),
12+
],
13+
})

adex/tests/minimal-no-ssr.spec.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Snap from '@matteo.collina/snap'
2+
import { after, before, describe, it } from 'node:test'
3+
import { deepEqual } from 'node:assert/strict'
4+
5+
import { devServerURL, launchDemoDevServer } from './utils.js'
6+
7+
const snap = Snap(import.meta.url)
8+
9+
describe('devMode ssr minimal', async () => {
10+
let devServerProc
11+
before(async () => {
12+
devServerProc = await launchDemoDevServer('tests/fixtures/minimal-no-ssr')
13+
})
14+
after(async () => {
15+
devServerProc.kill()
16+
})
17+
18+
await it('gives a static response', async ctx => {
19+
const response2 = await fetch(new URL('/', devServerURL)).then(d =>
20+
d.text()
21+
)
22+
deepEqual(response2, await snap(response2))
23+
})
24+
25+
await it('gives a static response', async ctx => {
26+
const response2 = await fetch(new URL('/about', devServerURL)).then(d =>
27+
d.text()
28+
)
29+
deepEqual(response2, await snap(response2))
30+
})
31+
32+
await it('blank styles', async ctx => {
33+
const response = await fetch(
34+
new URL('/virtual:adex:global.css', devServerURL)
35+
).then(d => d.text())
36+
deepEqual(response, await snap(response))
37+
})
38+
})

0 commit comments

Comments
 (0)