Skip to content

Commit

Permalink
feat: update to Vite v5.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Mar 19, 2024
1 parent 2a6b922 commit 5955579
Show file tree
Hide file tree
Showing 15 changed files with 492 additions and 340 deletions.
6 changes: 6 additions & 0 deletions .changeset/strong-peas-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@suid/vite-plugin": minor
"@suid/site": minor
---

Update to Vite v5.1.6
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
"solid-testing-library": "^0.5.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vite": "^4.4.9",
"vite-plugin-solid": "^2.7.0",
"vitest": "^0.33.0"
"vite": "^5.1.6",
"vite-plugin-solid": "^2.10.2",
"vitest": "^1.4.0"
},
"info": "SUID is all a set of utils and components ported from MUI Core and much more.",
"x-wspa": {
Expand Down
8 changes: 4 additions & 4 deletions packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"start": "vite preview"
},
"dependencies": {
"@solidjs/meta": "^0.28.6",
"@solidjs/router": "^0.8.3",
"@solidjs/meta": "^0.29.3",
"@solidjs/router": "^0.13.1",
"@stackblitz/sdk": "^1.9.0",
"@suid/base": "workspace:*",
"@suid/codemod": "workspace:*",
Expand All @@ -34,8 +34,8 @@
"fast-glob": "^3.3.2",
"rimraf": "^5.0.5",
"sass": "^1.72.0",
"vite": "^4.4.9",
"vite-plugin-solid": "^2.7.0"
"vite": "^5.1.6",
"vite-plugin-solid": "^2.10.2"
},
"publishConfig": {
"directory": "dist"
Expand Down
14 changes: 7 additions & 7 deletions packages/site/src/Routing.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route, Routes } from "@solidjs/router";
import { Route } from "@solidjs/router";
import { Box, Container, useMediaQuery } from "@suid/material";
import { useTheme } from "@suid/material/styles";
import { SxPropsObject } from "@suid/system/sxProps";
Expand Down Expand Up @@ -101,7 +101,7 @@ export function Routing() {
return (
<Route
path={path === "/home" ? "/" : path}
element={
component={() => (
<Switch fallback={<RoutingElementContainer Component={Component} />}>
<Match when={path === "/tools/playground"}>
<></>
Expand All @@ -113,22 +113,22 @@ export function Routing() {
<Component />
</Match>
</Switch>
}
)}
/>
);
});
return (
<Routes>
<>
{Children.concat(
<Route
path="/*"
element={
component={() => (
<RoutingElementContainer fullWidth>
<ErrorPage title="Page not found." code="404" />
</RoutingElementContainer>
}
)}
/>
)}
</Routes>
</>
);
}
26 changes: 10 additions & 16 deletions packages/site/src/components/PageNav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { useLocation, Link as RouterLink } from "@solidjs/router";
import { useLocation, A } from "@solidjs/router";
import NavigateBeforeIcon from "@suid/icons-material/NavigateBefore";
import NavigateNextIcon from "@suid/icons-material/NavigateNext";
import { useTheme } from "@suid/material";
Expand Down Expand Up @@ -28,22 +28,14 @@ function NavButton(props: {
if (props.preload && isTouchDevice()) tryPreload(props.href);
return (
<Button
component={RouterLink}
component={A}
size="large"
fullWidth={xs()}
onMouseEnter={tryPreload}
variant="outlined"
href={props.href}
{...(props.dir === "prev"
? {
startIcon: () => <NavigateBeforeIcon />,
}
: {})}
{...(props.dir === "next"
? {
endIcon: () => <NavigateNextIcon />,
}
: {})}
startIcon={props.dir === "prev" ? <NavigateBeforeIcon /> : undefined}
endIcon={props.dir === "next" ? <NavigateNextIcon /> : undefined}
sx={{
p: 2,
minWidth: 200,
Expand Down Expand Up @@ -82,6 +74,8 @@ export default function PageNav(inProps: {
return nextProp() === "auto" ? navConfigs()?.next : undefined;
},
});
const prev = () => props.prev as { href: string; text: string };
const next = () => props.next as { href: string; text: string };

return (
<Box sx={props.sx}>
Expand All @@ -93,8 +87,8 @@ export default function PageNav(inProps: {
<NavButton
dir="prev"
preload={props.preload ?? true}
href={props.prev!.href}
text={props.prev!.text}
href={prev().href}
text={prev().text}
/>
</Show>
</Grid>
Expand All @@ -103,8 +97,8 @@ export default function PageNav(inProps: {
<NavButton
dir="next"
preload={props.preload ?? true}
href={props.next!.href}
text={props.next!.text}
href={next().href}
text={next().text}
/>
</Show>
</Grid>
Expand Down
5 changes: 3 additions & 2 deletions packages/site/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// @refresh
import { Router } from "@solidjs/router";
import { render } from "solid-js/web";
import { Routing } from "./Routing";
import MainLayout from "./layouts/MainLayout";

render(
() => (
<Router>
<MainLayout />
<Router root={MainLayout}>
<Routing />
</Router>
),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand Down
10 changes: 5 additions & 5 deletions packages/site/src/layouts/MainLayout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLocation, Link as RouterLink } from "@solidjs/router";
import { useLocation, A } from "@solidjs/router";
import DarkModeOutlinedIcon from "@suid/icons-material/DarkModeOutlined";
import LightModeOutlinedIcon from "@suid/icons-material/LightModeOutlined";
import MenuIcon from "@suid/icons-material/Menu";
Expand Down Expand Up @@ -82,7 +82,7 @@ export default function Header() {
</IconButton>
</Box>
<Typography
component={RouterLink}
component={A}
variant="h6"
noWrap
sx={{ mr: 3, textDecoration: "none", color: "inherit" }}
Expand All @@ -100,23 +100,23 @@ export default function Header() {
>
<Show when={!hideButtons()}>
<Button
component={RouterLink}
component={A}
color="inherit"
href="/getting-started/installation"
onMouseEnter={tryPreload}
>
Docs
</Button>
<Button
component={RouterLink}
component={A}
color="inherit"
href="/tools/playground"
onMouseEnter={tryPreload}
>
Playground
</Button>
<Button
component={RouterLink}
component={A}
color="inherit"
href="/tools/react-to-solid"
onMouseEnter={tryPreload}
Expand Down
7 changes: 4 additions & 3 deletions packages/site/src/layouts/MainLayout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {
createMemo,
createSignal,
ErrorBoundary,
JSXElement,
Show,
} from "solid-js";
import { Routing, RoutingElementContainer } from "~/Routing";
import { RoutingElementContainer } from "~/Routing";
import Footer from "~/layouts/MainLayout/Footer";
import ErrorPage from "~/pages/ErrorPage";
import PlaygroundPage from "~/pages/tools/PlaygroundPage";
Expand All @@ -43,7 +44,7 @@ function ErrorFallback(error: Error) {
}
}

export default function MainLayout() {
export default function MainLayout(props: { children?: JSXElement }) {
const context = createLayoutMutable({
drawer: {
width: drawerWidth,
Expand Down Expand Up @@ -138,7 +139,7 @@ export default function MainLayout() {
</RoutingElementContainer>
</Show>
<ErrorBoundary fallback={ErrorFallback}>
<Routing />
{props.children}
</ErrorBoundary>
</Box>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/layouts/MainLayout/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLocation, Link as RouterLink } from "@solidjs/router";
import { useLocation, A } from "@solidjs/router";
import CodeIcon from "@suid/icons-material/Code";
import EditRoundedIcon from "@suid/icons-material/EditRounded";
import HandymanIcon from "@suid/icons-material/Handyman";
Expand Down Expand Up @@ -346,7 +346,7 @@ function NavLink(props: { text: string; href: string }) {

return (
<ListItemButton
component={RouterLink}
component={A}
selected={selected()}
sx={{ pl: "45px" }}
href={props.href}
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link as RouterLink } from "@solidjs/router";
import { A } from "@solidjs/router";
import CheckBoxIcon from "@suid/icons-material/CheckBox";
import { useTheme } from "@suid/material";
import {
Expand Down Expand Up @@ -274,7 +274,7 @@ export default function HomePage() {
}}
>
<Button
component={RouterLink}
component={A}
variant="contained"
size="large"
href="/getting-started/installation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "Bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
},
"devDependencies": {
"esbuild": "^0.20.2",
"vite": "^4.4.9"
"vite": "^5.1.6"
},
"peerDependencies": {
"vite": "^4.0.0"
"vite": "^5.0.0"
},
"publishConfig": {
"directory": "dist"
Expand Down
Loading

0 comments on commit 5955579

Please sign in to comment.