diff --git a/examples/react-hydration/server.test.js b/examples/react-hydration/server.test.js index fe8c3163..583e1417 100644 --- a/examples/react-hydration/server.test.js +++ b/examples/react-hydration/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('react-hydration', async (t) => { await t.test('render index page in development', makeIndexTest({ main, dev: true })) diff --git a/examples/react-hydration/vite.config.js b/examples/react-hydration/vite.config.js index 61bc7af0..3b2587f2 100644 --- a/examples/react-hydration/vite.config.js +++ b/examples/react-hydration/vite.config.js @@ -1,19 +1,13 @@ -import { resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' -import { viteFastify } from '@fastify/vite/plugin' +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' import viteReact from '@vitejs/plugin-react' -const path = fileURLToPath(import.meta.url) -const root = resolve(dirname(path), 'client') - -const plugins = [ - viteFastify(), - viteReact({ jsxRuntime: 'classic' }) -] - export default { - root, - plugins, + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteReact({ jsxRuntime: 'classic' }) + ], ssr: { external: ['fastify'] } diff --git a/examples/react-next/server.test.js b/examples/react-next/server.test.js index 93c2878f..793ad547 100644 --- a/examples/react-next/server.test.js +++ b/examples/react-next/server.test.js @@ -1,11 +1,11 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname -test('render index page in development', makeIndexTest({ main, dev: true })) -test('build production bundle', makeSSRBuildTest({ cwd })) -test('render index page in production', makeIndexTest({ main })) +test('react-next', async (t) => { + await t.test('render index page in development', makeIndexTest({ main, dev: true })) + await t.test('build production bundle', makeSSRBuildTest({ cwd })) + await t.test('render index page in production', makeIndexTest({ main })) +}) \ No newline at end of file diff --git a/examples/react-next/vite.config.js b/examples/react-next/vite.config.js index c95ae7ca..e108840f 100644 --- a/examples/react-next/vite.config.js +++ b/examples/react-next/vite.config.js @@ -1,17 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteReact({ jsxRuntime: "classic" })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteReact from '@vitejs/plugin-react' export default { - root, - plugins, - server: { - hmr: !!process.env.TEST, - }, -}; + root: join(importa.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteReact({ jsxRuntime: "classic" }) + ], +} diff --git a/examples/react-streaming/server.test.js b/examples/react-streaming/server.test.js index 93c2878f..201233a7 100644 --- a/examples/react-streaming/server.test.js +++ b/examples/react-streaming/server.test.js @@ -1,11 +1,11 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname -test('render index page in development', makeIndexTest({ main, dev: true })) -test('build production bundle', makeSSRBuildTest({ cwd })) -test('render index page in production', makeIndexTest({ main })) +test('react-streaming', async (t) => { + await t.test('render index page in development', makeIndexTest({ main, dev: true })) + await t.test('build production bundle', makeSSRBuildTest({ cwd })) + await t.test('render index page in production', makeIndexTest({ main })) +}) diff --git a/examples/react-streaming/vite.config.js b/examples/react-streaming/vite.config.js index 7d460677..c19d68dd 100644 --- a/examples/react-streaming/vite.config.js +++ b/examples/react-streaming/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteReact({ jsxRuntime: "classic" })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteReact from '@vitejs/plugin-react' export default { - root, - plugins, -}; + root: join(importa.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteReact({ jsxRuntime: 'classic' }) + ], +} diff --git a/examples/react-vanilla-spa/server.test.js b/examples/react-vanilla-spa/server.test.js index 4a86aa8b..6d231d31 100644 --- a/examples/react-vanilla-spa/server.test.js +++ b/examples/react-vanilla-spa/server.test.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url' import { makeIndexTest, makeSPABuildTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('react-vanilla-spa', async (t) => { await t.test('build production bundle', makeSPABuildTest({ cwd })) diff --git a/examples/react-vanilla-spa/vite.config.js b/examples/react-vanilla-spa/vite.config.js index 7d460677..e108840f 100644 --- a/examples/react-vanilla-spa/vite.config.js +++ b/examples/react-vanilla-spa/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteReact({ jsxRuntime: "classic" })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteReact from '@vitejs/plugin-react' export default { - root, - plugins, -}; + root: join(importa.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteReact({ jsxRuntime: "classic" }) + ], +} diff --git a/examples/react-vanilla/server.test.js b/examples/react-vanilla/server.test.js index ca761115..62c9d8ea 100644 --- a/examples/react-vanilla/server.test.js +++ b/examples/react-vanilla/server.test.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('react-vanilla', async (t) => { await t.test('render index page in development', makeIndexTest({ main, dev: true })) diff --git a/examples/react-vanilla/vite.config.js b/examples/react-vanilla/vite.config.js index 7d460677..c19d68dd 100644 --- a/examples/react-vanilla/vite.config.js +++ b/examples/react-vanilla/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteReact({ jsxRuntime: "classic" })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteReact from '@vitejs/plugin-react' export default { - root, - plugins, -}; + root: join(importa.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteReact({ jsxRuntime: 'classic' }) + ], +} diff --git a/examples/solid-hydration/server.test.js b/examples/solid-hydration/server.test.js index 93c2878f..dac1b2c6 100644 --- a/examples/solid-hydration/server.test.js +++ b/examples/solid-hydration/server.test.js @@ -1,11 +1,11 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname -test('render index page in development', makeIndexTest({ main, dev: true })) -test('build production bundle', makeSSRBuildTest({ cwd })) -test('render index page in production', makeIndexTest({ main })) +test('solid-hydration', async (t) => { + await t.test('render index page in development', makeIndexTest({ main, dev: true })) + await t.test('build production bundle', makeSSRBuildTest({ cwd })) + await t.test('render index page in production', makeIndexTest({ main })) +}) diff --git a/examples/solid-hydration/vite.config.js b/examples/solid-hydration/vite.config.js index 6d49ca4f..6d4df8ee 100644 --- a/examples/solid-hydration/vite.config.js +++ b/examples/solid-hydration/vite.config.js @@ -1,19 +1,14 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteSolid from "vite-plugin-solid"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteSolid({ ssr: true })]; - -const ssr = { - noExternal: ["@solidjs/router"], -}; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteSolid from 'vite-plugin-solid' export default { - root, - plugins, - ssr, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteSolid({ ssr: true }) + ], + ssr: { + noExternal: ['@solidjs/router'], + }, +} diff --git a/examples/solid-vanilla/server.test.js b/examples/solid-vanilla/server.test.js index 93c2878f..d072cbdd 100644 --- a/examples/solid-vanilla/server.test.js +++ b/examples/solid-vanilla/server.test.js @@ -1,11 +1,11 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname -test('render index page in development', makeIndexTest({ main, dev: true })) -test('build production bundle', makeSSRBuildTest({ cwd })) -test('render index page in production', makeIndexTest({ main })) +test('solid-vanilla', async (t) => { + await t.test('render index page in development', makeIndexTest({ main, dev: true })) + await t.test('build production bundle', makeSSRBuildTest({ cwd })) + await t.test('render index page in production', makeIndexTest({ main })) +}) diff --git a/examples/solid-vanilla/vite.config.js b/examples/solid-vanilla/vite.config.js index 1897510e..c5410264 100644 --- a/examples/solid-vanilla/vite.config.js +++ b/examples/solid-vanilla/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteSolid from "vite-plugin-solid"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteSolid({ ssr: true })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import viteSolid from 'vite-plugin-solid' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteSolid({ ssr: true }) + ], +} diff --git a/examples/svelte-hydration/server.test.js b/examples/svelte-hydration/server.test.js index 95605c61..db89bffe 100644 --- a/examples/svelte-hydration/server.test.js +++ b/examples/svelte-hydration/server.test.js @@ -1,11 +1,10 @@ import test from 'node:test' import { setTimeout } from 'node:timers/promises' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' + import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('svelte-hydration', async (t) => { await t.test('build production bundle', makeSSRBuildTest({ cwd })) diff --git a/examples/svelte-hydration/vite.config.js b/examples/svelte-hydration/vite.config.js index ae1271af..6456fdb0 100644 --- a/examples/svelte-hydration/vite.config.js +++ b/examples/svelte-hydration/vite.config.js @@ -1,21 +1,15 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import { svelte as viteSvelte } from "@sveltejs/vite-plugin-svelte"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [ - viteFastify(), - viteSvelte({ - compilerOptions: { - hydratable: true, - }, - }), -]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import { svelte as viteSvelte } from '@sveltejs/vite-plugin-svelte' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteSvelte({ + compilerOptions: { + hydratable: true, + }, + }), + ], +} diff --git a/examples/svelte-vanilla/server.test.js b/examples/svelte-vanilla/server.test.js index 5b0635c8..a4d71a51 100644 --- a/examples/svelte-vanilla/server.test.js +++ b/examples/svelte-vanilla/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('build production bundle', makeSSRBuildTest({ cwd })) test('render index page in development', makeIndexTest({ main, dev: true })) diff --git a/examples/svelte-vanilla/vite.config.js b/examples/svelte-vanilla/vite.config.js index 5570d985..e61cb555 100644 --- a/examples/svelte-vanilla/vite.config.js +++ b/examples/svelte-vanilla/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import { svelte as viteSvelte } from "@sveltejs/vite-plugin-svelte"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteSvelte()]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import { svelte as viteSvelte } from '@sveltejs/vite-plugin-svelte' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + viteSvelte() + ], +} diff --git a/examples/typescript-vanilla/vite.config.js b/examples/typescript-vanilla/vite.config.js index a9858194..4c87f569 100644 --- a/examples/typescript-vanilla/vite.config.js +++ b/examples/typescript-vanilla/vite.config.js @@ -1,13 +1,15 @@ -import { resolve } from "node:path"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; +import { join } from 'node:path' +import { viteFastify } from '@fastify/vite/plugin' +import viteReact from '@vitejs/plugin-react' -/** @type {import('vite').UserConfig} */ export default { - root: resolve(import.meta.dirname, "src/client"), - plugins: [viteReact(), viteFastify()], + root: join(import.meta.dirname, 'src/client'), + plugins: [ + viteReact(), + viteFastify() + ], build: { emptyOutDir: true, - outDir: resolve(import.meta.dirname, "dist/client"), + outDir: join(import.meta.dirname, 'dist/client'), }, }; diff --git a/examples/vue-hydration/server.test.js b/examples/vue-hydration/server.test.js index 3e49d24d..c8a8e2f5 100644 --- a/examples/vue-hydration/server.test.js +++ b/examples/vue-hydration/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('vue-hydration', async (t) => { await t.test('build production bundle', makeSSRBuildTest({ cwd })) diff --git a/examples/vue-hydration/vite.config.js b/examples/vue-hydration/vite.config.js index ebbf8418..375dac15 100644 --- a/examples/vue-hydration/vite.config.js +++ b/examples/vue-hydration/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import vuePlugin from "@vitejs/plugin-vue"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), vuePlugin()]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import vuePlugin from '@vitejs/plugin-vue' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + vuePlugin() + ], +} diff --git a/examples/vue-next/server.test.js b/examples/vue-next/server.test.js index 93c2878f..40eca849 100644 --- a/examples/vue-next/server.test.js +++ b/examples/vue-next/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('render index page in development', makeIndexTest({ main, dev: true })) test('build production bundle', makeSSRBuildTest({ cwd })) diff --git a/examples/vue-next/vite.config.js b/examples/vue-next/vite.config.js index 520e5286..375dac15 100644 --- a/examples/vue-next/vite.config.js +++ b/examples/vue-next/vite.config.js @@ -1,15 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { defineConfig } from "vite"; -import { viteFastify } from "@fastify/vite/plugin"; -import vuePlugin from "@vitejs/plugin-vue"; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import vuePlugin from '@vitejs/plugin-vue' -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), vuePlugin()]; - -export default defineConfig({ - root, - plugins, -}); +export default { + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + vuePlugin() + ], +} diff --git a/examples/vue-streaming/server.test.js b/examples/vue-streaming/server.test.js index 93c2878f..40eca849 100644 --- a/examples/vue-streaming/server.test.js +++ b/examples/vue-streaming/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('render index page in development', makeIndexTest({ main, dev: true })) test('build production bundle', makeSSRBuildTest({ cwd })) diff --git a/examples/vue-vanilla-spa/server.test.js b/examples/vue-vanilla-spa/server.test.js index d4ae5c40..5d36489c 100644 --- a/examples/vue-vanilla-spa/server.test.js +++ b/examples/vue-vanilla-spa/server.test.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url' import { makeIndexTest, makeSPABuildTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('vue-vanilla-spa', async (t) => { await t.test('build production bundle', makeSPABuildTest({ cwd })) diff --git a/examples/vue-vanilla-spa/vite.config.js b/examples/vue-vanilla-spa/vite.config.js index 7d460677..375dac15 100644 --- a/examples/vue-vanilla-spa/vite.config.js +++ b/examples/vue-vanilla-spa/vite.config.js @@ -1,14 +1,11 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import viteReact from "@vitejs/plugin-react"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), viteReact({ jsxRuntime: "classic" })]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import vuePlugin from '@vitejs/plugin-vue' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [ + viteFastify(), + vuePlugin() + ], +} diff --git a/examples/vue-vanilla/server.test.js b/examples/vue-vanilla/server.test.js index 068b6dcd..1dd7a254 100644 --- a/examples/vue-vanilla/server.test.js +++ b/examples/vue-vanilla/server.test.js @@ -1,10 +1,8 @@ import test from 'node:test' -import { join, resolve, dirname } from 'node:path' -import { fileURLToPath } from 'node:url' import { makeSSRBuildTest, makeIndexTest } from '../test-factories.mjs' import { main } from './server.js' -const cwd = dirname(fileURLToPath(import.meta.url)) +const cwd = import.meta.dirname test('vue-vanilla', async (t) => { await t.test('render index page in development', makeIndexTest({ main, dev: true })) diff --git a/examples/vue-vanilla/vite.config.js b/examples/vue-vanilla/vite.config.js index ebbf8418..fb80fdb7 100644 --- a/examples/vue-vanilla/vite.config.js +++ b/examples/vue-vanilla/vite.config.js @@ -1,14 +1,8 @@ -import { resolve, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { viteFastify } from "@fastify/vite/plugin"; -import vuePlugin from "@vitejs/plugin-vue"; - -const path = fileURLToPath(import.meta.url); -const root = resolve(dirname(path), "client"); - -const plugins = [viteFastify(), vuePlugin()]; +import { join } from 'node:path' +import viteFastify from '@fastify/vite/plugin' +import vuePlugin from '@vitejs/plugin-vue' export default { - root, - plugins, -}; + root: join(import.meta.dirname, 'client'), + plugins: [viteFastify(), vuePlugin()], +}