@standard-community/standard-json 0.3.0-rc.3 → 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-BHXCUs57.js')).default();
8
+ return (await import('./effect-BXKsAFl6.js')).default();
16
9
  case "valibot":
17
- return (await import('./valibot-B3sSM057.js')).default();
10
+ return (await import('./valibot-B7IzN3Bh.js')).default();
18
11
  case "zod":
19
- return (await import('./zod-6IWvQABX.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, errorMessageWrapper as e, 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-Btg6OWP3.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-D9XXvyYJ.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-P2Lea6ZA.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}".`)
@@ -32,4 +25,3 @@ const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].
32
25
 
33
26
  exports.errorMessageWrapper = errorMessageWrapper;
34
27
  exports.toJsonSchema = toJsonSchema;
35
- exports.tryImport = tryImport;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bx2xBXfI.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-BCoFb8WC.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;
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bx2xBXfI.cjs');
3
+ var index = require('./index-KjAKLWUk.cjs');
4
4
 
5
5
  async function getToJsonSchemaFn() {
6
6
  return async (schema, options) => {
7
7
  let handler;
8
8
  if ("_zod" in schema) {
9
- handler = await index.tryImport(import('zod/v4/core'), "zod v4").then(
10
- (mod) => mod.toJSONSchema
11
- );
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);
12
14
  } else {
13
15
  handler = await import('zod-to-json-schema').catch(() => {
14
16
  throw new Error(
15
17
  index.errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
16
18
  );
17
- }).then(
18
- (mod) => mod.zodToJsonSchema
19
- );
19
+ }).then((mod) => mod.zodToJsonSchema);
20
20
  }
21
21
  return handler(schema, options);
22
22
  };
@@ -1,20 +1,20 @@
1
- import { t as tryImport, e as errorMessageWrapper } from './index-BCoFb8WC.js';
1
+ import { e as errorMessageWrapper } from './index-C9VwJCyn.js';
2
2
 
3
3
  async function getToJsonSchemaFn() {
4
4
  return async (schema, options) => {
5
5
  let handler;
6
6
  if ("_zod" in schema) {
7
- handler = await tryImport(import('zod/v4/core'), "zod v4").then(
8
- (mod) => mod.toJSONSchema
9
- );
7
+ handler = await import('zod/v4/core').catch(() => {
8
+ throw new Error(
9
+ errorMessageWrapper('Missing dependencies "zod v4".')
10
+ );
11
+ }).then((mod) => mod.toJSONSchema);
10
12
  } else {
11
13
  handler = await import('zod-to-json-schema').catch(() => {
12
14
  throw new Error(
13
15
  errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
14
16
  );
15
- }).then(
16
- (mod) => mod.zodToJsonSchema
17
- );
17
+ }).then((mod) => mod.zodToJsonSchema);
18
18
  }
19
19
  return handler(schema, options);
20
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standard-community/standard-json",
3
- "version": "0.3.0-rc.3",
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-BCoFb8WC.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-Bx2xBXfI.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,11 +0,0 @@
1
- import { t as tryImport } from './index-BCoFb8WC.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,13 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-Bx2xBXfI.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;