From e73ecb4306151fecbab9f82eded7099a3d027daf Mon Sep 17 00:00:00 2001 From: Reve Date: Sat, 26 Jul 2025 01:13:50 +0700 Subject: [PATCH 1/4] chore: update stnl version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6471ee77d..6479bc463 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "runtypes": "6.7.0", "simple-runtypes": "7.1.3", "spectypes": "2.1.11", - "stnl": "0.3.5", + "stnl": "1.1.6", "succulent": "0.18.1", "superstruct": "2.0.2", "suretype": "2.4.1", From 353841f8650a2551b29710ff8ed4c2d432138946 Mon Sep 17 00:00:00 2001 From: Reve Date: Sat, 26 Jul 2025 01:17:09 +0700 Subject: [PATCH 2/4] chore: update stnl code to 1.1.6 --- cases/stnl.ts | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/cases/stnl.ts b/cases/stnl.ts index bfe7562e2..d5353066b 100644 --- a/cases/stnl.ts +++ b/cases/stnl.ts @@ -1,38 +1,24 @@ import compose from 'stnl/compilers/validate-json/compose'; -import { build } from 'stnl/compilers/validate-json'; -import stnl from 'stnl'; +import { build, t } from 'stnl'; import { createCase } from '../benchmarks'; -const assertLoose = stnl({ - props: { - number: 'f64', - negNumber: 'f64', - maxNumber: 'f64', - string: 'string', - longString: 'string', - boolean: 'bool', - deeplyNested: { - props: { - foo: 'string', - num: 'f64', - bool: 'bool', - }, - }, - }, -}); - -createCase('stnl (composition)', 'assertLoose', () => { - const check = compose(assertLoose); - - return data => { - if (check(data)) return true; - throw null; - }; +const assertLoose = t.dict({ + number: t.float, + negNumber: t.float, + maxNumber: t.float, + string: t.string, + longString: t.string, + boolean: t.bool, + deeplyNested: t.dict({ + foo: t.string, + num: t.float, + bool: t.bool + }) }); createCase('stnl (just-in-time)', 'assertLoose', () => { - const check = build(assertLoose); + const check = build.json.assert.compile(assertLoose); return data => { if (check(data)) return true; From d47615503f2a9a61e288f3df98caacea23b028dd Mon Sep 17 00:00:00 2001 From: aquapi Date: Sat, 26 Jul 2025 01:30:16 +0700 Subject: [PATCH 3/4] chore: Update package locks --- bun.lock | 4 ++-- package-lock.json | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bun.lock b/bun.lock index 4568a3193..d73a62d20 100644 --- a/bun.lock +++ b/bun.lock @@ -56,7 +56,7 @@ "runtypes": "6.7.0", "simple-runtypes": "7.1.3", "spectypes": "2.1.11", - "stnl": "0.3.5", + "stnl": "1.1.6", "succulent": "0.18.1", "superstruct": "2.0.2", "suretype": "2.4.1", @@ -1392,7 +1392,7 @@ "std-env": ["std-env@3.9.0", "", {}, "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw=="], - "stnl": ["stnl@0.3.5", "", {}, "sha512-d5SozAjuuKqNQXleLIiLKrsnyL4Rm8FU28hmA/Ja/G/frzDMX66fodU09IUdWJhf1Xm+B1pG/KG/eQY4buiBoQ=="], + "stnl": ["stnl@1.1.6", "", {}, "sha512-E6tfWe7z8B/1SwMo7lCUOoC940y6d+Y0EfdOaN3yUetkN0O9NZ+XdBirDzPZYQZp65Q33x0r8bnlhjC+YcRpXQ=="], "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], diff --git a/package-lock.json b/package-lock.json index fc2e74361..10d388472 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "runtypes": "6.7.0", "simple-runtypes": "7.1.3", "spectypes": "2.1.11", - "stnl": "0.3.5", + "stnl": "1.1.6", "succulent": "0.18.1", "superstruct": "2.0.2", "suretype": "2.4.1", @@ -8447,9 +8447,10 @@ "dev": true }, "node_modules/stnl": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/stnl/-/stnl-0.3.5.tgz", - "integrity": "sha512-d5SozAjuuKqNQXleLIiLKrsnyL4Rm8FU28hmA/Ja/G/frzDMX66fodU09IUdWJhf1Xm+B1pG/KG/eQY4buiBoQ==" + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/stnl/-/stnl-1.1.6.tgz", + "integrity": "sha512-E6tfWe7z8B/1SwMo7lCUOoC940y6d+Y0EfdOaN3yUetkN0O9NZ+XdBirDzPZYQZp65Q33x0r8bnlhjC+YcRpXQ==", + "license": "MIT" }, "node_modules/string_decoder": { "version": "1.3.0", @@ -16426,9 +16427,9 @@ "dev": true }, "stnl": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/stnl/-/stnl-0.3.5.tgz", - "integrity": "sha512-d5SozAjuuKqNQXleLIiLKrsnyL4Rm8FU28hmA/Ja/G/frzDMX66fodU09IUdWJhf1Xm+B1pG/KG/eQY4buiBoQ==" + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/stnl/-/stnl-1.1.6.tgz", + "integrity": "sha512-E6tfWe7z8B/1SwMo7lCUOoC940y6d+Y0EfdOaN3yUetkN0O9NZ+XdBirDzPZYQZp65Q33x0r8bnlhjC+YcRpXQ==" }, "string_decoder": { "version": "1.3.0", From e6e34fcffac8de8b80b976dd37892cda76ad4fa2 Mon Sep 17 00:00:00 2001 From: aquapi Date: Sat, 26 Jul 2025 01:32:33 +0700 Subject: [PATCH 4/4] fix: fix stnl lint rules --- cases/stnl.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cases/stnl.ts b/cases/stnl.ts index d5353066b..8e1b8d62b 100644 --- a/cases/stnl.ts +++ b/cases/stnl.ts @@ -1,4 +1,3 @@ -import compose from 'stnl/compilers/validate-json/compose'; import { build, t } from 'stnl'; import { createCase } from '../benchmarks'; @@ -13,8 +12,8 @@ const assertLoose = t.dict({ deeplyNested: t.dict({ foo: t.string, num: t.float, - bool: t.bool - }) + bool: t.bool, + }), }); createCase('stnl (just-in-time)', 'assertLoose', () => {