-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests: inital framework * Update index.spec.js * Update package.json * Update test.yml * Update index.spec.js * chore: add basic cases * test: update for CI * chore: pkg update * chore: increase timeout * chore: change to the actual directory * chore: force add 30s * ci: fix timeout * ci: test one * ci: debug * switch to node:test * test: add another example with tailwind and tests * chore: switch to `@matteo.collina/snap` for now * fix: null check viteEnv for builds
- Loading branch information
1 parent
cada9db
commit 481706d
Showing
33 changed files
with
553 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 class=\"text-red-500\">Hello World</h1></div>\n <script type='module' src=\"/virtual:adex:client\"></script></body>\n </html>\n " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export type { | ||
export { | ||
useHead, | ||
useLang, | ||
useLink, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { parse as pathToRegex } from 'regexparam' | ||
export { prerender as renderToString } from 'preact-iso' | ||
export { renderToStringAsync } from 'preact-render-to-string' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions":{ | ||
"jsx":"react-jsx", | ||
"jsxImportSource": "preact" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "minimal-tailwind", | ||
"type": "module", | ||
"dependencies": { | ||
"@preact/preset-vite": "catalog:", | ||
"adex": "workspace:*", | ||
"preact": "catalog:" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^10.4.20", | ||
"tailwindcss": "^3", | ||
"vite": "^5.4.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function AboutPage() { | ||
return <h2>About</h2> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <h1 class="text-red-500">Hello World</h1> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: ['./src/pages/**/*.{tsx,jsx}'], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'vite' | ||
import { adex } from "adex" | ||
import preact from "@preact/preset-vite" | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
adex({ | ||
islands: false, | ||
ssr: true, | ||
}), | ||
preact(), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions":{ | ||
"jsx":"react-jsx", | ||
"jsxImportSource": "preact" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "minimal", | ||
"type": "module", | ||
"dependencies": { | ||
"adex": "workspace:*", | ||
"preact": "catalog:", | ||
"@preact/preset-vite": "catalog:" | ||
}, | ||
|
||
"devDependencies": { | ||
"vite": "^5.4.8" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function AboutPage() { | ||
return <h2>About</h2> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <h1>Hello World</h1> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'vite' | ||
import { adex } from "adex" | ||
import preact from "@preact/preset-vite" | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
adex({ | ||
islands: false, | ||
ssr: true, | ||
}), | ||
preact(), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Snap from '@matteo.collina/snap' | ||
import { after, before, describe, it } from 'node:test' | ||
import assert, { deepEqual } from 'node:assert' | ||
|
||
import { devServerURL, launchDemoDevServer } from './utils.js' | ||
const snap = Snap(import.meta.url) | ||
|
||
describe('devMode ssr minimal with styles', async () => { | ||
let devServerProc | ||
before(async () => { | ||
devServerProc = await launchDemoDevServer('tests/fixtures/minimal-tailwind') | ||
}) | ||
after(async () => { | ||
devServerProc.kill() | ||
}) | ||
|
||
await it('gives a non-static ssr response', async ctx => { | ||
const response = await fetch(devServerURL).then(d => d.text()) | ||
const snapshot = await snap(response) | ||
deepEqual(response, snapshot) | ||
}) | ||
|
||
await it('gives a static SSR response', async ctx => { | ||
const response2 = await fetch(new URL('/about', devServerURL)).then(d => | ||
d.text() | ||
) | ||
const snapshot = await snap(response2) | ||
deepEqual(response2, snapshot) | ||
}) | ||
|
||
await it('has styles', async ctx => { | ||
const response = await fetch( | ||
new URL('/virtual:adex:global.css', devServerURL) | ||
).then(d => d.text()) | ||
assert.ok(response.includes('.text-red-500')) | ||
}) | ||
}) |
Oops, something went wrong.