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
4 changes: 2 additions & 2 deletions apps/browser-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@evaluate/helpers": "workspace:^",
"@evaluate/shapes": "workspace:^",
"@evaluate/styles": "workspace:^",
"@t3-oss/env-core": "^0.11.1",
"@t3-oss/env-core": "^0.12.0",
"lucide-react": "^0.488.0",
"posthog-js": "^1.236.1",
"react": "^19.1.0",
Expand All @@ -25,7 +25,7 @@
"tailwind-merge": "^3.2.0",
"webext-bridge": "^6.0.1",
"webextension-polyfill": "^0.12.0",
"zod": "3.22.4"
"zod": "4.0.0-beta.20250414T061543"
},
"devDependencies": {
"@babel/generator": "^7.27.0",
Expand Down
5 changes: 1 addition & 4 deletions apps/browser-extension/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { z } from 'zod';
export default createEnv({
clientPrefix: 'VITE_PUBLIC_',
client: {
VITE_PUBLIC_WEBSITE_URL: z
.string()
.url()
.transform((v) => new URL(v)),
VITE_PUBLIC_WEBSITE_URL: z.url().transform((v) => new URL(v)),
VITE_PUBLIC_POSTHOG_KEY: z.string().min(1).optional(),
},

Expand Down
4 changes: 2 additions & 2 deletions apps/discord-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"@evaluate/engine": "workspace:^",
"@evaluate/helpers": "workspace:^",
"@evaluate/shapes": "workspace:^",
"@t3-oss/env-core": "^0.11.1",
"@t3-oss/env-core": "^0.12.0",
"date-fns": "^4.1.0",
"es-toolkit": "^1.34.1",
"posthog-node": "^4.11.6",
"zod": "3.22.4"
"zod": "4.0.0-beta.20250414T061543"
},
"devDependencies": {
"tsup": "^8.4.0"
Expand Down
5 changes: 1 addition & 4 deletions apps/discord-bot/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { z } from 'zod';

export default createEnv({
server: {
WEBSITE_URL: z
.string()
.url()
.transform((v) => new URL(v)),
WEBSITE_URL: z.url().transform((v) => new URL(v)),
POSTHOG_KEY: z.string().optional(),
DISCORD_TOKEN: z.string().min(1).optional(),
DISCORD_PUBLIC_KEY: z.string().min(1).optional(),
Expand Down
4 changes: 2 additions & 2 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@evaluate/shapes": "workspace:^",
"@evaluate/styles": "workspace:^",
"@hookform/resolvers": "^5.0.1",
"@t3-oss/env-nextjs": "^0.11.1",
"@t3-oss/env-nextjs": "^0.12.0",
"@tanstack/react-query": "^5.74.3",
"@tanstack/react-query-devtools": "^5.74.3",
"@uiw/codemirror-extensions-langs": "^4.23.10",
Expand Down Expand Up @@ -50,7 +50,7 @@
"type-fest": "^4.40.0",
"virtual-file-explorer-backend": "^0.0.4",
"vscode-icons-js": "^11.6.1",
"zod": "3.22.4"
"zod": "4.0.0-beta.20250414T061543"
},
"devDependencies": {
"@million/lint": "^1.0.14",
Expand Down
7 changes: 2 additions & 5 deletions apps/website/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { createEnv } from '@t3-oss/env-nextjs';
import { vercel } from '@t3-oss/env-nextjs/presets';
import { vercel } from '@t3-oss/env-nextjs/presets-zod';
import discordEnv from 'discord-bot/env';
import { z } from 'zod';

export default createEnv({
extends: [discordEnv, vercel()],

server: {
WEBSITE_URL: z
.string()
.url()
.transform((v) => new URL(v)),
WEBSITE_URL: z.url().transform((v) => new URL(v)),
},
client: {
NEXT_PUBLIC_POSTHOG_KEY: z.string().min(1).optional(),
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,5 @@
"turbo": "^2.5.0",
"typescript": "^5.8.3",
"typescript-transform-paths": "^3.5.5"
},
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
},
"allowNonAppliedPatches": true
}
}
3 changes: 1 addition & 2 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"@evaluate/shapes": "workspace:^",
"fuse.js": "^7.1.0",
"lexure": "npm:@apteryxxyz/lexure@^0.17.0",
"pako": "^2.1.0",
"zod": "3.22.4"
"pako": "^2.1.0"
},
"devDependencies": {
"@types/pako": "^2.0.3"
Expand Down
3 changes: 1 addition & 2 deletions packages/engine/src/runtimes/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
type Runtime,
} from '@evaluate/shapes';
import Fuse from 'fuse.js';
import { z } from 'zod';
import {
getRuntimeAliases,
getRuntimeExamples,
Expand All @@ -30,7 +29,7 @@ export async function fetchRuntimes() {
'https://emkc.org/api/v2/piston/runtimes',
)
.then((response) => response.json())
.then(z.array(PistonRuntime).parse);
.then(PistonRuntime.array().parse);

for (const piston of pistonRuntimes) {
const identifier = makeIdentifier(piston.language, piston.runtime);
Expand Down
2 changes: 1 addition & 1 deletion packages/shapes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"build": "tsc"
},
"dependencies": {
"zod": "3.22.4"
"zod": "4.0.0-beta.20250414T061543"
}
}
51 changes: 32 additions & 19 deletions packages/shapes/src/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,51 @@ export type ExecuteOptions = z.infer<typeof ExecuteOptions>;
export const ExecuteOptions = z
.object({
runtime: z
.string({ required_error: 'A runtime is required' })
.regex(/^(?:[\w]+\+)?[\w]+(?:@[\d.]+)?$/, 'Invalid runtime format'),
.string({ error: 'A runtime is required' })
.regex(/^(?:[\w]+\+)?[\w]+(?:@[\d.]+)?$/, {
error: 'Invalid runtime format',
}),
files: z
.record(
z
.string({ required_error: 'File path is required' })
.max(200, 'File path length is too long'),
.string({ error: 'File path is required' })
.max(200, { error: 'File path length is too long' }),
z
.string({ required_error: 'File content is required' })
.max(10_000, 'File content is too large'),
.string({ error: 'File content is required' })
.max(10_000, { error: 'File content is too large' }),
{
required_error: 'At least one file is required',
invalid_type_error: 'Files must be an object',
error: (issue) =>
issue.input === undefined
? 'At least one file is required'
: 'Files must be an object',
},
)
.refine((f) => Object.keys(f).length >= 0, 'Too few files')
.refine((f) => Object.keys(f).length <= 10, 'Too many files')
.refine((f) => Object.keys(f).length >= 0, { error: 'Too few files' })
.refine((f) => Object.keys(f).length <= 10, { error: 'Too many files' })
.refine(
(f) =>
Object.values(f).reduce((acc, val: string) => acc + val.length, 0) <=
10_000,
'Combined file content size is too large',
{ error: 'Combined file content size is too large' },
),
entry: z.string({ required_error: 'An entry file is required' }),
input: z.string().max(2_000, 'Input length is too long').optional(),
args: z.string().max(2_000, 'Arguments length is too long').optional(),
entry: z.string({ error: 'An entry file is required' }),
input: z
.string()
.max(2_000, { error: 'Input length is too long' })
.optional(),
args: z
.string()
.max(2_000, { error: 'Arguments length is too long' })
.optional(),
})
.refine((data) => {
// Omit is used elsewhere to remove files, so we need to check if it exists
if (!data.files) return true;
return data.entry in data.files;
}, 'Entry file does not exist');
.refine(
(data) => {
// Omit is used elsewhere to remove files, so we need to check if it exists
if (!data.files) return true;
return data.entry in data.files;
},
{ error: 'Entry file does not exist' },
);

export type ExecuteResult = z.infer<typeof ExecuteResult>;
export const ExecuteResult = z.object({
Expand Down
21 changes: 0 additions & 21 deletions packages/shapes/src/generate.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/shapes/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './generate.js';
export * from './execute.js';
export * from './runtime.js';
21 changes: 10 additions & 11 deletions packages/shapes/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ import { ExecuteOptions } from './execute.js';
export type PartialRuntime = z.infer<typeof PartialRuntime>;
export const PartialRuntime = z.object({
id: z.string(),
versions: z.array(z.string()),
versions: z.string().array(),
name: z.string(),
aliases: z.array(z.string()),
aliases: z.string().array(),
popularity: z.number().min(0).max(100),
tags: z.array(z.string()),
tags: z.string().array(),
icon: z.string().optional(),
});

export type Runtime = z.infer<typeof Runtime>;
export const Runtime = PartialRuntime.merge(
z.object({
examples: ExecuteOptions.merge(z.object({ name: z.string() }))
.omit({ runtime: true })
.array(),
}),
);
export const Runtime = PartialRuntime.extend({
examples: ExecuteOptions.omit({ runtime: true })
.extend({ name: z.string() })

.array(),
});

export type PistonRuntime = z.infer<typeof PistonRuntime>;
export const PistonRuntime = z.object({
language: z.string(),
version: z.string(),
aliases: z.array(z.string()),
aliases: z.string().array(),
runtime: z.string().optional(),
});
Loading