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

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,10 @@
1
+ import { e as errorMessageWrapper } from './index-C9VwJCyn.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ const { JSONSchema } = await import('effect').catch(() => {
5
+ throw new Error(errorMessageWrapper('Missing dependencies "effect".'));
6
+ });
7
+ return (schema) => JSONSchema.make(schema);
8
+ }
9
+
10
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-KjAKLWUk.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ const { JSONSchema } = await import('effect').catch(() => {
7
+ throw new Error(index.errorMessageWrapper('Missing dependencies "effect".'));
8
+ });
9
+ return (schema) => JSONSchema.make(schema);
10
+ }
11
+
12
+ exports.default = getToJsonSchemaFn;
@@ -1,22 +1,15 @@
1
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
2
 
10
3
  const getToJsonSchemaFn = async (vendor) => {
11
4
  switch (vendor) {
12
5
  case "arktype":
13
6
  return (await import('./arktype-DUDu5yUt.js')).default();
14
7
  case "effect":
15
- return (await import('./effect-Bvx52kW3.js')).default();
8
+ return (await import('./effect-BXKsAFl6.js')).default();
16
9
  case "valibot":
17
- return (await import('./valibot-dqIC-dYU.js')).default();
10
+ return (await import('./valibot-B7IzN3Bh.js')).default();
18
11
  case "zod":
19
- return (await import('./zod-BXV2kwOE.js')).default();
12
+ return (await import('./zod-Cq7zJ_U9.js')).default();
20
13
  default:
21
14
  throw new Error(
22
15
  errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
@@ -28,4 +21,4 @@ const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].
28
21
  (toJsonSchema2) => toJsonSchema2(schema, options)
29
22
  );
30
23
 
31
- export { toJsonSchema as a, tryImport as t };
24
+ export { errorMessageWrapper as e, toJsonSchema as t };
@@ -1,24 +1,17 @@
1
1
  'use strict';
2
2
 
3
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
4
 
12
5
  const getToJsonSchemaFn = async (vendor) => {
13
6
  switch (vendor) {
14
7
  case "arktype":
15
8
  return (await Promise.resolve().then(function () { return require('./arktype-BCitmcgd.cjs'); })).default();
16
9
  case "effect":
17
- return (await Promise.resolve().then(function () { return require('./effect-C8fjlj5o.cjs'); })).default();
10
+ return (await Promise.resolve().then(function () { return require('./effect-mqrnTEOr.cjs'); })).default();
18
11
  case "valibot":
19
- return (await Promise.resolve().then(function () { return require('./valibot-BUY58gEv.cjs'); })).default();
12
+ return (await Promise.resolve().then(function () { return require('./valibot-DoBgUS7l.cjs'); })).default();
20
13
  case "zod":
21
- return (await Promise.resolve().then(function () { return require('./zod-DfeEqb6D.cjs'); })).default();
14
+ return (await Promise.resolve().then(function () { return require('./zod-CgqyA5eu.cjs'); })).default();
22
15
  default:
23
16
  throw new Error(
24
17
  errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
@@ -30,5 +23,5 @@ const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].
30
23
  (toJsonSchema2) => toJsonSchema2(schema, options)
31
24
  );
32
25
 
26
+ exports.errorMessageWrapper = errorMessageWrapper;
33
27
  exports.toJsonSchema = toJsonSchema;
34
- exports.tryImport = tryImport;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DvrVjqKS.cjs');
3
+ var index = require('./index-KjAKLWUk.cjs');
4
4
 
5
5
 
6
6
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { a as toJsonSchema } from './index-BBK5urhS.js';
1
+ export { t as toJsonSchema } from './index-C9VwJCyn.js';
@@ -0,0 +1,12 @@
1
+ import { e as errorMessageWrapper } from './index-C9VwJCyn.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ const { toJsonSchema } = await import('@valibot/to-json-schema').catch(() => {
5
+ throw new Error(
6
+ errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
7
+ );
8
+ });
9
+ return toJsonSchema;
10
+ }
11
+
12
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-KjAKLWUk.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ const { toJsonSchema } = await import('@valibot/to-json-schema').catch(() => {
7
+ throw new Error(
8
+ index.errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
9
+ );
10
+ });
11
+ return toJsonSchema;
12
+ }
13
+
14
+ exports.default = getToJsonSchemaFn;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-KjAKLWUk.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ return async (schema, options) => {
7
+ let handler;
8
+ if ("_zod" in schema) {
9
+ handler = await import('zod/v4/core').catch(() => {
10
+ throw new Error(
11
+ index.errorMessageWrapper('Missing dependencies "zod v4".')
12
+ );
13
+ }).then((mod) => mod.toJSONSchema);
14
+ } else {
15
+ handler = await import('zod-to-json-schema').catch(() => {
16
+ throw new Error(
17
+ index.errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
18
+ );
19
+ }).then((mod) => mod.zodToJsonSchema);
20
+ }
21
+ return handler(schema, options);
22
+ };
23
+ }
24
+
25
+ exports.default = getToJsonSchemaFn;
@@ -0,0 +1,23 @@
1
+ import { e as errorMessageWrapper } from './index-C9VwJCyn.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ return async (schema, options) => {
5
+ let handler;
6
+ if ("_zod" in schema) {
7
+ handler = await import('zod/v4/core').catch(() => {
8
+ throw new Error(
9
+ errorMessageWrapper('Missing dependencies "zod v4".')
10
+ );
11
+ }).then((mod) => mod.toJSONSchema);
12
+ } else {
13
+ handler = await import('zod-to-json-schema').catch(() => {
14
+ throw new Error(
15
+ errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
16
+ );
17
+ }).then((mod) => mod.zodToJsonSchema);
18
+ }
19
+ return handler(schema, options);
20
+ };
21
+ }
22
+
23
+ export { getToJsonSchemaFn as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standard-community/standard-json",
3
- "version": "0.3.0-rc.2",
3
+ "version": "0.3.0-rc.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -1,8 +0,0 @@
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 };
@@ -1,10 +0,0 @@
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;
@@ -1,13 +0,0 @@
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;
@@ -1,11 +0,0 @@
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 };
@@ -1,22 +0,0 @@
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 };
@@ -1,24 +0,0 @@
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;