-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,983 additions
and
256 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
dist | ||
.solid | ||
.output | ||
.vercel | ||
.netlify | ||
netlify | ||
|
||
# Environment | ||
.env | ||
.env*.local | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
*.launch | ||
.settings/ | ||
|
||
# Temp | ||
gitignore | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db |
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 @@ | ||
# SolidStart | ||
|
||
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com); | ||
|
||
## Creating a project | ||
|
||
```bash | ||
# create a new project in the current directory | ||
npm init solid@latest | ||
|
||
# create a new project in my-app | ||
npm init solid@latest my-app | ||
``` | ||
|
||
## Developing | ||
|
||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: | ||
|
||
```bash | ||
npm run dev | ||
|
||
# or start the server and open the app in a new browser tab | ||
npm run dev -- --open | ||
``` | ||
|
||
## Building | ||
|
||
Solid apps are built with _adapters_, which optimise your project for deployment to different environments. | ||
|
||
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different adapter, add it to the `devDependencies` in `package.json` and specify in your `vite.config.js`. |
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,29 @@ | ||
{ | ||
"name": "@urami/demo-solid", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "solid-start dev --port ${PORT:-5175}", | ||
"build": "solid-start build", | ||
"start": "solid-start start" | ||
}, | ||
"dependencies": { | ||
"@solidjs/meta": "^0.28.6", | ||
"@solidjs/router": "^0.8.3", | ||
"@urami/core": "workspace:*", | ||
"@urami/solid": "workspace:*", | ||
"sharp": "^0.32.5", | ||
"solid-js": "^1.7.12", | ||
"solid-start": "^0.3.6" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.17.5", | ||
"esbuild": "^0.14.54", | ||
"postcss": "^8.4.28", | ||
"solid-start-node": "^0.3.6", | ||
"vite": "^4.4.9" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
Binary file not shown.
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,3 @@ | ||
import { mount, StartClient } from "solid-start/entry-client"; | ||
|
||
mount(() => <StartClient />, document); |
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,9 @@ | ||
import { | ||
createHandler, | ||
renderAsync, | ||
StartServer, | ||
} from "solid-start/entry-server"; | ||
|
||
export default createHandler( | ||
renderAsync((event) => <StartServer event={event} />) | ||
); |
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 @@ | ||
/// <reference types="solid-start/env" /> |
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,37 @@ | ||
// @refresh reload | ||
import { Suspense } from 'solid-js' | ||
import { | ||
A, | ||
Body, | ||
ErrorBoundary, | ||
FileRoutes, | ||
Head, | ||
Html, | ||
Meta, | ||
Routes, | ||
Scripts, | ||
Title, | ||
} from 'solid-start' | ||
|
||
export default function Root() { | ||
return ( | ||
<Html lang="en"> | ||
<Head> | ||
<Title>SolidStart - Bare</Title> | ||
<Meta charset="utf-8" /> | ||
<Meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
</Head> | ||
<Body> | ||
<Suspense> | ||
<ErrorBoundary> | ||
<Routes> | ||
<FileRoutes /> | ||
</Routes> | ||
</ErrorBoundary> | ||
</Suspense> | ||
<Scripts /> | ||
</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,19 @@ | ||
import { Title } from "solid-start"; | ||
import { HttpStatusCode } from "solid-start/server"; | ||
|
||
export default function NotFound() { | ||
return ( | ||
<main> | ||
<Title>Not Found</Title> | ||
<HttpStatusCode code={404} /> | ||
<h1>Page Not Found</h1> | ||
<p> | ||
Visit{" "} | ||
<a href="https://start.solidjs.com" target="_blank"> | ||
start.solidjs.com | ||
</a>{" "} | ||
to learn how to build SolidStart apps. | ||
</p> | ||
</main> | ||
); | ||
} |
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,9 @@ | ||
import { createRequestHandler } from '@urami/core' | ||
|
||
import type { APIEvent } from 'solid-start/api' | ||
|
||
const handler = createRequestHandler({ | ||
remoteDomains: ['demo.rayriffy.com'], | ||
}) | ||
|
||
export const GET = ({ request }: APIEvent) => handler(request) |
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,33 @@ | ||
import Image from '@urami/solid' | ||
|
||
export default function Home() { | ||
return ( | ||
<main class="max-w-xl mx-auto m-4 py-4"> | ||
<section class=""> | ||
<h1 class="text-gray-900 font-bold text-3xl">Urami</h1> | ||
<p class="text-gray-700"> | ||
Automatic image optimization for all! This is a demo for{' '} | ||
<b>Solid Start</b> | ||
</p> | ||
</section> | ||
|
||
<section class="py-8"> | ||
<a | ||
href="https://urami.dev" | ||
class="inline-flex items-center rounded-md border border-transparent bg-indigo-100 px-4 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" | ||
> | ||
Documentation | ||
</a> | ||
</section> | ||
|
||
<h2 class="text-2xl font-bold pb-4">Demo</h2> | ||
<Image | ||
src="https://demo.rayriffy.com/tom-scott.jpg" | ||
width={801} | ||
height={801} | ||
alt="Tom Scott" | ||
class="rounded-xl shadow-md" | ||
/> | ||
</main> | ||
) | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"jsxImportSource": "solid-js", | ||
"jsx": "preserve", | ||
"strict": true, | ||
"baseUrl": "./", | ||
"paths": { | ||
"~/*": ["./src/*"] | ||
} | ||
} | ||
} |
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 @@ | ||
import solid from "solid-start/vite"; | ||
import { defineConfig } from "vite"; | ||
|
||
export default defineConfig({ | ||
plugins: [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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</body> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</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
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,52 @@ | ||
{ | ||
"name": "@urami/solid", | ||
"version": "0.0.0", | ||
"description": "Utilities function for automatic image optimization", | ||
"author": { | ||
"name": "Phumrapee Limpiancop", | ||
"email": "[email protected]", | ||
"url": "https://rayriffy.com" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rayriffy/urami.git" | ||
}, | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup --format esm --dts --sourcemap", | ||
"dev": "pnpm run build --watch" | ||
}, | ||
"keywords": [], | ||
"peerDependencies": { | ||
"solid-js": "^1.7.12" | ||
}, | ||
"dependencies": { | ||
"@urami/utils": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@tsconfig/recommended": "^1.0.3", | ||
"@urami/types": "workspace:*", | ||
"solid-js": "^1.7.12", | ||
"tsup-preset-solid": "^2.1.0" | ||
}, | ||
"browser": {}, | ||
"exports": { | ||
"solid": "./dist/index.jsx", | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"typesVersions": {} | ||
} |
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,33 @@ | ||
import { defaultLoader, buildSource } from '@urami/utils' | ||
|
||
import type { Component, JSX } from 'solid-js' | ||
import type { Loader } from '@urami/types' | ||
|
||
export interface ImageProps extends JSX.ImgHTMLAttributes<HTMLImageElement> { | ||
src: string | ||
width: number | ||
quality?: number | ||
loader?: Loader | ||
} | ||
|
||
const Image: Component<ImageProps> = ({ | ||
src, | ||
width, | ||
quality = 75, | ||
loader = defaultLoader, | ||
...rest | ||
}) => { | ||
const builtProps = buildSource(loader, src, width, quality) | ||
|
||
return ( | ||
<img | ||
src={builtProps.src} | ||
srcset={builtProps.srcSet} | ||
decoding="async" | ||
loading="lazy" | ||
{...rest} | ||
/> | ||
) | ||
} | ||
|
||
export default Image |
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 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "@tsconfig/recommended/tsconfig.json", | ||
"compilerOptions": { | ||
"module": "es2022", | ||
"lib": ["es2023", "DOM"], | ||
"moduleResolution": "bundler", | ||
"verbatimModuleSyntax": true, | ||
"noEmit": true, | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js" | ||
} | ||
} |
Oops, something went wrong.