Skip to content

Commit 76daca3

Browse files
onlyweigalvez
andauthored
V8.1.3 review (#265)
* fix: Remove optionalDependencies from @fastify/vite (#257) * docs: rm outdated info * docs: update roadmap * docs: update known limitations * docs: update section on route location * chore: fix pnpm-lock.yaml * Import meta dirname filename (#263) * Use import.meta.dirname instead of import.meta.url * Use import.meta.filename * undo changes in contrib folder * Fix some stuff I missed * Add src/ directory to TypeScript starters (#264) * Bump @fastify/[email protected] --------- Co-authored-by: Jonas Galvez <[email protected]>
1 parent fa6d183 commit 76daca3

File tree

86 files changed

+613
-1035
lines changed

Some content is hidden

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

86 files changed

+613
-1035
lines changed

contrib/htmx-base-ts/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ server.decorate('db', {
2929

3030
await server.register(FastifyFormBody)
3131
await server.register(FastifyVite, {
32-
root: import.meta.url,
32+
root: import.meta.dirname,
3333
renderer: '@fastify/htmx',
3434
})
3535

contrib/htmx-base/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ server.decorate('db', {
2929

3030
await server.register(FastifyFormBody)
3131
await server.register(FastifyVite, {
32-
root: import.meta.url,
32+
root: import.meta.dirname,
3333
renderer: '@fastify/htmx',
3434
})
3535

contrib/htmx-kitchensink/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ server.decorate('db', {
2929

3030
await server.register(FastifyFormBody)
3131
await server.register(FastifyVite, {
32-
root: import.meta.url,
32+
root: import.meta.dirname,
3333
renderer: '@fastify/htmx',
3434
})
3535

docs/.vitepress/config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { createRequire } from 'module'
2-
import { defineConfig, type DefaultTheme } from 'vitepress'
3-
import { withMermaid } from "vitepress-plugin-mermaid";
4-
5-
const require = createRequire(import.meta.url)
1+
import { withMermaid } from 'vitepress-plugin-mermaid'
2+
import type { DefaultTheme } from 'vitepress'
63

74
export default withMermaid({
85
lang: 'en-US',

docs/config/react/vite-plugin.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
The **`@fastify/react/plugin`** Vite plugin has the following options:
44

55
```js {14-15}
6-
import { join, dirname } from 'path'
6+
import { resolve } from 'node:path'
77
import { fileURLToPath } from 'url'
88

99
import viteReact from '@vitejs/plugin-react'
1010
import viteFastify from '@fastify/vite/plugin'
1111
import viteFastifyReact from '@fastify/react/plugin'
1212

13-
const path = fileURLToPath(import.meta.url)
14-
1513
export default {
16-
root: join(dirname(path), 'client'),
14+
root: resolve(import.meta.dirname, 'client'),
1715
plugins: [
1816
viteReact(),
1917
viteFastify(),

docs/config/vue/vite-plugin.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
The **`@fastify/vue/plugin`** Vite plugin has the following options:
44

55
```js {14-15}
6-
import { join, dirname } from 'path'
7-
import { fileURLToPath } from 'url'
6+
import { resolve } from 'node:path'
87

98
import viteVue from '@vitejs/plugin-vue'
109
import viteFastify from '@fastify/vite/plugin'
1110
import viteFastifyVue from '@fastify/vue/plugin'
1211

13-
const path = fileURLToPath(import.meta.url)
14-
1512
export default {
16-
root: join(dirname(path), 'client'),
13+
root: resolve(import.meta.dirname, 'client'),
1714
plugins: [
1815
viteVue(),
1916
viteFastify(),

docs/guide/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import FastifyVite from '@fastify/vite'
5959
const server = Fastify()
6060

6161
await server.register(FastifyVite, {
62-
root: import.meta.url, // where to look for vite.config.js
62+
root: import.meta.dirname, // where to look for vite.config.js
6363
dev: process.argv.includes('--dev'),
6464
spa: true
6565
})

docs/guide/rendering-function.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To illustrate, a snippet from the [`react-vanilla`][react-vanilla] SSR example:
1515

1616
```js {4-9}
1717
await server.register(FastifyVite, {
18-
root: import.meta.url,
18+
root: import.meta.dirname,
1919
createRenderFunction ({ createApp }) {
2020
return () => {
2121
return {
@@ -124,7 +124,7 @@ That is to say, `reply.html()` is the same as `reply.html(reply.render())`.
124124
const server = Fastify()
125125

126126
await server.register(FastifyVite, {
127-
root: import.meta.url,
127+
root: import.meta.dirname,
128128
dev: process.argv.includes('--dev'),
129129
createRenderFunction ({ createApp }) {
130130
return () => {

docs/guide/router-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const server = Fastify({
2828
})
2929

3030
await server.register(FastifyVite, {
31-
root: import.meta.url,
31+
root: import.meta.dirname,
3232
renderer,
3333
})
3434

docs/react/project-structure.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,21 @@ const server = Fastify({
140140
})
141141

142142
await server.register(FastifyVite, {
143-
root: import.meta.url,
143+
root: import.meta.dirname,
144144
renderer: '@fastify/react',
145145
})
146146

147147
await server.vite.ready()
148148
await server.listen({ port: 3000 })
149149
```
150150
```js [vite.config.js]
151-
import { join, dirname } from 'path'
152-
import { fileURLToPath } from 'url'
151+
import { resolve } from 'node:path'
153152

154153
import viteReact from '@vitejs/plugin-react'
155154
import fastifyReact from '@fastify/react/plugin'
156155

157-
const path = fileURLToPath(import.meta.url)
158-
159156
export default {
160-
root: join(dirname(path), 'client'),
157+
root: resolve(import.meta.dirname, 'client'),
161158
plugins: [
162159
viteReact(),
163160
fastifyReact(),

0 commit comments

Comments
 (0)