Skip to content

Commit

Permalink
Merge branch 'main' into vinxi-0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
nksaraf authored Jan 28, 2024
2 parents 97e4f77 + 54501ea commit 9d4e9b8
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 78 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-hounds-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

fix #1278 wrong types for onBeforeResponse middleware
5 changes: 0 additions & 5 deletions .changeset/neat-apricots-try.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/popular-mirrors-train.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/young-icons-peel.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/bare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@solidjs/meta": "^0.29.2",
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/experiments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@solidjs/meta": "^0.29.2",
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"engines": {
Expand Down
1 change: 0 additions & 1 deletion examples/todomvc/.data/todos/counter

This file was deleted.

1 change: 0 additions & 1 deletion examples/todomvc/.data/todos/data

This file was deleted.

2 changes: 1 addition & 1 deletion examples/todomvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"unstorage": "1.10.1",
"vinxi": "^0.1.9"
},
Expand Down
74 changes: 48 additions & 26 deletions examples/todomvc/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,71 @@ const storage = createStorage({
base: "./.data"
})
});
// storage.setItem("todos:data", []);
// storage.setItem("todos:counter", 0);

export async function getTodosFn() {
return await storage.getItem("todos:data") as Todo[];
return ((await storage.getItem("todos:data")) as Todo[]) || [];
}
export async function addTodoFn(formData: FormData) {
const title = formData.get("title") as string;
const [{value: todos}, {value: index}] = await storage.getItems(["todos:data", "todos:counter"]);
let [{ value: todos }, { value: index }] = await storage.getItems([
"todos:data",
"todos:counter"
]);
// default value for first write
todos = todos || [];
index = index || 0;

await Promise.all([
storage.setItem("todos:data", [...todos as Todo[], { id: index as number, title, completed: false }]),
storage.setItem("todos:counter", index as number + 1)
storage.setItem("todos:data", [
...(todos as Todo[]),
{ id: index as number, title, completed: false }
]),
storage.setItem("todos:counter", (index as number) + 1)
]);
}
export async function removeTodoFn(id: number) {
const todos = await storage.getItem("todos:data") as Todo[];
await storage.setItem("todos:data", todos.filter(todo => todo.id !== id));
const todos = (await storage.getItem("todos:data")) as Todo[];
await storage.setItem(
"todos:data",
todos.filter(todo => todo.id !== id)
);
}
export async function toggleTodoFn(id: number) {
const todos = await storage.getItem("todos:data") as Todo[];
await storage.setItem("todos:data", todos.map(todo => {
if (todo.id === id) {
todo.completed = !todo.completed;
}
return todo;
}));
const todos = (await storage.getItem("todos:data")) as Todo[];
await storage.setItem(
"todos:data",
todos.map(todo => {
if (todo.id === id) {
todo.completed = !todo.completed;
}
return todo;
})
);
}
export async function editTodoFn(id: number, formData: FormData) {
const title = String(formData.get("title"));
const todos = await storage.getItem("todos:data") as Todo[];
await storage.setItem("todos:data", todos.map(todo => {
if (todo.id === id) {
todo.title = title;
}
return todo;
}));
const todos = (await storage.getItem("todos:data")) as Todo[];
await storage.setItem(
"todos:data",
todos.map(todo => {
if (todo.id === id) {
todo.title = title;
}
return todo;
})
);
}
export async function clearCompletedFn() {
const todos = await storage.getItem("todos:data") as Todo[];
await storage.setItem("todos:data", todos.filter(todo => !todo.completed));
const todos = (await storage.getItem("todos:data")) as Todo[];
await storage.setItem(
"todos:data",
todos.filter(todo => !todo.completed)
);
}
export async function toggleAllFn(completed: boolean) {
const todos = await storage.getItem("todos:data") as Todo[];
await storage.setItem("todos:data", todos.map(todo => ({ ...todo, completed })));
const todos = (await storage.getItem("todos:data")) as Todo[];
await storage.setItem(
"todos:data",
todos.map(todo => ({ ...todo, completed }))
);
}
2 changes: 1 addition & 1 deletion examples/with-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"unstorage": "1.10.1",
"vinxi": "^0.1.9"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"@vinxi/plugin-mdx": "^3.6.7",
"solid-js": "^1.8.11",
"vinxi": "^0.1.9",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
"solid-mdx": "^0.0.7"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"prisma": "^5.7.0",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-solid-styled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@solidjs/meta": "^0.29.2",
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"solid-styled": "^0.8.2",
"vinxi": "^0.1.9",
"vite-plugin-solid-styled": "^0.8.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@solidjs/start": "^0.4.10",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.26",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"tailwindcss": "^3.3.3",
"vinxi": "^0.1.9"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@solidjs/meta": "^0.29.2",
"@solidjs/router": "^0.10.10",
"@solidjs/start": "^0.4.10",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"valibot": "^0.23.0",
"vinxi": "^0.1.9"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@testing-library/user-event": "^14.5.1",
"@vitest/ui": "^1.1.0",
"jsdom": "^24.0.0",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"typescript": "^5.3.3",
"vinxi": "^0.1.9",
"vite": "^4.4.9",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"rimraf": "^3.0.2",
"rollup": "^3.28.1",
"semver": "^7.5.4",
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"solid-mdx": "^0.0.7",
"solid-start-mdx": "workspace:*",
"tailwindcss": "^3.3.3",
Expand Down
10 changes: 10 additions & 0 deletions packages/start/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @solidjs/start

## 0.4.11

### Patch Changes

- 187acc55: update vinxi, fix #1247, fix #1261
- 92e8f8f8: fix formData and action issue for cloud runtimes
- 27d60cd2: better GET signature
- 24a4eb2e: GET server functions, response returns, cache to use GET
4 changes: 2 additions & 2 deletions packages/start/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solidjs/start",
"version": "0.4.10",
"version": "0.4.11",
"type": "module",
"author": "Ryan Carniato",
"publishConfig": {
Expand Down Expand Up @@ -46,7 +46,7 @@
}
},
"devDependencies": {
"solid-js": "^1.8.11",
"solid-js": "^1.8.12",
"vinxi": "^0.1.9"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/start/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type RequestMiddleware = (event: FetchEvent) => Response | Promise<Response> | v

type ResponseMiddleware = (
event: FetchEvent,
response: Response
response: { body: any }
) => Response | Promise<Response> | void | Promise<void>;

function wrapRequestMiddleware(onRequest: RequestMiddleware) {
Expand Down
Loading

0 comments on commit 9d4e9b8

Please sign in to comment.