-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add solid support * quick solid example and docs * pnpm lock file * solid test + example (vue copy) * solid test fix - removed markdown - removed other example - removed invalid jsx * solid generate spec * fix: removed '$' from readme * revert: route types change * chore: remove test asset react type Co-authored-by: hanlee <me@hanlee.co>
- Loading branch information
1 parent
9bba42d
commit 15d7fc8
Showing
41 changed files
with
888 additions
and
13 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,5 @@ | ||
declare module '~solid-pages' { | ||
import type { RouteDefinition } from 'solid-app-router' | ||
const routes: RouteDefinition[] | ||
export default routes | ||
} |
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,2 @@ | ||
node_modules | ||
dist |
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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<title>Solid App</title> | ||
</head> | ||
|
||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
|
||
<script src="/src/index.tsx" type="module"></script> | ||
</body> | ||
|
||
</html> |
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,20 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "nodemon --watch ../../dist/*.js -x 'cross-env DEBUG=vite-plugin-pages:* vite'", | ||
"build": "cross-env DEBUG=vite-plugin-pages vite build", | ||
"serve": "vite preview" | ||
}, | ||
"dependencies": { | ||
"solid-app-router": "^0.2.1", | ||
"solid-js": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.3", | ||
"nodemon": "^2.0.15", | ||
"typescript": "^4.5.5", | ||
"vite": "^2.7.11", | ||
"vite-plugin-pages": "workspace:*", | ||
"vite-plugin-solid": "^2.2.4" | ||
} | ||
} |
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 function Index() { | ||
return <> | ||
<p>/admin/index.tsx</p> | ||
<p>located in features /admin/pages folder</p> | ||
</> | ||
} |
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 function Admin() { | ||
return <> | ||
<p>features/admin/pages/admin.tsx</p> | ||
<p>located in features/admin/pages folder</p> | ||
</> | ||
} |
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 function Dashboard() { | ||
return <> | ||
<p>features/dashboard/pages/dashboard.tsx</p> | ||
<p>located in features/dashboard/pages folder</p> | ||
</> | ||
} |
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 function Welcome() { | ||
return <> | ||
<p>features/dashboard/pages/welcome.tsx</p> | ||
<p>located in features/dashboard/pages folder</p> | ||
</> | ||
} |
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 @@ | ||
import { render } from 'solid-js/web' | ||
import { Router, useRoutes } from 'solid-app-router' | ||
import routes from '~solid-pages' | ||
|
||
const Routes = useRoutes(routes) | ||
|
||
render( | ||
() => ( | ||
<Router> | ||
<Routes /> | ||
</Router> | ||
), | ||
document.getElementById('root') as HTMLElement, | ||
) |
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,5 @@ | ||
export default function All() { | ||
return <> | ||
<div>...all route</div> | ||
</> | ||
} |
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 @@ | ||
import { Outlet } from 'solid-app-router' | ||
|
||
export default function SensorLayout() { | ||
return <> | ||
nested dynamic view: | ||
<Outlet /> | ||
</> | ||
} |
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 @@ | ||
import { useParams } from 'solid-app-router' | ||
|
||
export default function Current() { | ||
const { sensor } = useParams < {sensor: string}>() | ||
return <> | ||
<p>/{ sensor}/current.tsx</p> | ||
</> | ||
} |
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,5 @@ | ||
export default function Index() { | ||
return <> | ||
test default exclude | ||
</> | ||
} |
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,10 @@ | ||
import { Outlet } from 'solid-app-router' | ||
|
||
export default function AboutLayout() { | ||
return <> | ||
<div> | ||
nested about view: | ||
<Outlet /> | ||
</div> | ||
</> | ||
} |
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,16 @@ | ||
import { Link, Outlet, useParams } from 'solid-app-router' | ||
|
||
export default function IdLayout() { | ||
const { id } = useParams<{id: string}>() | ||
return <> | ||
<div> | ||
<div> | ||
about/[id].tsx: { id } | ||
</div> | ||
<Link href="/about/1b234bk12b3/more"> | ||
more deep | ||
</Link> | ||
<Outlet /> | ||
</div> | ||
</> | ||
} |
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,7 @@ | ||
export default function More() { | ||
return <> | ||
<div class="deep-more"> | ||
deep nested: about/[id]/more.tsx | ||
</div> | ||
</> | ||
} |
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,7 @@ | ||
export default function Nested() { | ||
return <> | ||
<div class="deep-nested"> | ||
deep nested: about/[id]/nested.tsx | ||
</div> | ||
</> | ||
} |
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,12 @@ | ||
import { Link } from 'solid-app-router' | ||
|
||
export default function Index() { | ||
return <> | ||
<div> | ||
about/index.tsx | ||
<Link href="/about/1b234bk12b3"> | ||
id: 1b234bk12b3 | ||
</Link> | ||
</div> | ||
</> | ||
} |
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 { useParams } from 'solid-app-router' | ||
|
||
export default function Id() { | ||
const { id } = useParams<{id: string}>() | ||
return <> | ||
<div> | ||
<p>blog/[id].tsx: { id }</p> | ||
<p> | ||
{/* {{ $route }} */} | ||
</p> | ||
</div> | ||
</> | ||
} |
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,18 @@ | ||
import { Link } from 'solid-app-router' | ||
|
||
export default function Index() { | ||
return <> | ||
<div> | ||
blog/index.tsx | ||
<Link href="/blog/1b234bk12b3"> | ||
id: 1b234bk12b3 | ||
</Link> | | ||
<Link href="/blog/today"> | ||
today | ||
</Link> | | ||
<Link href="/blog/today/xxx"> | ||
child - not found | ||
</Link> | ||
</div> | ||
</> | ||
} |
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,5 @@ | ||
export default function All() { | ||
return <> | ||
<div>blog/today ...all route</div> | ||
</> | ||
} |
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,7 @@ | ||
export default function Index() { | ||
return <> | ||
<div> | ||
blog/today/index.tsx | ||
</div> | ||
</> | ||
} |
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,5 @@ | ||
export default function Components() { | ||
return <> | ||
<h1>Test Components name</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,30 @@ | ||
import { Link } from 'solid-app-router' | ||
|
||
export default function Index() { | ||
return <> | ||
<div> | ||
<p>index.tsx</p> | ||
<Link href="/blog"> | ||
blog | ||
</Link> | | ||
<Link href="/about"> | ||
about | ||
</Link> | | ||
<Link href="/components"> | ||
components | ||
</Link> | | ||
<Link href="/xxx/xxx"> | ||
not exits | ||
</Link> | | ||
<Link href="/features/dashboard"> | ||
features:dashboard | ||
</Link> | | ||
<Link href="/features/admin"> | ||
features:admin | ||
</Link> | | ||
<Link href="/admin"> | ||
admin | ||
</Link> | ||
</div> | ||
</> | ||
} |
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,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js", | ||
"types": ["vite/client", "vite-plugin-pages/client-solid"] | ||
} | ||
} |
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,22 @@ | ||
import { resolve } from 'path' | ||
import { defineConfig } from 'vite' | ||
import solid from 'vite-plugin-solid' | ||
import pages from 'vite-plugin-pages' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
solid(), | ||
pages({ | ||
dirs: [ | ||
{ dir: resolve(__dirname, './src/pages'), baseRoute: '' }, | ||
{ dir: 'src/features/**/pages', baseRoute: 'features' }, | ||
{ dir: 'src/admin/pages', baseRoute: 'admin' }, | ||
], | ||
extensions: ['tsx', 'md'], | ||
}), | ||
], | ||
build: { | ||
target: 'esnext', | ||
polyfillDynamicImport: false, | ||
}, | ||
}) |
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
Oops, something went wrong.