@sinclair/typebox 0.33.20 → 0.33.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +0 -1
- package/build/cjs/index.js +0 -4
- package/build/cjs/syntax/parse.d.ts +16 -0
- package/build/cjs/{parse → syntax}/parse.js +2 -2
- package/build/cjs/{parse → syntax}/runtime.js +2 -2
- package/build/esm/index.d.mts +0 -1
- package/build/esm/index.mjs +0 -4
- package/build/esm/syntax/parse.d.mts +16 -0
- package/build/esm/{parse → syntax}/parse.mjs +2 -2
- package/build/esm/{parse → syntax}/runtime.mjs +2 -2
- package/package.json +6 -6
- package/syntax/package.json +4 -0
- package/build/cjs/parse/parse.d.ts +0 -11
- package/build/esm/parse/parse.d.mts +0 -11
- package/parse/package.json +0 -4
- /package/build/cjs/{parse → syntax}/index.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/index.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/index.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/index.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/guard.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/guard.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/index.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/index.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/module.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/module.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/parse.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/parse.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/token.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/token.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/types.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/runtime/types.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/index.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/index.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/parse.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/parse.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/token.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/token.js +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/types.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/parsebox/static/types.js +0 -0
- /package/build/cjs/{parse → syntax}/runtime.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/static.d.ts +0 -0
- /package/build/cjs/{parse → syntax}/static.js +0 -0
- /package/build/esm/{parse → syntax}/index.d.mts +0 -0
- /package/build/esm/{parse → syntax}/index.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/index.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/index.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/guard.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/guard.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/index.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/index.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/module.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/module.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/parse.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/parse.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/token.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/token.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/types.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/runtime/types.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/index.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/index.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/parse.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/parse.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/token.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/token.mjs +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/types.d.mts +0 -0
- /package/build/esm/{parse → syntax}/parsebox/static/types.mjs +0 -0
- /package/build/esm/{parse → syntax}/runtime.d.mts +0 -0
- /package/build/esm/{parse → syntax}/static.d.mts +0 -0
- /package/build/esm/{parse → syntax}/static.mjs +0 -0
package/build/cjs/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export * from './type/patterns/index';
|
|
|
7
7
|
export * from './type/registry/index';
|
|
8
8
|
export * from './type/sets/index';
|
|
9
9
|
export * from './type/symbols/index';
|
|
10
|
-
export * from './parse/index';
|
|
11
10
|
export * from './type/any/index';
|
|
12
11
|
export * from './type/array/index';
|
|
13
12
|
export * from './type/async-iterator/index';
|
package/build/cjs/index.js
CHANGED
|
@@ -28,10 +28,6 @@ __exportStar(require("./type/registry/index"), exports);
|
|
|
28
28
|
__exportStar(require("./type/sets/index"), exports);
|
|
29
29
|
__exportStar(require("./type/symbols/index"), exports);
|
|
30
30
|
// ------------------------------------------------------------------
|
|
31
|
-
// Parse
|
|
32
|
-
// ------------------------------------------------------------------
|
|
33
|
-
__exportStar(require("./parse/index"), exports);
|
|
34
|
-
// ------------------------------------------------------------------
|
|
35
31
|
// Types
|
|
36
32
|
// ------------------------------------------------------------------
|
|
37
33
|
__exportStar(require("./type/any/index"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Static } from './parsebox/index';
|
|
2
|
+
import { TSchema, SchemaOptions } from '../type/schema/index';
|
|
3
|
+
import { StaticDecode } from '../type/static/index';
|
|
4
|
+
import { Type } from './static';
|
|
5
|
+
/** `[Experimental]` Infers a TypeBox type from TypeScript syntax. */
|
|
6
|
+
export type StaticParseAsSchema<Context extends Record<PropertyKey, TSchema>, Code extends string> = Static.Parse<Type, Code, Context>[0];
|
|
7
|
+
/** `[Experimental]` Infers a TypeScript type from TypeScript syntax. */
|
|
8
|
+
export type StaticParseAsType<Context extends Record<PropertyKey, TSchema>, Code extends string> = StaticParseAsSchema<Context, Code> extends infer Type extends TSchema ? StaticDecode<Type> : undefined;
|
|
9
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
10
|
+
export declare function Parse<Context extends Record<PropertyKey, TSchema>, Code extends string>(context: Context, code: Code, options?: SchemaOptions): StaticParseAsSchema<Context, Code>;
|
|
11
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
12
|
+
export declare function Parse<Code extends string>(code: Code, options?: SchemaOptions): StaticParseAsSchema<{}, Code>;
|
|
13
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax. This function does not infer the type. */
|
|
14
|
+
export declare function ParseOnly<Context extends Record<PropertyKey, TSchema>, Code extends string>(context: Context, code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
15
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax */
|
|
16
|
+
export declare function ParseOnly<Code extends string>(code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
@@ -5,11 +5,11 @@ exports.Parse = Parse;
|
|
|
5
5
|
exports.ParseOnly = ParseOnly;
|
|
6
6
|
const type_1 = require("../type/create/type");
|
|
7
7
|
const runtime_1 = require("./runtime");
|
|
8
|
-
/** `[Experimental]` Parses a
|
|
8
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
9
9
|
function Parse(...args) {
|
|
10
10
|
return ParseOnly.apply(null, args);
|
|
11
11
|
}
|
|
12
|
-
/** `[Experimental]` Parses a TypeScript
|
|
12
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax. This function does not infer the type. */
|
|
13
13
|
function ParseOnly(...args) {
|
|
14
14
|
const withContext = typeof args[0] === 'string' ? false : true;
|
|
15
15
|
const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}];
|
|
@@ -271,7 +271,7 @@ const ObjectMapping = (values) => Types.Object(values.reduce((properties, record
|
|
|
271
271
|
return { ...properties, ...record };
|
|
272
272
|
}, {}));
|
|
273
273
|
// prettier-ignore
|
|
274
|
-
const
|
|
274
|
+
const _Object = index_1.Runtime.Tuple([
|
|
275
275
|
index_1.Runtime.Const(LBrace),
|
|
276
276
|
index_1.Runtime.Ref('Properties'),
|
|
277
277
|
index_1.Runtime.Const(RBrace)
|
|
@@ -587,7 +587,7 @@ exports.Module = new index_1.Runtime.Module({
|
|
|
587
587
|
Property,
|
|
588
588
|
PropertyDelimiter,
|
|
589
589
|
Properties,
|
|
590
|
-
Object,
|
|
590
|
+
Object: _Object,
|
|
591
591
|
Elements,
|
|
592
592
|
Tuple,
|
|
593
593
|
Parameter,
|
package/build/esm/index.d.mts
CHANGED
|
@@ -7,7 +7,6 @@ export * from './type/patterns/index.mjs';
|
|
|
7
7
|
export * from './type/registry/index.mjs';
|
|
8
8
|
export * from './type/sets/index.mjs';
|
|
9
9
|
export * from './type/symbols/index.mjs';
|
|
10
|
-
export * from './parse/index.mjs';
|
|
11
10
|
export * from './type/any/index.mjs';
|
|
12
11
|
export * from './type/array/index.mjs';
|
|
13
12
|
export * from './type/async-iterator/index.mjs';
|
package/build/esm/index.mjs
CHANGED
|
@@ -11,10 +11,6 @@ export * from './type/registry/index.mjs';
|
|
|
11
11
|
export * from './type/sets/index.mjs';
|
|
12
12
|
export * from './type/symbols/index.mjs';
|
|
13
13
|
// ------------------------------------------------------------------
|
|
14
|
-
// Parse
|
|
15
|
-
// ------------------------------------------------------------------
|
|
16
|
-
export * from './parse/index.mjs';
|
|
17
|
-
// ------------------------------------------------------------------
|
|
18
14
|
// Types
|
|
19
15
|
// ------------------------------------------------------------------
|
|
20
16
|
export * from './type/any/index.mjs';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Static } from './parsebox/index.mjs';
|
|
2
|
+
import { TSchema, SchemaOptions } from '../type/schema/index.mjs';
|
|
3
|
+
import { StaticDecode } from '../type/static/index.mjs';
|
|
4
|
+
import { Type } from './static.mjs';
|
|
5
|
+
/** `[Experimental]` Infers a TypeBox type from TypeScript syntax. */
|
|
6
|
+
export type StaticParseAsSchema<Context extends Record<PropertyKey, TSchema>, Code extends string> = Static.Parse<Type, Code, Context>[0];
|
|
7
|
+
/** `[Experimental]` Infers a TypeScript type from TypeScript syntax. */
|
|
8
|
+
export type StaticParseAsType<Context extends Record<PropertyKey, TSchema>, Code extends string> = StaticParseAsSchema<Context, Code> extends infer Type extends TSchema ? StaticDecode<Type> : undefined;
|
|
9
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
10
|
+
export declare function Parse<Context extends Record<PropertyKey, TSchema>, Code extends string>(context: Context, code: Code, options?: SchemaOptions): StaticParseAsSchema<Context, Code>;
|
|
11
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
12
|
+
export declare function Parse<Code extends string>(code: Code, options?: SchemaOptions): StaticParseAsSchema<{}, Code>;
|
|
13
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax. This function does not infer the type. */
|
|
14
|
+
export declare function ParseOnly<Context extends Record<PropertyKey, TSchema>, Code extends string>(context: Context, code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
15
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax */
|
|
16
|
+
export declare function ParseOnly<Code extends string>(code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CreateType } from '../type/create/type.mjs';
|
|
2
2
|
import { Module } from './runtime.mjs';
|
|
3
|
-
/** `[Experimental]` Parses a
|
|
3
|
+
/** `[Experimental]` Parses a TypeBox type from TypeScript syntax. */
|
|
4
4
|
export function Parse(...args) {
|
|
5
5
|
return ParseOnly.apply(null, args);
|
|
6
6
|
}
|
|
7
|
-
/** `[Experimental]` Parses a TypeScript
|
|
7
|
+
/** `[Experimental]` Parses a TypeBox TSchema from TypeScript syntax. This function does not infer the type. */
|
|
8
8
|
export function ParseOnly(...args) {
|
|
9
9
|
const withContext = typeof args[0] === 'string' ? false : true;
|
|
10
10
|
const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}];
|
|
@@ -267,7 +267,7 @@ const ObjectMapping = (values) => Types.Object(values.reduce((properties, record
|
|
|
267
267
|
return { ...properties, ...record };
|
|
268
268
|
}, {}));
|
|
269
269
|
// prettier-ignore
|
|
270
|
-
const
|
|
270
|
+
const _Object = Runtime.Tuple([
|
|
271
271
|
Runtime.Const(LBrace),
|
|
272
272
|
Runtime.Ref('Properties'),
|
|
273
273
|
Runtime.Const(RBrace)
|
|
@@ -583,7 +583,7 @@ export const Module = new Runtime.Module({
|
|
|
583
583
|
Property,
|
|
584
584
|
PropertyDelimiter,
|
|
585
585
|
Properties,
|
|
586
|
-
Object,
|
|
586
|
+
Object: _Object,
|
|
587
587
|
Elements,
|
|
588
588
|
Tuple,
|
|
589
589
|
Parameter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sinclair/typebox",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.22",
|
|
4
4
|
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"default": "./build/esm/errors/index.mjs"
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
"./
|
|
65
|
+
"./syntax": {
|
|
66
66
|
"require": {
|
|
67
|
-
"types": "./build/cjs/
|
|
68
|
-
"default": "./build/cjs/
|
|
67
|
+
"types": "./build/cjs/syntax/index.d.ts",
|
|
68
|
+
"default": "./build/cjs/syntax/index.js"
|
|
69
69
|
},
|
|
70
70
|
"import": {
|
|
71
|
-
"types": "./build/esm/
|
|
72
|
-
"default": "./build/esm/
|
|
71
|
+
"types": "./build/esm/syntax/index.d.mts",
|
|
72
|
+
"default": "./build/esm/syntax/index.mjs"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"./system": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Static } from './parsebox/index';
|
|
2
|
-
import { TSchema, SchemaOptions } from '../type/schema/index';
|
|
3
|
-
import { Type } from './static';
|
|
4
|
-
/** `[Experimental]` Parses a TypeScript type annotation as an inferred TypeBox type */
|
|
5
|
-
export declare function Parse<Code extends string, Context extends Record<PropertyKey, TSchema> = {}>(context: Context, code: Code, options?: SchemaOptions): Static.Parse<Type, Code, Context>[0];
|
|
6
|
-
/** `[Experimental]` Parses a TypeScript type annotation as an inferred TypeBox type */
|
|
7
|
-
export declare function Parse<Code extends string>(code: Code, options?: SchemaOptions): Static.Parse<Type, Code, {}>[0];
|
|
8
|
-
/** `[Experimental]` Parses a TypeScript type annotation as TSchema */
|
|
9
|
-
export declare function ParseOnly<Code extends string, Context extends Record<PropertyKey, TSchema> = {}>(context: Context, code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
10
|
-
/** `[Experimental]` Parses a TypeScript type annotation as TSchema */
|
|
11
|
-
export declare function ParseOnly<Code extends string>(code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Static } from './parsebox/index.mjs';
|
|
2
|
-
import { TSchema, SchemaOptions } from '../type/schema/index.mjs';
|
|
3
|
-
import { Type } from './static.mjs';
|
|
4
|
-
/** `[Experimental]` Parses a TypeScript type annotation as an inferred TypeBox type */
|
|
5
|
-
export declare function Parse<Code extends string, Context extends Record<PropertyKey, TSchema> = {}>(context: Context, code: Code, options?: SchemaOptions): Static.Parse<Type, Code, Context>[0];
|
|
6
|
-
/** `[Experimental]` Parses a TypeScript type annotation as an inferred TypeBox type */
|
|
7
|
-
export declare function Parse<Code extends string>(code: Code, options?: SchemaOptions): Static.Parse<Type, Code, {}>[0];
|
|
8
|
-
/** `[Experimental]` Parses a TypeScript type annotation as TSchema */
|
|
9
|
-
export declare function ParseOnly<Code extends string, Context extends Record<PropertyKey, TSchema> = {}>(context: Context, code: Code, options?: SchemaOptions): TSchema | undefined;
|
|
10
|
-
/** `[Experimental]` Parses a TypeScript type annotation as TSchema */
|
|
11
|
-
export declare function ParseOnly<Code extends string>(code: Code, options?: SchemaOptions): TSchema | undefined;
|
package/parse/package.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|