Remove Zod from core dependencies (#27107)
This commit is contained in:
@@ -214,7 +214,6 @@
|
|||||||
"npm-package-arg": "13.0.2",
|
"npm-package-arg": "13.0.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"xdg-basedir": "5.1.0",
|
"xdg-basedir": "5.1.0",
|
||||||
"zod": "catalog:",
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/bun": "catalog:",
|
"@tsconfig/bun": "catalog:",
|
||||||
|
|||||||
@@ -41,8 +41,7 @@
|
|||||||
"minimatch": "10.2.5",
|
"minimatch": "10.2.5",
|
||||||
"npm-package-arg": "13.0.2",
|
"npm-package-arg": "13.0.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"xdg-basedir": "5.1.0",
|
"xdg-basedir": "5.1.0"
|
||||||
"zod": "catalog:"
|
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"drizzle-orm": "catalog:"
|
"drizzle-orm": "catalog:"
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import type { z } from "zod"
|
|
||||||
|
|
||||||
export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
|
|
||||||
const result = (input: z.infer<T>) => {
|
|
||||||
const parsed = schema.parse(input)
|
|
||||||
return cb(parsed)
|
|
||||||
}
|
|
||||||
result.force = (input: z.infer<T>) => cb(input)
|
|
||||||
result.schema = schema
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import { Message, Model, Part, Session, SnapshotFileDiff } from "@opencode-ai/sdk/v2"
|
import { Message, Model, Part, Session, SnapshotFileDiff } from "@opencode-ai/sdk/v2"
|
||||||
import { fn } from "@opencode-ai/core/util/fn"
|
|
||||||
import { iife } from "@opencode-ai/core/util/iife"
|
import { iife } from "@opencode-ai/core/util/iife"
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
import { Storage } from "./storage"
|
import { Storage } from "./storage"
|
||||||
|
|
||||||
|
function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
|
||||||
|
return (input: z.infer<T>) => cb(schema.parse(input))
|
||||||
|
}
|
||||||
|
|
||||||
export namespace Share {
|
export namespace Share {
|
||||||
export const Info = z.object({
|
export const Info = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
|||||||
Reference in New Issue
Block a user