Skip to content

Commit

Permalink
chore: update playground and add an endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Nov 9, 2024
1 parent 598129a commit d1de698
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 68 deletions.
2 changes: 1 addition & 1 deletion packages/enhanced-img/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/estree": "^1.0.5",
"@types/node": "^18.19.48",
"rollup": "^4.14.2",
"svelte": "^5.0.0",
"svelte": "^5.1.3",
"typescript": "^5.6.3",
"vite": "^5.3.2",
"vitest": "^2.0.1"
Expand Down
10 changes: 4 additions & 6 deletions packages/kit/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.DS_Store
/node_modules
/assets/*
/dist
/docs
/node_modules/
/test/**/build
!/src/core/adapt/fixtures/*/.svelte-kit
!/test/node_modules
Expand All @@ -11,5 +8,6 @@
.custom-out-dir

# these are already ignored by the top level .gitignore
# repeating them here as a faux prettier ignore
.svelte-kit
# repeating them here as a faux .prettierignore
/.svelte-kit/
/dist/
4 changes: 4 additions & 0 deletions playgrounds/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# these are already ignored by the top level .gitignore
# repeating them here as a faux .prettierignore
/.svelte-kit/
/dist/
17 changes: 9 additions & 8 deletions playgrounds/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"format": "prettier --config ../../.prettierrc --write .",
"lint": "prettier --config ../../.prettierrc --check ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "workspace:*",
Expand All @@ -22,12 +24,14 @@
"@sveltejs/amp": "workspace:*",
"@sveltejs/kit": "workspace:*",
"@sveltejs/package": "workspace:*",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.6",
"publint": "^0.2.0",
"svelte": "^4.2.10",
"svelte": "^5.1.13",
"svelte-check": "^4.0.1",
"typescript": "^5.3.3",
"vite": "^5.3.2"
"typescript": "^5.5.0",
"vite": "^5.4.4"
},
"type": "module",
"exports": {
Expand All @@ -41,9 +45,6 @@
"!dist/**/*.test.*",
"!dist/**/*.spec.*"
],
"peerDependencies": {
"svelte": "^4.0.0"
},
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts"
}
2 changes: 1 addition & 1 deletion playgrounds/basic/src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
9 changes: 8 additions & 1 deletion playgrounds/basic/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
<script lang="ts">
import type { PageData } from './$types';
let { data }: { data: PageData } = $props();
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

2 + 2 = {data.sum}
6 changes: 6 additions & 0 deletions playgrounds/basic/src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { PageLoad } from './$types';

export const load: PageLoad = async ({ fetch }) => {
const response = await fetch('/', { method: 'POST', body: JSON.stringify({ a: 2, b: 2 }) });
return { sum: await response.json() };
};
7 changes: 7 additions & 0 deletions playgrounds/basic/src/routes/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';

export const POST: RequestHandler = async ({ request }) => {
const { a, b } = await request.json();
return json(a + b);
};
1 change: 1 addition & 0 deletions playgrounds/basic/src/routes/about/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="/">home</a>
File renamed without changes.
Loading

0 comments on commit d1de698

Please sign in to comment.