@standard-community/standard-json 0.3.0-rc.1 → 0.3.0-rc.2

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.
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ return (schema, options) => schema.toJsonSchema(options);
5
+ }
6
+
7
+ exports.default = getToJsonSchemaFn;
@@ -0,0 +1,5 @@
1
+ async function getToJsonSchemaFn() {
2
+ return (schema, options) => schema.toJsonSchema(options);
3
+ }
4
+
5
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,8 @@
1
+ import { t as tryImport } from './index-BBK5urhS.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ const { JSONSchema } = await tryImport(import('effect'), "effect");
5
+ return (schema) => JSONSchema.make(schema);
6
+ }
7
+
8
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DvrVjqKS.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ const { JSONSchema } = await index.tryImport(import('effect'), "effect");
7
+ return (schema) => JSONSchema.make(schema);
8
+ }
9
+
10
+ exports.default = getToJsonSchemaFn;
@@ -0,0 +1,31 @@
1
+ const errorMessageWrapper = (message) => `standard-json: ${message}`;
2
+ const tryImport = async (result, name) => {
3
+ try {
4
+ return await result;
5
+ } catch {
6
+ throw new Error(errorMessageWrapper(`Missing dependencies "${name}".`));
7
+ }
8
+ };
9
+
10
+ const getToJsonSchemaFn = async (vendor) => {
11
+ switch (vendor) {
12
+ case "arktype":
13
+ return (await import('./arktype-DUDu5yUt.js')).default();
14
+ case "effect":
15
+ return (await import('./effect-Bvx52kW3.js')).default();
16
+ case "valibot":
17
+ return (await import('./valibot-dqIC-dYU.js')).default();
18
+ case "zod":
19
+ return (await import('./zod-BXV2kwOE.js')).default();
20
+ default:
21
+ throw new Error(
22
+ errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
23
+ );
24
+ }
25
+ };
26
+
27
+ const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
28
+ (toJsonSchema2) => toJsonSchema2(schema, options)
29
+ );
30
+
31
+ export { toJsonSchema as a, tryImport as t };
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const errorMessageWrapper = (message) => `standard-json: ${message}`;
4
+ const tryImport = async (result, name) => {
5
+ try {
6
+ return await result;
7
+ } catch {
8
+ throw new Error(errorMessageWrapper(`Missing dependencies "${name}".`));
9
+ }
10
+ };
11
+
12
+ const getToJsonSchemaFn = async (vendor) => {
13
+ switch (vendor) {
14
+ case "arktype":
15
+ return (await Promise.resolve().then(function () { return require('./arktype-BCitmcgd.cjs'); })).default();
16
+ case "effect":
17
+ return (await Promise.resolve().then(function () { return require('./effect-C8fjlj5o.cjs'); })).default();
18
+ case "valibot":
19
+ return (await Promise.resolve().then(function () { return require('./valibot-BUY58gEv.cjs'); })).default();
20
+ case "zod":
21
+ return (await Promise.resolve().then(function () { return require('./zod-DfeEqb6D.cjs'); })).default();
22
+ default:
23
+ throw new Error(
24
+ errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
25
+ );
26
+ }
27
+ };
28
+
29
+ const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
30
+ (toJsonSchema2) => toJsonSchema2(schema, options)
31
+ );
32
+
33
+ exports.toJsonSchema = toJsonSchema;
34
+ exports.tryImport = tryImport;
package/dist/index.cjs CHANGED
@@ -1,63 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const getToJsonSchemaFn$4 = async () => (schema, options) => schema.toJsonSchema(options);
3
+ var index = require('./index-DvrVjqKS.cjs');
4
4
 
5
- const errorMessageWrapper = (message) => `standard-json: ${message}`;
6
- const tryImport = async (result, name) => {
7
- try {
8
- return await result;
9
- } catch {
10
- throw new Error(errorMessageWrapper(`Missing dependencies "${name}".`));
11
- }
12
- };
13
5
 
14
- const getToJsonSchemaFn$3 = async () => {
15
- const { JSONSchema } = await tryImport(import('effect'), "effect");
16
- return (schema) => JSONSchema.make(schema);
17
- };
18
6
 
19
- const getToJsonSchemaFn$2 = async () => {
20
- const { toJsonSchema } = await tryImport(
21
- import('@valibot/to-json-schema'),
22
- "@valibot/to-json-schema"
23
- );
24
- return (schema, options) => toJsonSchema(
25
- schema,
26
- options
27
- );
28
- };
29
-
30
- const getToJsonSchemaFn$1 = async () => async (schema, options) => {
31
- let handler;
32
- if ("_zod" in schema) {
33
- handler = await tryImport(import('zod/v4/core'), "zod v4").then(
34
- (mod) => mod.toJSONSchema
35
- );
36
- } else {
37
- handler = await tryImport(import('zod-to-json-schema'), "zod v3").then(
38
- (mod) => mod.zodToJsonSchema
39
- );
40
- }
41
- return handler(schema, options);
42
- };
43
-
44
- const vendorToFn = {
45
- arktype: getToJsonSchemaFn$4,
46
- effect: getToJsonSchemaFn$3,
47
- valibot: getToJsonSchemaFn$2,
48
- zod: getToJsonSchemaFn$1
49
- };
50
- const getToJsonSchemaFn = (vendor) => {
51
- const vendorConverter = vendorToFn[vendor];
52
- if (!vendorConverter)
53
- throw new Error(
54
- errorMessageWrapper(`Unsupported schema vendor "${vendor}"`)
55
- );
56
- return vendorConverter();
57
- };
58
-
59
- const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
60
- (toJsonSchema2) => toJsonSchema2(schema, options)
61
- );
62
-
63
- exports.toJsonSchema = toJsonSchema;
7
+ exports.toJsonSchema = index.toJsonSchema;
package/dist/index.js CHANGED
@@ -1,61 +1 @@
1
- const getToJsonSchemaFn$4 = async () => (schema, options) => schema.toJsonSchema(options);
2
-
3
- const errorMessageWrapper = (message) => `standard-json: ${message}`;
4
- const tryImport = async (result, name) => {
5
- try {
6
- return await result;
7
- } catch {
8
- throw new Error(errorMessageWrapper(`Missing dependencies "${name}".`));
9
- }
10
- };
11
-
12
- const getToJsonSchemaFn$3 = async () => {
13
- const { JSONSchema } = await tryImport(import('effect'), "effect");
14
- return (schema) => JSONSchema.make(schema);
15
- };
16
-
17
- const getToJsonSchemaFn$2 = async () => {
18
- const { toJsonSchema } = await tryImport(
19
- import('@valibot/to-json-schema'),
20
- "@valibot/to-json-schema"
21
- );
22
- return (schema, options) => toJsonSchema(
23
- schema,
24
- options
25
- );
26
- };
27
-
28
- const getToJsonSchemaFn$1 = async () => async (schema, options) => {
29
- let handler;
30
- if ("_zod" in schema) {
31
- handler = await tryImport(import('zod/v4/core'), "zod v4").then(
32
- (mod) => mod.toJSONSchema
33
- );
34
- } else {
35
- handler = await tryImport(import('zod-to-json-schema'), "zod v3").then(
36
- (mod) => mod.zodToJsonSchema
37
- );
38
- }
39
- return handler(schema, options);
40
- };
41
-
42
- const vendorToFn = {
43
- arktype: getToJsonSchemaFn$4,
44
- effect: getToJsonSchemaFn$3,
45
- valibot: getToJsonSchemaFn$2,
46
- zod: getToJsonSchemaFn$1
47
- };
48
- const getToJsonSchemaFn = (vendor) => {
49
- const vendorConverter = vendorToFn[vendor];
50
- if (!vendorConverter)
51
- throw new Error(
52
- errorMessageWrapper(`Unsupported schema vendor "${vendor}"`)
53
- );
54
- return vendorConverter();
55
- };
56
-
57
- const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
58
- (toJsonSchema2) => toJsonSchema2(schema, options)
59
- );
60
-
61
- export { toJsonSchema };
1
+ export { a as toJsonSchema } from './index-BBK5urhS.js';
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DvrVjqKS.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ const { toJsonSchema } = await index.tryImport(
7
+ import('@valibot/to-json-schema'),
8
+ "@valibot/to-json-schema"
9
+ );
10
+ return toJsonSchema;
11
+ }
12
+
13
+ exports.default = getToJsonSchemaFn;
@@ -0,0 +1,11 @@
1
+ import { t as tryImport } from './index-BBK5urhS.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ const { toJsonSchema } = await tryImport(
5
+ import('@valibot/to-json-schema'),
6
+ "@valibot/to-json-schema"
7
+ );
8
+ return toJsonSchema;
9
+ }
10
+
11
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,22 @@
1
+ import { t as tryImport } from './index-BBK5urhS.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ return async (schema, options) => {
5
+ let handler;
6
+ if ("_zod" in schema) {
7
+ handler = await tryImport(import('zod/v4/core'), "zod v4").then(
8
+ (mod) => mod.toJSONSchema
9
+ );
10
+ } else {
11
+ handler = await tryImport(
12
+ import('zod-to-json-schema'),
13
+ "zod-to-json-schema"
14
+ ).then(
15
+ (mod) => mod.zodToJsonSchema
16
+ );
17
+ }
18
+ return handler(schema, options);
19
+ };
20
+ }
21
+
22
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DvrVjqKS.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ return async (schema, options) => {
7
+ let handler;
8
+ if ("_zod" in schema) {
9
+ handler = await index.tryImport(import('zod/v4/core'), "zod v4").then(
10
+ (mod) => mod.toJSONSchema
11
+ );
12
+ } else {
13
+ handler = await index.tryImport(
14
+ import('zod-to-json-schema'),
15
+ "zod-to-json-schema"
16
+ ).then(
17
+ (mod) => mod.zodToJsonSchema
18
+ );
19
+ }
20
+ return handler(schema, options);
21
+ };
22
+ }
23
+
24
+ exports.default = getToJsonSchemaFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standard-community/standard-json",
3
- "version": "0.3.0-rc.1",
3
+ "version": "0.3.0-rc.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -45,7 +45,7 @@
45
45
  "arktype": "^2.1.20",
46
46
  "effect": "^3.16.8",
47
47
  "valibot": "^1.1.0",
48
- "zod": "^3.25.67",
48
+ "zod": "^3.25.0 || ^4.0.0",
49
49
  "zod-to-json-schema": "^3.24.5"
50
50
  },
51
51
  "peerDependenciesMeta": {