Skip to content

Commit 66364b6

Browse files
committed
Next
1 parent 03a36dd commit 66364b6

169 files changed

Lines changed: 629 additions & 3316 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deno.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
// --------------------------------------------------------------
4343
// Package Entry
4444
// --------------------------------------------------------------
45-
"typebox/compile": "./src/compile/index.ts",
4645
"typebox/error": "./src/error/index.ts",
4746
"typebox/format": "./src/format/index.ts",
4847
"typebox/guard": "./src/guard/index.ts",

design/website/app/frontend/components/docs/docs.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ interface Manifest {
4949
const TOP_LEVEL_ORDER = [
5050
'overview',
5151
'type',
52-
'script',
53-
'schema',
5452
'value',
53+
'schema',
5554
'format',
56-
'compile',
55+
'script',
5756
'system',
5857
]
5958
// ------------------------------------------------------------------

design/website/app/frontend/components/home/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function Home() {
9797
<div className='home'>
9898
<div className='home-card'>
9999
<TypeBoxLogo />
100-
<h1>TypeBox</h1>
100+
<h1>TypeBox<sup style={{ marginLeft: '0.4em', color: '#e0c285', fontSize: '0.6em' }}>2</sup></h1>
101101
<AnimatedSubHeading
102102
intervalMs={5000}
103103
stepDelayMs={25}

design/website/docs/compile/0_compile.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

design/website/docs/compile/1_validator.md

Lines changed: 0 additions & 113 deletions
This file was deleted.

design/website/docs/compile/2_code.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

design/website/docs/compile/3_accelerate.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

design/website/docs/compile/overview.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

design/website/docs/schema/5_compile.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,19 @@ const S = C.Parse({ x: 1, y: 2, z: 3 }) // const S: {
4242
// Errors
4343
// ------------------------------------------------------------------
4444
const E = C.Errors(T, { x: null }) // const E = [
45-
// false,
46-
// [
47-
// {
48-
// keyword: "required",
49-
// schemaPath: "#",
50-
// instancePath: "",
51-
// params: { requiredProperties: [ "y", "z" ] },
52-
// message: "must have required properties y, z"
53-
// },
54-
// {
55-
// keyword: "type",
56-
// schemaPath: "#/properties/x",
57-
// instancePath: "/x",
58-
// params: { type: "number" },
59-
// message: "must be number"
60-
// }
61-
// ]
45+
// {
46+
// keyword: "required",
47+
// schemaPath: "#",
48+
// instancePath: "",
49+
// params: { requiredProperties: [ "y", "z" ] },
50+
// message: "must have required properties y, z"
51+
// },
52+
// {
53+
// keyword: "type",
54+
// schemaPath: "#/properties/x",
55+
// instancePath: "/x",
56+
// params: { type: "number" },
57+
// message: "must be number"
58+
// }
6259
// ]
6360
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Schema.Accelerate
2+
3+
TypeBox attains high performance by compiling JSON schematics into optimized JavaScript validation routines. These routines are evaluated at runtime within the environment; a technique known as Just-In-Time (JIT) compilation.
4+
5+
TypeBox takes measures to ensure evaluation is safe, however some environments do restrict runtime code evaluation by preventing calls to `eval()` or `new Function()`. In such cases, acceleration will not be possible. TypeBox will automatically fall back to interpreted dynamic checking if it detects a restrictive [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP).
6+
7+
8+
## IsAccelerated
9+
10+
You can check if a compiled Validator is using accleration with the IsAccelerated function.
11+
12+
```typescript
13+
import { Compile } from 'typebox/schema'
14+
15+
const C = Compile(Type.String())
16+
17+
console.log(C.IsAccelerated()) // true if accelerated
18+
```
19+
20+
## Disable Acceleration
21+
22+
You can disable all acceleration with the following system setting.
23+
24+
```typescript
25+
import System from 'typebox/system'
26+
27+
System.Settings.Set({ useAcceleration: false }) // default is true
28+
29+
// ...
30+
31+
const C = Schema.Compile(Type.String())
32+
33+
console.log(C.IsAccelerated()) // will be false
34+
35+
36+
```

0 commit comments

Comments
 (0)