Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
},
"editor.formatOnPaste": true,
"emmet.showExpandedAbbreviation": "never",
"typescript.native-preview.tsdk": "node_modules/@typescript/native-preview",
"typescript.native-preview.tsdk": "node_modules/@typescript/native",
"js/ts.experimental.useTsgo": true
}
16 changes: 4 additions & 12 deletions apps/docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export default defineConfig({
},
{
label: "Reference",
autogenerate: {
directory: "react/reference",
},
items: [{ autogenerate: { directory: "react/reference" } }],
},
],
},
Expand All @@ -52,9 +50,7 @@ export default defineConfig({
},
{
label: "Reference",
autogenerate: {
directory: "solid/reference",
},
items: [{ autogenerate: { directory: "solid/reference" } }],
},
],
},
Expand All @@ -74,9 +70,7 @@ export default defineConfig({
},
{
label: "Reference",
autogenerate: {
directory: "backend/reference",
},
items: [{ autogenerate: { directory: "backend/reference" } }],
},
],
},
Expand All @@ -96,9 +90,7 @@ export default defineConfig({
},
{
label: "Reference",
autogenerate: {
directory: "universal/reference",
},
items: [{ autogenerate: { directory: "universal/reference" } }],
},
],
},
Expand Down
4 changes: 3 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"starlight-sidebar-topics": "catalog:",
"starlight-sidebar-topics-dropdown": "catalog:"
},
"devDependencies": {},
"devDependencies": {
"typescript": "catalog:"
},
"peerDependencies": {},
"optionalDependencies": {}
}
8 changes: 2 additions & 6 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": [
"dist"
],
"compilerOptions": {
"ignoreDeprecations": "6.0"
}
"exclude": ["dist"],
"compilerOptions": {}
}
19 changes: 8 additions & 11 deletions apps/loom-example-app/src/todo-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export const initialTodoItems: ReadonlyArray<TodoItem> = [
export const cloneInitialTodos = (): Array<TodoItem> => initialTodoItems.map((todo) => ({ ...todo }))

export class TodoService extends Context.Service<TodoService>()("LoomExampleTodoService", {
make: Effect.gen(function*() {
make: Effect.gen(function* () {
const todosRef = yield* Ref.make(cloneInitialTodos())
const nextIdRef = yield* Ref.make(initialTodoItems.length + 1)

return {
list: () => Ref.get(todosRef),
dispatch: (command: TodoCommand) =>
Effect.gen(function*() {
Effect.gen(function* () {
switch (command.intent) {
case "create": {
const nextId = yield* Ref.get(nextIdRef)
Expand All @@ -65,23 +65,20 @@ export class TodoService extends Context.Service<TodoService>()("LoomExampleTodo
const current = yield* Ref.get(todosRef)

if (!current.some((todo) => todo.id === command.id)) {
return yield* Effect.fail(new TodoNotFoundError({ id: command.id }))
return yield* new TodoNotFoundError({ id: command.id })
}

yield* Ref.update(todosRef, (todos) =>
todos.map((todo) => todo.id === command.id ? { ...todo, completed: !todo.completed } : todo))
todos.map((todo) => (todo.id === command.id ? { ...todo, completed: !todo.completed } : todo)),
)

return { intent: command.intent } satisfies TodoCommandResult
}
case "remove": {
const current = yield* Ref.get(todosRef)

if (
!current.some((todo) =>
todo.id === command.id
)
) {
return yield* Effect.fail(new TodoNotFoundError({ id: command.id }))
if (!current.some((todo) => todo.id === command.id)) {
return yield* new TodoNotFoundError({ id: command.id })
}

yield* Ref.update(todosRef, (todos) => todos.filter((todo) => todo.id !== command.id))
Expand All @@ -96,7 +93,7 @@ export class TodoService extends Context.Service<TodoService>()("LoomExampleTodo
}
}),
reset: () =>
Effect.gen(function*() {
Effect.gen(function* () {
yield* Ref.set(todosRef, cloneInitialTodos())
yield* Ref.set(nextIdRef, initialTodoItems.length + 1)
}),
Expand Down
36 changes: 15 additions & 21 deletions apps/loom-example-app/tests/router-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const makeTestTodoService = (seed: ReadonlyArray<TodoItem>) => {

const todoService: TodoServiceApi = {
dispatch: (command) =>
Effect.gen(function*() {
Effect.gen(function* () {
calls.dispatch += 1

switch (command.intent) {
Expand All @@ -25,14 +25,14 @@ const makeTestTodoService = (seed: ReadonlyArray<TodoItem>) => {
return { intent: command.intent }
case "toggle":
if (!todos.some((todo) => todo.id === command.id)) {
return yield* Effect.fail(new TodoNotFoundError({ id: command.id }))
return yield* new TodoNotFoundError({ id: command.id })
}

todos = todos.map((todo) => todo.id === command.id ? { ...todo, completed: !todo.completed } : todo)
todos = todos.map((todo) => (todo.id === command.id ? { ...todo, completed: !todo.completed } : todo))
return { intent: command.intent }
case "remove":
if (!todos.some((todo) => todo.id === command.id)) {
return yield* Effect.fail(new TodoNotFoundError({ id: command.id }))
return yield* new TodoNotFoundError({ id: command.id })
}

todos = todos.filter((todo) => todo.id !== command.id)
Expand Down Expand Up @@ -79,9 +79,7 @@ describe("loom example app todo router runtime", () => {
})

it("executes the initial loader through the route runtime", async () => {
const { calls, todoService } = makeTestTodoService([
{ completed: false, id: 1, title: "Ship the loader demo" },
])
const { calls, todoService } = makeTestTodoService([{ completed: false, id: 1, title: "Ship the loader demo" }])
const runtime = createTodoRouteRuntime({ todoService })

const loaded = await runtime.load()
Expand All @@ -95,9 +93,7 @@ describe("loom example app todo router runtime", () => {
})

it("revalidates the loader after a successful action", async () => {
const { calls, todoService } = makeTestTodoService([
{ completed: false, id: 1, title: "Ship the loader demo" },
])
const { calls, todoService } = makeTestTodoService([{ completed: false, id: 1, title: "Ship the loader demo" }])
const runtime = createTodoRouteRuntime({ todoService })

await runtime.load()
Expand All @@ -123,9 +119,7 @@ describe("loom example app todo router runtime", () => {
})

it("returns invalid-input results without dispatching the action", async () => {
const { calls, todoService } = makeTestTodoService([
{ completed: false, id: 1, title: "Ship the loader demo" },
])
const { calls, todoService } = makeTestTodoService([{ completed: false, id: 1, title: "Ship the loader demo" }])
const runtime = createTodoRouteRuntime({ todoService })

await runtime.load()
Expand All @@ -136,11 +130,13 @@ describe("loom example app todo router runtime", () => {
expect(result).toEqual({
action: {
_tag: "invalid-input",
issues: [{
_tag: "LoomRouterActionInputFailure",
input: { intent: "create", title: " " },
message: expect.stringContaining("length of at least 1"),
}],
issues: [
{
_tag: "LoomRouterActionInputFailure",
input: { intent: "create", title: " " },
message: expect.stringContaining("length of at least 1"),
},
],
route: result.action.route,
submission: { intent: "create", title: " " },
},
Expand All @@ -149,9 +145,7 @@ describe("loom example app todo router runtime", () => {
})

it("surfaces typed route action failures without revalidating the loader", async () => {
const { calls, todoService } = makeTestTodoService([
{ completed: false, id: 1, title: "Ship the loader demo" },
])
const { calls, todoService } = makeTestTodoService([{ completed: false, id: 1, title: "Ship the loader demo" }])
const runtime = createTodoRouteRuntime({ todoService })

await runtime.load()
Expand Down
8 changes: 2 additions & 6 deletions apps/loom-example-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.spec.json" }
],
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.spec.json" }],
"compilerOptions": {
"strict": true,
"ignoreDeprecations": "6.0"
"strict": true
}
}
3 changes: 1 addition & 2 deletions apps/node-auth-example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": [],
"references": [{ "path": "./tsconfig.app.json" }],
"compilerOptions": {
"strict": true,
"ignoreDeprecations": "6.0"
"strict": true
}
}
9 changes: 4 additions & 5 deletions apps/react-remix-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
"@effectify/react-remix": "workspace:*",
"@effectify/react-router-better-auth": "workspace:*",
"@effectify/node-better-auth": "workspace:*",
"@remix-run/node": "2.17.1",
"@remix-run/react": "2.17.1",
"@remix-run/serve": "2.17.1",
"@remix-run/node": "2.17.5",
"@remix-run/react": "2.17.5",
"@remix-run/serve": "2.17.5",
"isbot": "^4.4.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"@prisma/client": "catalog:",
"@prisma/client-runtime-utils": "catalog:",

"better-auth": "catalog:",
"better-sqlite3": "catalog:",
"dotenv": "catalog:",
Expand All @@ -39,7 +38,7 @@
"@react-router/dev": "catalog:",
"@types/better-sqlite3": "7.6.13",
"prisma": "catalog:",
"@remix-run/dev": "2.17.1",
"@remix-run/dev": "2.17.5",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"eslint": "^8.23.1",
Expand Down
3 changes: 1 addition & 2 deletions apps/react-remix-example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

// Vite takes care of building everything, not tsc.
"noEmit": true,
"noUncheckedSideEffectImports": false,
"ignoreDeprecations": "6.0"
"noUncheckedSideEffectImports": false
}
}
1 change: 0 additions & 1 deletion apps/react-router-example-e2e/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"module": "commonjs",
"types": ["cypress", "node"],
"sourceMap": false,
"ignoreDeprecations": "6.0",
"rootDir": ".."
},
"include": [
Expand Down
19 changes: 4 additions & 15 deletions apps/react-router-example-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [
"node",
"cypress"
],
"types": ["node", "cypress"],
"module": "nodenext",
"moduleResolution": "node10",
"target": "es2022",
"lib": [
"dom",
"es2022"
],
"lib": ["dom", "es2022"],
"allowJs": false,
"noEmit": true,
"ignoreDeprecations": "6.0"
"noEmit": true
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"cypress.config.ts"
]
"include": ["src/**/*.ts", "src/**/*.tsx", "cypress.config.ts"]
}
6 changes: 3 additions & 3 deletions apps/react-router-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@prisma/adapter-better-sqlite3": "catalog:",
"@prisma/client": "catalog:",
"@prisma/client-runtime-utils": "catalog:",
"@react-router/node": "8.2.0",
"@react-router/serve": "8.2.0",
"@react-router/node": "8.3.0",
"@react-router/serve": "8.3.0",
"@tanstack/react-query": "catalog:",
"better-auth": "catalog:",
"better-sqlite3": "catalog:",
Expand All @@ -36,7 +36,7 @@
},
"devDependencies": {
"@prisma/generator": "catalog:",
"@react-router/dev": "8.2.0",
"@react-router/dev": "8.3.0",
"@types/better-sqlite3": "7.6.13",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
Expand Down
Loading
Loading