@standard-community/standard-json 0.1.0

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/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Standard JSON
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@standard-community/standard-json.svg)](https://npmjs.org/package/@standard-community/standard-json "View this project on NPM")
4
+ [![npm downloads](https://img.shields.io/npm/dm/@standard-community/standard-json)](https://www.npmjs.com/package/@standard-community/standard-json)
5
+ [![license](https://img.shields.io/npm/l/@standard-community/standard-json)](LICENSE)
6
+
7
+ Standard Schema Validator's JSON Schema Converter
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { toJsonSchema } from "@standard-community/standard-json";
13
+
14
+ // Define your schema
15
+ const schema = v.pipe(
16
+ v.object({
17
+ myString: v.string(),
18
+ myUnion: v.union([v.number(), v.boolean()]),
19
+ }),
20
+ v.description("My neat object schema"),
21
+ );
22
+
23
+ // Convert it to JSON Schema
24
+ const jsonSchema = await toJsonSchema(schema);
25
+ ```
26
+
27
+ ## Compatibility
28
+
29
+ List of supported validators -
30
+
31
+ | Vendor | Version |
32
+ | ------- | ------- |
33
+ | Zod | 3.24.0+ |
34
+ | Valibot | 1.0+ |
35
+ | ArkType | 2.0+ |
36
+
37
+ ## Credit
38
+
39
+ - This project is inspired by the work of [kwaa](https://github.com/kwaa) and their [xsschema](https://xsai.js.org/docs/packages/top-level/xsschema) package.
@@ -0,0 +1 @@
1
+ "use strict";var t=Object.defineProperty;var s=(o,c)=>t(o,"name",{value:c,configurable:!0});const n=s(async()=>o=>o.toJsonSchema(),"toJsonSchema");exports.toJsonSchema=n;
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var c=(o,n)=>s(o,"name",{value:n,configurable:!0});const t=c(async()=>o=>o.toJsonSchema(),"toJsonSchema");export{t as toJsonSchema};
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var n=(e,r)=>o(e,"name",{value:r,configurable:!0});const s=n(async e=>{const r=e["~standard"].vendor;let t;switch(r){case"arktype":t=Promise.resolve().then(function(){return require("./arktype-BLC3CdrE.cjs")});break;case"valibot":t=Promise.resolve().then(function(){return require("./valibot-KN6if2LL.cjs")});break;case"zod":t=Promise.resolve().then(function(){return require("./zod-BnLkqCQl.cjs")});break;default:throw new Error(`standard-json: Unsupported schema vendor "${r}"`)}return(await(await t).toJsonSchema())(e)},"toJsonSchema");exports.toJsonSchema=s;
@@ -0,0 +1,227 @@
1
+ /** The Standard Schema interface. */
2
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
3
+ /** The Standard Schema properties. */
4
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
5
+ }
6
+ declare namespace StandardSchemaV1 {
7
+ /** The Standard Schema properties interface. */
8
+ export interface Props<Input = unknown, Output = Input> {
9
+ /** The version number of the standard. */
10
+ readonly version: 1;
11
+ /** The vendor name of the schema library. */
12
+ readonly vendor: string;
13
+ /** Validates unknown input values. */
14
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
15
+ /** Inferred types associated with the schema. */
16
+ readonly types?: Types<Input, Output> | undefined;
17
+ }
18
+ /** The result interface of the validate function. */
19
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
20
+ /** The result interface if validation succeeds. */
21
+ export interface SuccessResult<Output> {
22
+ /** The typed output value. */
23
+ readonly value: Output;
24
+ /** The non-existent issues. */
25
+ readonly issues?: undefined;
26
+ }
27
+ /** The result interface if validation fails. */
28
+ export interface FailureResult {
29
+ /** The issues of failed validation. */
30
+ readonly issues: ReadonlyArray<Issue>;
31
+ }
32
+ /** The issue interface of the failure output. */
33
+ export interface Issue {
34
+ /** The error message of the issue. */
35
+ readonly message: string;
36
+ /** The path of the issue, if any. */
37
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
38
+ }
39
+ /** The path segment interface of the issue. */
40
+ export interface PathSegment {
41
+ /** The key representing a path segment. */
42
+ readonly key: PropertyKey;
43
+ }
44
+ /** The Standard Schema types interface. */
45
+ export interface Types<Input = unknown, Output = Input> {
46
+ /** The input type of the schema. */
47
+ readonly input: Input;
48
+ /** The output type of the schema. */
49
+ readonly output: Output;
50
+ }
51
+ /** Infers the input type of a Standard Schema. */
52
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
53
+ /** Infers the output type of a Standard Schema. */
54
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
55
+ export { };
56
+ }
57
+
58
+ // ==================================================================================================
59
+ // JSON Schema Draft 07
60
+ // ==================================================================================================
61
+ // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
62
+ // --------------------------------------------------------------------------------------------------
63
+
64
+ /**
65
+ * Primitive type
66
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
67
+ */
68
+ type JSONSchema7TypeName =
69
+ | "string" //
70
+ | "number"
71
+ | "integer"
72
+ | "boolean"
73
+ | "object"
74
+ | "array"
75
+ | "null";
76
+
77
+ /**
78
+ * Primitive type
79
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
80
+ */
81
+ type JSONSchema7Type =
82
+ | string //
83
+ | number
84
+ | boolean
85
+ | JSONSchema7Object
86
+ | JSONSchema7Array
87
+ | null;
88
+
89
+ // Workaround for infinite type recursion
90
+ interface JSONSchema7Object {
91
+ [key: string]: JSONSchema7Type;
92
+ }
93
+
94
+ // Workaround for infinite type recursion
95
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
96
+ interface JSONSchema7Array extends Array<JSONSchema7Type> {}
97
+
98
+ /**
99
+ * Meta schema
100
+ *
101
+ * Recommended values:
102
+ * - 'http://json-schema.org/schema#'
103
+ * - 'http://json-schema.org/hyper-schema#'
104
+ * - 'http://json-schema.org/draft-07/schema#'
105
+ * - 'http://json-schema.org/draft-07/hyper-schema#'
106
+ *
107
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
108
+ */
109
+ type JSONSchema7Version = string;
110
+
111
+ /**
112
+ * JSON Schema v7
113
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
114
+ */
115
+ type JSONSchema7Definition = JSONSchema7 | boolean;
116
+ interface JSONSchema7 {
117
+ $id?: string | undefined;
118
+ $ref?: string | undefined;
119
+ $schema?: JSONSchema7Version | undefined;
120
+ $comment?: string | undefined;
121
+
122
+ /**
123
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
124
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
125
+ */
126
+ $defs?: {
127
+ [key: string]: JSONSchema7Definition;
128
+ } | undefined;
129
+
130
+ /**
131
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
132
+ */
133
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
134
+ enum?: JSONSchema7Type[] | undefined;
135
+ const?: JSONSchema7Type | undefined;
136
+
137
+ /**
138
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
139
+ */
140
+ multipleOf?: number | undefined;
141
+ maximum?: number | undefined;
142
+ exclusiveMaximum?: number | undefined;
143
+ minimum?: number | undefined;
144
+ exclusiveMinimum?: number | undefined;
145
+
146
+ /**
147
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
148
+ */
149
+ maxLength?: number | undefined;
150
+ minLength?: number | undefined;
151
+ pattern?: string | undefined;
152
+
153
+ /**
154
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
155
+ */
156
+ items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
157
+ additionalItems?: JSONSchema7Definition | undefined;
158
+ maxItems?: number | undefined;
159
+ minItems?: number | undefined;
160
+ uniqueItems?: boolean | undefined;
161
+ contains?: JSONSchema7Definition | undefined;
162
+
163
+ /**
164
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
165
+ */
166
+ maxProperties?: number | undefined;
167
+ minProperties?: number | undefined;
168
+ required?: string[] | undefined;
169
+ properties?: {
170
+ [key: string]: JSONSchema7Definition;
171
+ } | undefined;
172
+ patternProperties?: {
173
+ [key: string]: JSONSchema7Definition;
174
+ } | undefined;
175
+ additionalProperties?: JSONSchema7Definition | undefined;
176
+ dependencies?: {
177
+ [key: string]: JSONSchema7Definition | string[];
178
+ } | undefined;
179
+ propertyNames?: JSONSchema7Definition | undefined;
180
+
181
+ /**
182
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
183
+ */
184
+ if?: JSONSchema7Definition | undefined;
185
+ then?: JSONSchema7Definition | undefined;
186
+ else?: JSONSchema7Definition | undefined;
187
+
188
+ /**
189
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
190
+ */
191
+ allOf?: JSONSchema7Definition[] | undefined;
192
+ anyOf?: JSONSchema7Definition[] | undefined;
193
+ oneOf?: JSONSchema7Definition[] | undefined;
194
+ not?: JSONSchema7Definition | undefined;
195
+
196
+ /**
197
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
198
+ */
199
+ format?: string | undefined;
200
+
201
+ /**
202
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
203
+ */
204
+ contentMediaType?: string | undefined;
205
+ contentEncoding?: string | undefined;
206
+
207
+ /**
208
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
209
+ */
210
+ definitions?: {
211
+ [key: string]: JSONSchema7Definition;
212
+ } | undefined;
213
+
214
+ /**
215
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
216
+ */
217
+ title?: string | undefined;
218
+ description?: string | undefined;
219
+ default?: JSONSchema7Type | undefined;
220
+ readOnly?: boolean | undefined;
221
+ writeOnly?: boolean | undefined;
222
+ examples?: JSONSchema7Type | undefined;
223
+ }
224
+
225
+ declare const toJsonSchema: (schema: StandardSchemaV1) => Promise<JSONSchema7>;
226
+
227
+ export { toJsonSchema };
@@ -0,0 +1,227 @@
1
+ /** The Standard Schema interface. */
2
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
3
+ /** The Standard Schema properties. */
4
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
5
+ }
6
+ declare namespace StandardSchemaV1 {
7
+ /** The Standard Schema properties interface. */
8
+ export interface Props<Input = unknown, Output = Input> {
9
+ /** The version number of the standard. */
10
+ readonly version: 1;
11
+ /** The vendor name of the schema library. */
12
+ readonly vendor: string;
13
+ /** Validates unknown input values. */
14
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
15
+ /** Inferred types associated with the schema. */
16
+ readonly types?: Types<Input, Output> | undefined;
17
+ }
18
+ /** The result interface of the validate function. */
19
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
20
+ /** The result interface if validation succeeds. */
21
+ export interface SuccessResult<Output> {
22
+ /** The typed output value. */
23
+ readonly value: Output;
24
+ /** The non-existent issues. */
25
+ readonly issues?: undefined;
26
+ }
27
+ /** The result interface if validation fails. */
28
+ export interface FailureResult {
29
+ /** The issues of failed validation. */
30
+ readonly issues: ReadonlyArray<Issue>;
31
+ }
32
+ /** The issue interface of the failure output. */
33
+ export interface Issue {
34
+ /** The error message of the issue. */
35
+ readonly message: string;
36
+ /** The path of the issue, if any. */
37
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
38
+ }
39
+ /** The path segment interface of the issue. */
40
+ export interface PathSegment {
41
+ /** The key representing a path segment. */
42
+ readonly key: PropertyKey;
43
+ }
44
+ /** The Standard Schema types interface. */
45
+ export interface Types<Input = unknown, Output = Input> {
46
+ /** The input type of the schema. */
47
+ readonly input: Input;
48
+ /** The output type of the schema. */
49
+ readonly output: Output;
50
+ }
51
+ /** Infers the input type of a Standard Schema. */
52
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
53
+ /** Infers the output type of a Standard Schema. */
54
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
55
+ export { };
56
+ }
57
+
58
+ // ==================================================================================================
59
+ // JSON Schema Draft 07
60
+ // ==================================================================================================
61
+ // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
62
+ // --------------------------------------------------------------------------------------------------
63
+
64
+ /**
65
+ * Primitive type
66
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
67
+ */
68
+ type JSONSchema7TypeName =
69
+ | "string" //
70
+ | "number"
71
+ | "integer"
72
+ | "boolean"
73
+ | "object"
74
+ | "array"
75
+ | "null";
76
+
77
+ /**
78
+ * Primitive type
79
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
80
+ */
81
+ type JSONSchema7Type =
82
+ | string //
83
+ | number
84
+ | boolean
85
+ | JSONSchema7Object
86
+ | JSONSchema7Array
87
+ | null;
88
+
89
+ // Workaround for infinite type recursion
90
+ interface JSONSchema7Object {
91
+ [key: string]: JSONSchema7Type;
92
+ }
93
+
94
+ // Workaround for infinite type recursion
95
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
96
+ interface JSONSchema7Array extends Array<JSONSchema7Type> {}
97
+
98
+ /**
99
+ * Meta schema
100
+ *
101
+ * Recommended values:
102
+ * - 'http://json-schema.org/schema#'
103
+ * - 'http://json-schema.org/hyper-schema#'
104
+ * - 'http://json-schema.org/draft-07/schema#'
105
+ * - 'http://json-schema.org/draft-07/hyper-schema#'
106
+ *
107
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
108
+ */
109
+ type JSONSchema7Version = string;
110
+
111
+ /**
112
+ * JSON Schema v7
113
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
114
+ */
115
+ type JSONSchema7Definition = JSONSchema7 | boolean;
116
+ interface JSONSchema7 {
117
+ $id?: string | undefined;
118
+ $ref?: string | undefined;
119
+ $schema?: JSONSchema7Version | undefined;
120
+ $comment?: string | undefined;
121
+
122
+ /**
123
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
124
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
125
+ */
126
+ $defs?: {
127
+ [key: string]: JSONSchema7Definition;
128
+ } | undefined;
129
+
130
+ /**
131
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
132
+ */
133
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
134
+ enum?: JSONSchema7Type[] | undefined;
135
+ const?: JSONSchema7Type | undefined;
136
+
137
+ /**
138
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
139
+ */
140
+ multipleOf?: number | undefined;
141
+ maximum?: number | undefined;
142
+ exclusiveMaximum?: number | undefined;
143
+ minimum?: number | undefined;
144
+ exclusiveMinimum?: number | undefined;
145
+
146
+ /**
147
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
148
+ */
149
+ maxLength?: number | undefined;
150
+ minLength?: number | undefined;
151
+ pattern?: string | undefined;
152
+
153
+ /**
154
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
155
+ */
156
+ items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
157
+ additionalItems?: JSONSchema7Definition | undefined;
158
+ maxItems?: number | undefined;
159
+ minItems?: number | undefined;
160
+ uniqueItems?: boolean | undefined;
161
+ contains?: JSONSchema7Definition | undefined;
162
+
163
+ /**
164
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
165
+ */
166
+ maxProperties?: number | undefined;
167
+ minProperties?: number | undefined;
168
+ required?: string[] | undefined;
169
+ properties?: {
170
+ [key: string]: JSONSchema7Definition;
171
+ } | undefined;
172
+ patternProperties?: {
173
+ [key: string]: JSONSchema7Definition;
174
+ } | undefined;
175
+ additionalProperties?: JSONSchema7Definition | undefined;
176
+ dependencies?: {
177
+ [key: string]: JSONSchema7Definition | string[];
178
+ } | undefined;
179
+ propertyNames?: JSONSchema7Definition | undefined;
180
+
181
+ /**
182
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
183
+ */
184
+ if?: JSONSchema7Definition | undefined;
185
+ then?: JSONSchema7Definition | undefined;
186
+ else?: JSONSchema7Definition | undefined;
187
+
188
+ /**
189
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
190
+ */
191
+ allOf?: JSONSchema7Definition[] | undefined;
192
+ anyOf?: JSONSchema7Definition[] | undefined;
193
+ oneOf?: JSONSchema7Definition[] | undefined;
194
+ not?: JSONSchema7Definition | undefined;
195
+
196
+ /**
197
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
198
+ */
199
+ format?: string | undefined;
200
+
201
+ /**
202
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
203
+ */
204
+ contentMediaType?: string | undefined;
205
+ contentEncoding?: string | undefined;
206
+
207
+ /**
208
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
209
+ */
210
+ definitions?: {
211
+ [key: string]: JSONSchema7Definition;
212
+ } | undefined;
213
+
214
+ /**
215
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
216
+ */
217
+ title?: string | undefined;
218
+ description?: string | undefined;
219
+ default?: JSONSchema7Type | undefined;
220
+ readOnly?: boolean | undefined;
221
+ writeOnly?: boolean | undefined;
222
+ examples?: JSONSchema7Type | undefined;
223
+ }
224
+
225
+ declare const toJsonSchema: (schema: StandardSchemaV1) => Promise<JSONSchema7>;
226
+
227
+ export { toJsonSchema };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty;var t=(a,o)=>e(a,"name",{value:o,configurable:!0});const n=t(async a=>{const o=a["~standard"].vendor;let r;switch(o){case"arktype":r=import("./arktype-ZJN3SbO2.js");break;case"valibot":r=import("./valibot-BKk6QhzV.js");break;case"zod":r=import("./zod-CcYrCVyl.js");break;default:throw new Error(`standard-json: Unsupported schema vendor "${o}"`)}return(await(await r).toJsonSchema())(a)},"toJsonSchema");export{n as toJsonSchema};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var t=(o,n)=>s(o,"name",{value:n,configurable:!0});const a=t(async()=>{try{const{toJsonSchema:o}=await import("@valibot/to-json-schema");return o}catch{throw new Error('standard-json: Missing dependencies "@valibot/to-json-schema"')}},"toJsonSchema");export{a as toJsonSchema};
@@ -0,0 +1 @@
1
+ "use strict";var r=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var e=(o,t)=>a(o,"name",{value:t,configurable:!0});var J=(o,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of i(t))!d.call(o,n)&&n!==s&&a(o,n,{get:()=>t[n],enumerable:!(c=h(t,n))||c.enumerable});return o};var S=(o,t,s)=>(s=o!=null?r(m(o)):{},J(t||!o||!o.__esModule?a(s,"default",{value:o,enumerable:!0}):s,o));const w=e(async()=>{try{const{toJsonSchema:o}=await import("@valibot/to-json-schema");return o}catch{throw new Error('standard-json: Missing dependencies "@valibot/to-json-schema"')}},"toJsonSchema");exports.toJsonSchema=w;
@@ -0,0 +1 @@
1
+ "use strict";var r=Object.create;var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var a=(o,s)=>c(o,"name",{value:s,configurable:!0});var w=(o,s,n,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of h(s))!m.call(o,t)&&t!==n&&c(o,t,{get:()=>s[t],enumerable:!(e=d(s,t))||e.enumerable});return o};var J=(o,s,n)=>(n=o!=null?r(i(o)):{},w(s||!o||!o.__esModule?c(n,"default",{value:o,enumerable:!0}):n,o));const S=a(async()=>{try{const{zodToJsonSchema:o}=await import("zod-to-json-schema");return o}catch{throw new Error('standard-json: Missing dependencies "zod-to-json-schema"')}},"toJsonSchema");exports.toJsonSchema=S;
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var n=(o,s)=>t(o,"name",{value:s,configurable:!0});const e=n(async()=>{try{const{zodToJsonSchema:o}=await import("zod-to-json-schema");return o}catch{throw new Error('standard-json: Missing dependencies "zod-to-json-schema"')}},"toJsonSchema");export{e as toJsonSchema};
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@standard-community/standard-json",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [
13
+ "standard-schema",
14
+ "standard-community",
15
+ "standard-schema-community",
16
+ "json-schema",
17
+ "convertor"
18
+ ],
19
+ "homepage": "https://github.com/standard-community",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/standard-community/standard-json.git",
26
+ "directory": "packages/core"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/standard-community/standard-json/issues"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "import": {
34
+ "types": "./dist/index.d.ts",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "require": {
38
+ "types": "./dist/index.d.cts",
39
+ "default": "./dist/index.cjs"
40
+ }
41
+ }
42
+ },
43
+ "peerDependencies": {
44
+ "@valibot/to-json-schema": "^1.0.0-rc.0",
45
+ "arktype": "^2.0.4",
46
+ "zod-to-json-schema": "^3.24.1"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "@valibot/to-json-schema": {
50
+ "optional": true
51
+ },
52
+ "arktype": {
53
+ "optional": true
54
+ },
55
+ "zod-to-json-schema": {
56
+ "optional": true
57
+ }
58
+ },
59
+ "devDependencies": {
60
+ "@standard-schema/spec": "^1.0.0",
61
+ "@types/json-schema": "^7.0.15",
62
+ "pkgroll": "^2.5.1"
63
+ },
64
+ "scripts": {
65
+ "build": "pkgroll --minify --clean-dist"
66
+ }
67
+ }