@sinclair/typebox 0.33.21 → 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.
Files changed (69) hide show
  1. package/build/cjs/index.d.ts +0 -1
  2. package/build/cjs/index.js +0 -4
  3. package/build/cjs/syntax/parse.d.ts +16 -0
  4. package/build/cjs/{parse → syntax}/parse.js +2 -2
  5. package/build/esm/index.d.mts +0 -1
  6. package/build/esm/index.mjs +0 -4
  7. package/build/esm/syntax/parse.d.mts +16 -0
  8. package/build/esm/{parse → syntax}/parse.mjs +2 -2
  9. package/package.json +6 -6
  10. package/syntax/package.json +4 -0
  11. package/build/cjs/parse/parse.d.ts +0 -11
  12. package/build/esm/parse/parse.d.mts +0 -11
  13. package/parse/package.json +0 -4
  14. /package/build/cjs/{parse → syntax}/index.d.ts +0 -0
  15. /package/build/cjs/{parse → syntax}/index.js +0 -0
  16. /package/build/cjs/{parse → syntax}/parsebox/index.d.ts +0 -0
  17. /package/build/cjs/{parse → syntax}/parsebox/index.js +0 -0
  18. /package/build/cjs/{parse → syntax}/parsebox/runtime/guard.d.ts +0 -0
  19. /package/build/cjs/{parse → syntax}/parsebox/runtime/guard.js +0 -0
  20. /package/build/cjs/{parse → syntax}/parsebox/runtime/index.d.ts +0 -0
  21. /package/build/cjs/{parse → syntax}/parsebox/runtime/index.js +0 -0
  22. /package/build/cjs/{parse → syntax}/parsebox/runtime/module.d.ts +0 -0
  23. /package/build/cjs/{parse → syntax}/parsebox/runtime/module.js +0 -0
  24. /package/build/cjs/{parse → syntax}/parsebox/runtime/parse.d.ts +0 -0
  25. /package/build/cjs/{parse → syntax}/parsebox/runtime/parse.js +0 -0
  26. /package/build/cjs/{parse → syntax}/parsebox/runtime/token.d.ts +0 -0
  27. /package/build/cjs/{parse → syntax}/parsebox/runtime/token.js +0 -0
  28. /package/build/cjs/{parse → syntax}/parsebox/runtime/types.d.ts +0 -0
  29. /package/build/cjs/{parse → syntax}/parsebox/runtime/types.js +0 -0
  30. /package/build/cjs/{parse → syntax}/parsebox/static/index.d.ts +0 -0
  31. /package/build/cjs/{parse → syntax}/parsebox/static/index.js +0 -0
  32. /package/build/cjs/{parse → syntax}/parsebox/static/parse.d.ts +0 -0
  33. /package/build/cjs/{parse → syntax}/parsebox/static/parse.js +0 -0
  34. /package/build/cjs/{parse → syntax}/parsebox/static/token.d.ts +0 -0
  35. /package/build/cjs/{parse → syntax}/parsebox/static/token.js +0 -0
  36. /package/build/cjs/{parse → syntax}/parsebox/static/types.d.ts +0 -0
  37. /package/build/cjs/{parse → syntax}/parsebox/static/types.js +0 -0
  38. /package/build/cjs/{parse → syntax}/runtime.d.ts +0 -0
  39. /package/build/cjs/{parse → syntax}/runtime.js +0 -0
  40. /package/build/cjs/{parse → syntax}/static.d.ts +0 -0
  41. /package/build/cjs/{parse → syntax}/static.js +0 -0
  42. /package/build/esm/{parse → syntax}/index.d.mts +0 -0
  43. /package/build/esm/{parse → syntax}/index.mjs +0 -0
  44. /package/build/esm/{parse → syntax}/parsebox/index.d.mts +0 -0
  45. /package/build/esm/{parse → syntax}/parsebox/index.mjs +0 -0
  46. /package/build/esm/{parse → syntax}/parsebox/runtime/guard.d.mts +0 -0
  47. /package/build/esm/{parse → syntax}/parsebox/runtime/guard.mjs +0 -0
  48. /package/build/esm/{parse → syntax}/parsebox/runtime/index.d.mts +0 -0
  49. /package/build/esm/{parse → syntax}/parsebox/runtime/index.mjs +0 -0
  50. /package/build/esm/{parse → syntax}/parsebox/runtime/module.d.mts +0 -0
  51. /package/build/esm/{parse → syntax}/parsebox/runtime/module.mjs +0 -0
  52. /package/build/esm/{parse → syntax}/parsebox/runtime/parse.d.mts +0 -0
  53. /package/build/esm/{parse → syntax}/parsebox/runtime/parse.mjs +0 -0
  54. /package/build/esm/{parse → syntax}/parsebox/runtime/token.d.mts +0 -0
  55. /package/build/esm/{parse → syntax}/parsebox/runtime/token.mjs +0 -0
  56. /package/build/esm/{parse → syntax}/parsebox/runtime/types.d.mts +0 -0
  57. /package/build/esm/{parse → syntax}/parsebox/runtime/types.mjs +0 -0
  58. /package/build/esm/{parse → syntax}/parsebox/static/index.d.mts +0 -0
  59. /package/build/esm/{parse → syntax}/parsebox/static/index.mjs +0 -0
  60. /package/build/esm/{parse → syntax}/parsebox/static/parse.d.mts +0 -0
  61. /package/build/esm/{parse → syntax}/parsebox/static/parse.mjs +0 -0
  62. /package/build/esm/{parse → syntax}/parsebox/static/token.d.mts +0 -0
  63. /package/build/esm/{parse → syntax}/parsebox/static/token.mjs +0 -0
  64. /package/build/esm/{parse → syntax}/parsebox/static/types.d.mts +0 -0
  65. /package/build/esm/{parse → syntax}/parsebox/static/types.mjs +0 -0
  66. /package/build/esm/{parse → syntax}/runtime.d.mts +0 -0
  67. /package/build/esm/{parse → syntax}/runtime.mjs +0 -0
  68. /package/build/esm/{parse → syntax}/static.d.mts +0 -0
  69. /package/build/esm/{parse → syntax}/static.mjs +0 -0
@@ -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';
@@ -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 TypeScript type annotation as an inferred TypeBox type */
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 type annotation as TSchema */
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] || {}];
@@ -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';
@@ -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 TypeScript type annotation as an inferred TypeBox type */
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 type annotation as TSchema */
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] || {}];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.33.21",
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
- "./parse": {
65
+ "./syntax": {
66
66
  "require": {
67
- "types": "./build/cjs/parse/index.d.ts",
68
- "default": "./build/cjs/parse/index.js"
67
+ "types": "./build/cjs/syntax/index.d.ts",
68
+ "default": "./build/cjs/syntax/index.js"
69
69
  },
70
70
  "import": {
71
- "types": "./build/esm/parse/index.d.mts",
72
- "default": "./build/esm/parse/index.mjs"
71
+ "types": "./build/esm/syntax/index.d.mts",
72
+ "default": "./build/esm/syntax/index.mjs"
73
73
  }
74
74
  },
75
75
  "./system": {
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../build/cjs/syntax/index.js",
3
+ "types": "../build/cjs/syntax/index.d.ts"
4
+ }
@@ -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;
@@ -1,4 +0,0 @@
1
- {
2
- "main": "../build/cjs/parse/index.js",
3
- "types": "../build/cjs/parse/index.d.ts"
4
- }
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