Skip to content

Commit 8b5ec45

Browse files
authored
Merge pull request #526 from gadget-inc/upgrade-vite-5
Upgrade vite 5
2 parents b8bc330 + febe836 commit 8b5ec45

Some content is hidden

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

44 files changed

+4237
-5314
lines changed

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node-version: [18.x, 20.x]
11+
node-version: [18.x, 20.x, 22.x]
1212
os: [ubuntu-latest]
1313

1414
steps:
@@ -24,6 +24,8 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v3
2626
- uses: ./.github/actions/setup-test-env
27+
- name: Build JS
28+
run: pnpm build
2729
- name: Run Lint
2830
run: pnpm run lint
2931

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
packages =
2222
rec {
2323
bash = pkgs.bash;
24-
nodejs = pkgs.nodejs-18_x;
25-
pnpm = pkgs.nodePackages.pnpm;
24+
nodejs = pkgs.nodejs_22;
25+
corepack = pkgs.corepack_22;
2626
};
2727

2828
devShell = pkgs.mkShell {

jest.config.js

-3
This file was deleted.

package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
"lint:fix": "prettier --loglevel warn --write \"packages/**/*.{ts,tsx}\" && eslint \"packages/**/*.{ts,tsx}\" --quiet --fix",
1111
"release": "pnpm -F=fastify-renderer publish",
1212
"preinstall": "npx only-allow pnpm",
13-
"prerelease": "pnpm -F=fastify-renderer run gitpkg publish",
14-
"test": "jest --forceExit -w=1",
15-
"test:debug": "cross-env FR_DEBUG_SERVE=1 node --inspect-brk ./node_modules/.bin/jest --forceExit"
13+
"prerelease": "pnpm -F=fastify-renderer exec gitpkg publish",
14+
"test": "vitest --pool=forks --run"
1615
},
1716
"repository": {
1817
"type": "git",
@@ -44,9 +43,8 @@
4443
"eslint-plugin-prettier": "^4.2.1",
4544
"eslint-plugin-react": "^7.33.2",
4645
"eslint-plugin-react-hooks": "^4.6.0",
47-
"expect-playwright": "^0.8.0",
4846
"fs-extra": "^11.1.0",
49-
"jest": "^29.7.0",
47+
"vitest": "^2.1.2",
5048
"playwright-chromium": "^1.39.0",
5149
"prettier": "^2.8.8",
5250
"prettier-plugin-organize-imports": "^3.2.3",
@@ -59,5 +57,6 @@
5957
"@types/react": "17.0.4",
6058
"@types/react-dom": "17.0.4"
6159
}
62-
}
60+
},
61+
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
6362
}

packages/fastify-renderer/jest.config.js

-196
This file was deleted.

packages/fastify-renderer/package.json

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
{
22
"name": "fastify-renderer",
3-
"version": "0.4.2",
3+
"version": "0.5.0",
44
"description": "Simple, high performance client side app renderer for Fastify.",
55
"exports": {
66
".": {
7-
"require": "./node/index.js"
7+
"import": "./node/index.js",
8+
"default": "./node/index.js"
89
},
910
"./client/react": {
11+
"import": "./client/react/index.js",
1012
"default": "./client/react/index.js"
1113
},
14+
"./client/react/DefaultLayout": {
15+
"import": "./client/react/DefaultLayout.js",
16+
"default": "./client/react/DefaultLayout.js"
17+
},
1218
"./package": "./package.json",
1319
"./package.json": "./package.json"
1420
},
@@ -29,7 +35,7 @@
2935
"lint:fix": "prettier --loglevel warn --write \"{src,test}/**/*.{ts,tsx}\" && eslint \"{src,test}/**/*.{ts,tsx}\" --quiet --fix",
3036
"prepublishOnly": "npm run build",
3137
"test": "run-s build test:unit lint",
32-
"test:unit": "jest"
38+
"test:unit": "vitest --run"
3339
},
3440
"repository": {
3541
"type": "git",
@@ -64,11 +70,11 @@
6470
"@vitejs/plugin-react-refresh": "^1.3.6",
6571
"fastify-plugin": "^4.5.1",
6672
"http-errors": "^1.8.1",
67-
"path-to-regexp": "^6.2.1",
73+
"path-to-regexp": "^8.2.0",
6874
"sanitize-filename": "^1.6.3",
6975
"stream-template": "^0.0.10",
70-
"vite": "^2.9.15",
71-
"wouter": "^2.7.5"
76+
"vite": "^5.3.1",
77+
"wouter": "^3.3.2"
7278
},
7379
"peerDependencies": {
7480
"fastify": "^4.24.2",
@@ -77,9 +83,7 @@
7783
},
7884
"devDependencies": {
7985
"@swc/core": "^1.3.95",
80-
"@swc/jest": "^0.2.29",
8186
"@types/connect": "^3.4.35",
82-
"@types/jest": "^29.5.6",
8387
"@types/node": "^18.11.9",
8488
"@types/react": "^17.0.43",
8589
"@types/react-dom": "^17.0.11",
@@ -95,7 +99,7 @@
9599
"eslint-plugin-react-hooks": "^4.6.0",
96100
"fastify": "^4.24.2",
97101
"gitpkg": "^1.0.0-beta.2",
98-
"jest": "^29.7.0",
102+
"vitest": "^2.1.2",
99103
"npm-run-all": "^4.1.5",
100104
"pino-pretty": "^8.1.0",
101105
"prettier": "^2.7.1",

packages/fastify-renderer/src/client/react/Root.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useEffect, useState } from 'react'
22
import { Route, Router, Switch, useLocation, useRouter } from 'wouter'
33
import { usePromise } from './fetcher'
4-
import { shouldScrollToHash, useNavigationDetails, useTransitionLocation } from './locationHook'
5-
import { matcher } from './matcher'
4+
import { shouldScrollToHash, useNavigationDetails, useTransitionLocation, TransitionProvider } from './locationHook'
5+
import { parser } from './parser'
66

77
export interface LayoutProps {
88
isNavigating: boolean
@@ -82,8 +82,10 @@ export function Root<BootProps extends Record<string, any>>(props: {
8282
]
8383

8484
return (
85-
<Router base={props.basePath} hook={useTransitionLocation as any} matcher={matcher}>
86-
<RouteTable routes={routes} Layout={props.Layout} bootProps={props.bootProps} />
87-
</Router>
85+
<TransitionProvider>
86+
<Router base={props.basePath} hook={useTransitionLocation as any} parser={parser}>
87+
<RouteTable routes={routes} Layout={props.Layout} bootProps={props.bootProps} />
88+
</Router>
89+
</TransitionProvider>
8890
)
8991
}

0 commit comments

Comments
 (0)