-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
573cdb1
commit 1950a1d
Showing
376 changed files
with
18,447 additions
and
6,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
## [0.32.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.32.0) | ||
|
||
## Overview | ||
|
||
Revision 0.32.0 is milestone revision. This revision carries out a complete modularization of `Type.*` and `Value.*`, as well as remodelling the TypeBox API to support selectively importing individual types. In addition to project restructuring, this revision also includes two new Types (`Const` and `Deref`) two new Value functions (`Clean` and `Default`) as well as many additional optimizations to type inference. | ||
|
||
This is a significant revision for TypeBox. The updates in this revision should not break most users, however, many internal inference types that were previously exported on `typebox.ts` have been made private within module. Testing has been carried out to ensure the documented frontend for TypeBox is retained, however due to internal inference types being made fully private. Some users may experience some breakage. | ||
|
||
A minor revision is required. | ||
|
||
## Contents | ||
|
||
- Enhancements | ||
- [Modularization](#Modularization) | ||
- [Types](#Modularization-Types) | ||
- [Values](#Modularization-Values) | ||
- [Bundle Size](#Modularization-Bundle-Size) | ||
- [Types](#Types) | ||
- [Const](#Const) | ||
- [Deref](#Deref) | ||
- [Values](#Values) | ||
- [Clean](#Clean) | ||
- [Default](#Default) | ||
- Deprecations | ||
- [RegExp](#RegExp) | ||
- [TypeSystem Format](#TypeSystemFormat) | ||
- [TypeSystem Type](#TypeSystemType) | ||
- Breaking | ||
- [JsonTypeBuilder and JavaScriptTypeBuilder](#JsonTypeBuilder-and-JavaScriptTypeBuilder) | ||
- [TypeSystemPolicy](#TypeSystemPolicy) | ||
|
||
## Modularization | ||
|
||
Revision 0.32.0 carries out a complete restructuring of TypeBox's internals to modularize the type system. These updates enable for the following. | ||
|
||
- Enable bundlers to properly tree-shake TypeBox's type system. | ||
- Enable additional options for integrators re-exporting TypeBox's interface. | ||
- Further optimize bundle sizes for Value and TypeCompiler. | ||
- Improve maintainability of the type system. | ||
- Make nessasarily provisions for ESM publishing. | ||
|
||
### Types | ||
|
||
Revision 0.32.0 now exposes `Type.*` as a default export as well as enables all types to be selectively imported. When importing selective types, bundlers may be able to tree-shake unused types. The following imports are now supported. | ||
|
||
```typescript | ||
import { Type, type Static } from '@sinclair/typebox' // classic | ||
import Type, { type Static } from '@sinclair/typebox' // modern | ||
import { Object, String, Number, ... } from '@sinclair/typebox' // selective | ||
``` | ||
### Values | ||
Revision 0.32.0 carries out modularization of `Value.*`. Individual Value functions can not be imported directly without specifying the sub module path. | ||
```typescript | ||
import { Value } from '@sinclair/typebox/value' // classic | ||
import Value from '@sinclair/typebox/value' // modern | ||
import { Check, Clone, Cast } from '@sinclair/typebox/value' // selective | ||
``` | ||
### Bundle Size | ||
The modularization in 0.32.0 has enabled significant bundle size optimizations across Value, TypeCompiler, Errors and System sub modules. | ||
Revision 0.31.0 | ||
``` | ||
┌──────────────────────┬────────────┬────────────┬─────────────┐ | ||
│ (index) │ Compiled │ Minified │ Compression │ | ||
├──────────────────────┼────────────┼────────────┼─────────────┤ | ||
│ typebox/compiler │ '163.6 kb' │ ' 71.6 kb' │ '2.28 x' │ | ||
│ typebox/errors │ '113.3 kb' │ ' 50.1 kb' │ '2.26 x' │ | ||
│ typebox/system │ ' 83.9 kb' │ ' 37.5 kb' │ '2.24 x' │ | ||
│ typebox/value │ '191.1 kb' │ ' 82.3 kb' │ '2.32 x' │ | ||
│ typebox │ ' 73.8 kb' │ ' 32.3 kb' │ '2.29 x' │ | ||
└──────────────────────┴────────────┴────────────┴─────────────┘ | ||
``` | ||
|
||
Revision 0.32.0 | ||
|
||
``` | ||
┌──────────────────────┬────────────┬────────────┬─────────────┐ | ||
│ (index) │ Compiled │ Minified │ Compression │ | ||
├──────────────────────┼────────────┼────────────┼─────────────┤ | ||
│ typebox/compiler │ '109.3 kb' │ ' 48.5 kb' │ '2.25 x' │ | ||
│ typebox/errors │ ' 54.8 kb' │ ' 24.9 kb' │ '2.20 x' │ | ||
│ typebox/system │ ' 12.1 kb' │ ' 6.1 kb' │ '1.98 x' │ | ||
│ typebox/type │ ' 77.8 kb' │ ' 32.8 kb' │ '2.37 x' │ | ||
│ typebox/value │ '143.7 kb' │ ' 61.2 kb' │ '2.35 x' │ | ||
│ typebox │ ' 77.9 kb' │ ' 32.8 kb' │ '2.37 x' │ | ||
└──────────────────────┴────────────┴────────────┴─────────────┘ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.