Skip to content

Commit

Permalink
feat(router-valibot-adapter): upgrade valibot to v1 (#2470)
Browse files Browse the repository at this point in the history
* feat: upgrade valibot adapter to v1

* chore: bump valibot in the example

---------

Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
  • Loading branch information
fabian-hiller and SeanCassiere authored Oct 4, 2024
1 parent 8a848a4 commit c850088
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 43 deletions.
12 changes: 6 additions & 6 deletions examples/react/search-validator-adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"start": "vite"
},
"dependencies": {
"@tanstack/react-query": "^5.59.0",
"@tanstack/react-router": "^1.59.0",
"@tanstack/router-arktype-adapter": "^1.59.0",
"@tanstack/router-devtools": "^1.59.0",
"@tanstack/router-plugin": "^1.59.0",
"@tanstack/router-zod-adapter": "^1.59.0",
"@tanstack/router-valibot-adapter": "^1.59.0",
"@tanstack/router-arktype-adapter": "^1.59.0",
"@tanstack/react-query": "^5.59.0",
"@tanstack/router-zod-adapter": "^1.59.0",
"arktype": "^2.0.0-rc.14",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zod": "^3.23.8",
"valibot": "^0.42.1",
"arktype": "^2.0.0-rc.14"
"valibot": "1.0.0-beta.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/react": "^18.2.47",
Expand Down
8 changes: 4 additions & 4 deletions packages/router-valibot-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
"node": ">=12"
},
"devDependencies": {
"@tanstack/react-router": "workspace:*",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@tanstack/react-router": "workspace:*",
"valibot": "^0.42.1"
"valibot": "1.0.0-beta.0"
},
"peerDependencies": {
"valibot": ">=0.36.0",
"@tanstack/react-router": ">=1.43.2"
"@tanstack/react-router": ">=1.43.2",
"valibot": "^1.0.0"
}
}
11 changes: 4 additions & 7 deletions packages/router-valibot-adapter/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { parse } from 'valibot'
import type { SearchValidatorAdapter } from '@tanstack/react-router'
import type { GenericSchema } from 'valibot'
import type { GenericSchema, InferInput, InferOutput } from 'valibot'

export type ValibotSearchValidatorAdapter<TOptions extends GenericSchema> =
SearchValidatorAdapter<
NonNullable<TOptions['_types']>['input'],
NonNullable<TOptions['_types']>['output']
>
SearchValidatorAdapter<InferInput<TOptions>, InferOutput<TOptions>>

export const valibotSearchValidator = <TOptions extends GenericSchema>(
options: TOptions,
): ValibotSearchValidatorAdapter<TOptions> => {
return {
types: {
input: options._types?.input,
output: options._types?.output,
input: null,
output: null,
},
parse: (input) => parse(options, input),
}
Expand Down
52 changes: 26 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c850088

Please sign in to comment.