{"id":49467,"library":"sury","title":"Sury (ReScript Schema)","description":"Sury is a composable schema validation and parsing library for JavaScript, TypeScript, and ReScript, currently at v11.0.0-alpha.7. It employs a JIT compilation approach using `new Function` to achieve the fastest validation performance in the ecosystem, as per benchmarks. The library offers over 100 operations, supports Standard Schema and JSON Schema, and has a modular, tree-shakable API similar to Valibot. It is released as an alpha with ongoing development.","status":"active","version":"11.0.0-alpha.7","language":"javascript","source_language":"en","source_url":"https://github.com/DZakh/sury","tags":["javascript","ReScript","Schema","Parser","Serializer","JSON","Encode","Decode","Validation","typescript"],"install":[{"cmd":"npm install sury","lang":"bash","label":"npm"},{"cmd":"yarn add sury","lang":"bash","label":"yarn"},{"cmd":"pnpm add sury","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for ReScript type definitions and compiler integration","package":"rescript","optional":true}],"imports":[{"note":"S is a named export, not a default export. It is a namespace object containing all schema constructors.","wrong":"import S from 'sury'","symbol":"S","correct":"import { S } from 'sury'"},{"note":"ESM-only package. CommonJS require is not supported.","wrong":"const { string } = require('sury')","symbol":"string","correct":"import { string } from 'sury'"},{"note":"parse is exported directly from the root package, not from a subpath.","wrong":"import { parse } from 'sury/parse'","symbol":"parse","correct":"import { parse } from 'sury'"}],"quickstart":{"code":"import { S, parse, string, number, object } from 'sury';\n\nconst UserSchema = object({\n  name: string(),\n  age: number()\n});\n\nconst user = parse(UserSchema, { name: 'Alice', age: 30 });\nconsole.log(user); // { name: 'Alice', age: 30 }","lang":"typescript","description":"Shows basic usage of Sury's object schema and parse function with TypeScript types."},"warnings":[{"fix":"Ensure your runtime allows `new Function` or use a fallback schema library that does not rely on it.","message":"Use of `new Function` for JIT compilation may be blocked in some environments (e.g., strict CSP, old Node versions).","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Wait for stable release or pin to older versions if needed.","message":"Alpha version with API changes expected before stable release. Do not use in production.","severity":"deprecated","affected_versions":"11.x"},{"fix":"Enable 'nodejs_compat' flag in Cloudflare Workers or avoid using Sury in restricted runtimes.","message":"Sury uses `new Function` internally, which is prohibited in some serverless environments (e.g., Cloudflare Workers without the 'nodejs_compat' flag).","severity":"gotcha","affected_versions":">=10.0.0"},{"fix":"Import only the specific functions you need (e.g., `import { S, parse, string } from 'sury'`).","message":"Named exports must be imported individually; importing the entire namespace via `import * as S from 'sury'` may lead to tree-shaking issues.","severity":"gotcha","affected_versions":">=10.0.0"},{"fix":"Review changelog before upgrading from v10 stable.","message":"Version 11.0.0-alpha.x may contain breaking changes from v10; upgrade carefully.","severity":"breaking","affected_versions":"11.0.0-alpha.x"}],"env_vars":null,"search_vec":"'100':46 'achiev':31 'alpha':70 'api':61 'approach':26 'benchmark':41 'compil':25 'compos':7 'current':18 'decod':81 'develop':73 'ecosystem':38 'employ':22 'encod':80 'fastest':33 'function':29 'javascript':14,74 'jit':24 'json':52,79 'librari':12,43 'modular':57 'new':28 'offer':44 'ongo':72 'oper':47 'pars':11 'parser':77 'per':40 'perform':35 'releas':67 'rescript':2,17,75 'schema':3,8,50,53,76 'serial':78 'shakabl':60 'similar':62 'standard':49 'support':48 'suri':1,4 'tree':59 'tree-shak':58 'typescript':15,83 'use':27 'v11.0.0-alpha.7':20 'valibot':64 'valid':9,34,82","created_at":"2026-06-07T17:01:55.997242+00:00","updated_at":"2026-06-07T17:01:55.997242+00:00","problems":[{"fix":"Switch to ES modules (import) or use dynamic import if CommonJS is required.","cause":"Using CommonJS require() with an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use `import { S } from 'sury'` instead of `import S from 'sury'`.","cause":"Attempting to use S as a default import instead of named import.","error":"TypeError: S.parse is not a function"},{"fix":"Import parse directly from 'sury' (e.g., `import { parse } from 'sury'`).","cause":"Importing from a non-existent subpath.","error":"Error: Cannot find module 'sury/parse'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/DZakh/sury#readme","github":"https://github.com/DZakh/sury","docs":null,"changelog":null,"pypi":null,"npm":"sury","openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}