@power-plant/schema 0.0.27 → 0.0.29
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/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.mts +1 -1
- package/dist/index.cjs +12 -7
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +13 -8
- package/dist/{types-BMC57p-g.d.mts → types--ig4SQ4Y.d.cts} +6 -2
- package/dist/{types-BhEdUeyR.d.cts.map → types--ig4SQ4Y.d.cts.map} +1 -1
- package/dist/{types-BhEdUeyR.d.cts → types-CINa5E2f.d.mts} +6 -2
- package/dist/types-CINa5E2f.d.mts.map +1 -0
- package/dist/valibot.d.cts +1 -1
- package/dist/valibot.d.mts +1 -1
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.mts +1 -1
- package/package.json +4 -4
- package/dist/types-BMC57p-g.d.mts.map +0 -1
package/dist/codegen.d.cts
CHANGED
package/dist/codegen.d.mts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ let _stryke_hash = require("@stryke/hash");
|
|
|
12
12
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
13
13
|
let _stryke_json = require("@stryke/json");
|
|
14
14
|
let _stryke_path_find = require("@stryke/path/find");
|
|
15
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
15
16
|
let _stryke_resolve_constants = require("@stryke/resolve/constants");
|
|
16
17
|
let _stryke_resolve_load = require("@stryke/resolve/load");
|
|
17
18
|
let _stryke_string_format_list = require("@stryke/string-format/list");
|
|
@@ -213,16 +214,15 @@ function resolveCompilerOptions(system, tsconfig, fs) {
|
|
|
213
214
|
delete options.declarationMap;
|
|
214
215
|
return options;
|
|
215
216
|
}
|
|
216
|
-
function createProgramFromFileSystem(
|
|
217
|
-
const projectRoot = options.cwd ?? (0,
|
|
218
|
-
const createSystem = _typescript_vfs.createFSBackedSystem;
|
|
217
|
+
function createProgramFromFileSystem(file, options) {
|
|
218
|
+
const projectRoot = options.cwd ?? (0, _stryke_path_find.findFilePath)(file);
|
|
219
219
|
const createHost = _typescript_vfs.createVirtualCompilerHost;
|
|
220
|
-
const system =
|
|
220
|
+
const system = (0, _typescript_vfs.createFSBackedSystem)(/* @__PURE__ */ new Map(), projectRoot, typescript.default);
|
|
221
221
|
if (options.fs) bindFileSystemToSystem(system, options.fs);
|
|
222
222
|
const compilerOptions = resolveCompilerOptions(system, options.tsconfig, options.fs);
|
|
223
223
|
const { compilerHost } = createHost(system, compilerOptions, typescript.default);
|
|
224
224
|
return typescript.default.createProgram({
|
|
225
|
-
rootNames: [
|
|
225
|
+
rootNames: [file],
|
|
226
226
|
options: compilerOptions,
|
|
227
227
|
host: compilerHost
|
|
228
228
|
});
|
|
@@ -562,6 +562,7 @@ async function extractTSType(input, options = {}) {
|
|
|
562
562
|
const exportName = fileReference.export ?? "*";
|
|
563
563
|
const resolvedPath = await (0, _stryke_fs_resolve.resolveSafe)(fileReference.file, { fs: options.fs });
|
|
564
564
|
const filePath = resolvedPath || fileReference.file;
|
|
565
|
+
const tsconfig = options.tsconfig ? (0, _stryke_path_replace.replacePath)(options.tsconfig, options.cwd || process.cwd()) : void 0;
|
|
565
566
|
try {
|
|
566
567
|
return (0, ts_json_schema_generator_dist_factory_generator_js.createGenerator)({
|
|
567
568
|
path: filePath,
|
|
@@ -571,8 +572,12 @@ async function extractTSType(input, options = {}) {
|
|
|
571
572
|
markdownDescription: true,
|
|
572
573
|
fullDescription: true,
|
|
573
574
|
skipTypeCheck: true,
|
|
574
|
-
tsProgram: createProgramFromFileSystem(filePath,
|
|
575
|
-
|
|
575
|
+
tsProgram: createProgramFromFileSystem(filePath, {
|
|
576
|
+
...options,
|
|
577
|
+
tsconfig
|
|
578
|
+
}),
|
|
579
|
+
...options,
|
|
580
|
+
tsconfig
|
|
576
581
|
}).createSchema(exportName);
|
|
577
582
|
} catch (error) {
|
|
578
583
|
throw new Error(`Failed to generate a JSON schema for "${fileReference.file}"${resolvedPath && resolvedPath !== fileReference.file ? ` (resolved: ${resolvedPath})` : ""} using the type "${exportName}". Error: ${error.message}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SchemaSourceVariant, A as JsonSchemaNumberFormat, B as JsonSchemaString, C as JsonSchemaMap, D as JsonSchemaNull, E as JsonSchemaNever, F as JsonSchemaRecord, G as JsonSchemaUnion, H as JsonSchemaTuple, I as JsonSchemaRecordPropertyNames, J as SchemaConfigVariant, K as JsonSchemaUnknown, L as JsonSchemaRef, M as JsonSchemaOf, N as JsonSchemaPrimitiveType, O as JsonSchemaNullable, P as JsonSchemaPrimitiveUnion, Q as SchemaSourceConfig, R as JsonSchemaSchemaSource, S as JsonSchemaLogicKeywords, T as JsonSchemaNativeEnum, U as JsonSchemaType, V as JsonSchemaStringFormat, W as JsonSchemaUndefined, X as SchemaEnvelopeOf, Y as SchemaEnvelope, Z as SchemaSource, _ as JsonSchemaInteger, a as JsonSchema, at as ValibotSchema, b as JsonSchemaLike, c as JsonSchemaAnyOf, ct as JSON_SCHEMA_METADATA_KEYS, d as JsonSchemaBoolean, dt as JsonSchemaTypeNames, et as SpecOf, f as JsonSchemaConditionalKeywords, ft as SCHEMA_ARRAY_CONCAT_KEYWORDS, g as JsonSchemaEnum, h as JsonSchemaDecimalFormat, i as InferExtractOptions, it as UntypedSchemaSource, j as JsonSchemaObject, k as JsonSchemaNumber, l as JsonSchemaArray, lt as JSON_SCHEMA_PRIMITIVE_TYPES, m as JsonSchemaDecimal, mt as SCHEMA_SINGLE_KEYWORDS, n as BaseSchemaSource, nt as UntypedConfigObject, o as JsonSchemaAllOf, ot as ValibotSchemaSource, p as JsonSchemaDate, pt as SCHEMA_RECORD_KEYWORDS, q as SchemaConfig, r as ExtractedSchemaEnvelope, rt as UntypedSchema, s as JsonSchemaAny, st as Zod3SchemaSource, t as BaseExtractOptions, tt as StandardSchemaSchemaSource, u as JsonSchemaBigint, ut as JSON_SCHEMA_TYPES, v as JsonSchemaIntegerFormat, w as JsonSchemaMetadataKeywords, x as JsonSchemaLiteral, y as JsonSchemaKeywords, z as JsonSchemaSet } from "./types
|
|
1
|
+
import { $ as SchemaSourceVariant, A as JsonSchemaNumberFormat, B as JsonSchemaString, C as JsonSchemaMap, D as JsonSchemaNull, E as JsonSchemaNever, F as JsonSchemaRecord, G as JsonSchemaUnion, H as JsonSchemaTuple, I as JsonSchemaRecordPropertyNames, J as SchemaConfigVariant, K as JsonSchemaUnknown, L as JsonSchemaRef, M as JsonSchemaOf, N as JsonSchemaPrimitiveType, O as JsonSchemaNullable, P as JsonSchemaPrimitiveUnion, Q as SchemaSourceConfig, R as JsonSchemaSchemaSource, S as JsonSchemaLogicKeywords, T as JsonSchemaNativeEnum, U as JsonSchemaType, V as JsonSchemaStringFormat, W as JsonSchemaUndefined, X as SchemaEnvelopeOf, Y as SchemaEnvelope, Z as SchemaSource, _ as JsonSchemaInteger, a as JsonSchema, at as ValibotSchema, b as JsonSchemaLike, c as JsonSchemaAnyOf, ct as JSON_SCHEMA_METADATA_KEYS, d as JsonSchemaBoolean, dt as JsonSchemaTypeNames, et as SpecOf, f as JsonSchemaConditionalKeywords, ft as SCHEMA_ARRAY_CONCAT_KEYWORDS, g as JsonSchemaEnum, h as JsonSchemaDecimalFormat, i as InferExtractOptions, it as UntypedSchemaSource, j as JsonSchemaObject, k as JsonSchemaNumber, l as JsonSchemaArray, lt as JSON_SCHEMA_PRIMITIVE_TYPES, m as JsonSchemaDecimal, mt as SCHEMA_SINGLE_KEYWORDS, n as BaseSchemaSource, nt as UntypedConfigObject, o as JsonSchemaAllOf, ot as ValibotSchemaSource, p as JsonSchemaDate, pt as SCHEMA_RECORD_KEYWORDS, q as SchemaConfig, r as ExtractedSchemaEnvelope, rt as UntypedSchema, s as JsonSchemaAny, st as Zod3SchemaSource, t as BaseExtractOptions, tt as StandardSchemaSchemaSource, u as JsonSchemaBigint, ut as JSON_SCHEMA_TYPES, v as JsonSchemaIntegerFormat, w as JsonSchemaMetadataKeywords, x as JsonSchemaLiteral, y as JsonSchemaKeywords, z as JsonSchemaSet } from "./types--ig4SQ4Y.cjs";
|
|
2
2
|
import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./index-ldf5lukz.cjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
import { InferLoadOptions } from "@stryke/resolve/types";
|
|
@@ -92,6 +92,7 @@ declare function extractSource(variant: SchemaSourceVariant, input: SchemaSource
|
|
|
92
92
|
*/
|
|
93
93
|
declare function extractTSType(input: FileReferenceInput, options?: InferLoadOptions<typeof input> & {
|
|
94
94
|
tsconfig?: string;
|
|
95
|
+
cwd?: string;
|
|
95
96
|
}): Promise<JsonSchema>;
|
|
96
97
|
/**
|
|
97
98
|
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator) to obtain the actual schema definition before extraction.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAwGgB,yBACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBAqHc,6BACd,MAAM,YACN,UAAU,YACV;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAwGgB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;;iBAsEI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAmB5C,oBACd,iBACC,SAAS;;;;;;;iBAUI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAkB5C,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgB1C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqB3C,gBACd,iBACC,SAAS;;;;;;;;;;iBA0BI,aAAa,iBAAiB,SAAS;;;;;;;;;;iBAsCvC,qBAAqB,iBAAiB,SAAS;;;;;;;;;;iBAa/C,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBAyD1C,sBAAsB,iBAAiB,SAAS;;;;;;;;;;iBAahD,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBA0B1C,sBACd,iBACC,SAAS;;;;;;;iBAuBI,SAAS,iBAAiB,SAAS;;;;;;;iBAkBnC,WAAW,OACzB,iBACC,SAAS,iBAAiB;;;;;;;iBAUb,mBAAmB,iBAAiB,SAAS;;;;;;;iBAiB7C,eACd,iBACC,SAAS,eAAe"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SchemaSourceVariant, A as JsonSchemaNumberFormat, B as JsonSchemaString, C as JsonSchemaMap, D as JsonSchemaNull, E as JsonSchemaNever, F as JsonSchemaRecord, G as JsonSchemaUnion, H as JsonSchemaTuple, I as JsonSchemaRecordPropertyNames, J as SchemaConfigVariant, K as JsonSchemaUnknown, L as JsonSchemaRef, M as JsonSchemaOf, N as JsonSchemaPrimitiveType, O as JsonSchemaNullable, P as JsonSchemaPrimitiveUnion, Q as SchemaSourceConfig, R as JsonSchemaSchemaSource, S as JsonSchemaLogicKeywords, T as JsonSchemaNativeEnum, U as JsonSchemaType, V as JsonSchemaStringFormat, W as JsonSchemaUndefined, X as SchemaEnvelopeOf, Y as SchemaEnvelope, Z as SchemaSource, _ as JsonSchemaInteger, a as JsonSchema, at as ValibotSchema, b as JsonSchemaLike, c as JsonSchemaAnyOf, ct as JSON_SCHEMA_METADATA_KEYS, d as JsonSchemaBoolean, dt as JsonSchemaTypeNames, et as SpecOf, f as JsonSchemaConditionalKeywords, ft as SCHEMA_ARRAY_CONCAT_KEYWORDS, g as JsonSchemaEnum, h as JsonSchemaDecimalFormat, i as InferExtractOptions, it as UntypedSchemaSource, j as JsonSchemaObject, k as JsonSchemaNumber, l as JsonSchemaArray, lt as JSON_SCHEMA_PRIMITIVE_TYPES, m as JsonSchemaDecimal, mt as SCHEMA_SINGLE_KEYWORDS, n as BaseSchemaSource, nt as UntypedConfigObject, o as JsonSchemaAllOf, ot as ValibotSchemaSource, p as JsonSchemaDate, pt as SCHEMA_RECORD_KEYWORDS, q as SchemaConfig, r as ExtractedSchemaEnvelope, rt as UntypedSchema, s as JsonSchemaAny, st as Zod3SchemaSource, t as BaseExtractOptions, tt as StandardSchemaSchemaSource, u as JsonSchemaBigint, ut as JSON_SCHEMA_TYPES, v as JsonSchemaIntegerFormat, w as JsonSchemaMetadataKeywords, x as JsonSchemaLiteral, y as JsonSchemaKeywords, z as JsonSchemaSet } from "./types-
|
|
1
|
+
import { $ as SchemaSourceVariant, A as JsonSchemaNumberFormat, B as JsonSchemaString, C as JsonSchemaMap, D as JsonSchemaNull, E as JsonSchemaNever, F as JsonSchemaRecord, G as JsonSchemaUnion, H as JsonSchemaTuple, I as JsonSchemaRecordPropertyNames, J as SchemaConfigVariant, K as JsonSchemaUnknown, L as JsonSchemaRef, M as JsonSchemaOf, N as JsonSchemaPrimitiveType, O as JsonSchemaNullable, P as JsonSchemaPrimitiveUnion, Q as SchemaSourceConfig, R as JsonSchemaSchemaSource, S as JsonSchemaLogicKeywords, T as JsonSchemaNativeEnum, U as JsonSchemaType, V as JsonSchemaStringFormat, W as JsonSchemaUndefined, X as SchemaEnvelopeOf, Y as SchemaEnvelope, Z as SchemaSource, _ as JsonSchemaInteger, a as JsonSchema, at as ValibotSchema, b as JsonSchemaLike, c as JsonSchemaAnyOf, ct as JSON_SCHEMA_METADATA_KEYS, d as JsonSchemaBoolean, dt as JsonSchemaTypeNames, et as SpecOf, f as JsonSchemaConditionalKeywords, ft as SCHEMA_ARRAY_CONCAT_KEYWORDS, g as JsonSchemaEnum, h as JsonSchemaDecimalFormat, i as InferExtractOptions, it as UntypedSchemaSource, j as JsonSchemaObject, k as JsonSchemaNumber, l as JsonSchemaArray, lt as JSON_SCHEMA_PRIMITIVE_TYPES, m as JsonSchemaDecimal, mt as SCHEMA_SINGLE_KEYWORDS, n as BaseSchemaSource, nt as UntypedConfigObject, o as JsonSchemaAllOf, ot as ValibotSchemaSource, p as JsonSchemaDate, pt as SCHEMA_RECORD_KEYWORDS, q as SchemaConfig, r as ExtractedSchemaEnvelope, rt as UntypedSchema, s as JsonSchemaAny, st as Zod3SchemaSource, t as BaseExtractOptions, tt as StandardSchemaSchemaSource, u as JsonSchemaBigint, ut as JSON_SCHEMA_TYPES, v as JsonSchemaIntegerFormat, w as JsonSchemaMetadataKeywords, x as JsonSchemaLiteral, y as JsonSchemaKeywords, z as JsonSchemaSet } from "./types-CINa5E2f.mjs";
|
|
2
2
|
import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./index-C7q4X7Bo.mjs";
|
|
3
3
|
import { BaseSchema } from "valibot";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -92,6 +92,7 @@ declare function extractSource(variant: SchemaSourceVariant, input: SchemaSource
|
|
|
92
92
|
*/
|
|
93
93
|
declare function extractTSType(input: FileReferenceInput, options?: InferLoadOptions<typeof input> & {
|
|
94
94
|
tsconfig?: string;
|
|
95
|
+
cwd?: string;
|
|
95
96
|
}): Promise<JsonSchema>;
|
|
96
97
|
/**
|
|
97
98
|
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator) to obtain the actual schema definition before extraction.
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,8 @@ import { resolveSafe } from "@stryke/fs/resolve";
|
|
|
9
9
|
import { murmurhash } from "@stryke/hash";
|
|
10
10
|
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
11
11
|
import { isStandardJsonSchema } from "@stryke/json";
|
|
12
|
-
import { findFileExtensionSafe } from "@stryke/path/find";
|
|
12
|
+
import { findFileExtensionSafe, findFilePath } from "@stryke/path/find";
|
|
13
|
+
import { replacePath } from "@stryke/path/replace";
|
|
13
14
|
import { VALID_OBJECT_SOURCE_EXTENSIONS } from "@stryke/resolve/constants";
|
|
14
15
|
import { loadSafe } from "@stryke/resolve/load";
|
|
15
16
|
import { list } from "@stryke/string-format/list";
|
|
@@ -210,16 +211,15 @@ function resolveCompilerOptions(system, tsconfig, fs) {
|
|
|
210
211
|
delete options.declarationMap;
|
|
211
212
|
return options;
|
|
212
213
|
}
|
|
213
|
-
function createProgramFromFileSystem(
|
|
214
|
-
const projectRoot = options.cwd ??
|
|
215
|
-
const createSystem = createFSBackedSystem;
|
|
214
|
+
function createProgramFromFileSystem(file, options) {
|
|
215
|
+
const projectRoot = options.cwd ?? findFilePath(file);
|
|
216
216
|
const createHost = createVirtualCompilerHost;
|
|
217
|
-
const system =
|
|
217
|
+
const system = createFSBackedSystem(/* @__PURE__ */ new Map(), projectRoot, ts);
|
|
218
218
|
if (options.fs) bindFileSystemToSystem(system, options.fs);
|
|
219
219
|
const compilerOptions = resolveCompilerOptions(system, options.tsconfig, options.fs);
|
|
220
220
|
const { compilerHost } = createHost(system, compilerOptions, ts);
|
|
221
221
|
return ts.createProgram({
|
|
222
|
-
rootNames: [
|
|
222
|
+
rootNames: [file],
|
|
223
223
|
options: compilerOptions,
|
|
224
224
|
host: compilerHost
|
|
225
225
|
});
|
|
@@ -559,6 +559,7 @@ async function extractTSType(input, options = {}) {
|
|
|
559
559
|
const exportName = fileReference.export ?? "*";
|
|
560
560
|
const resolvedPath = await resolveSafe(fileReference.file, { fs: options.fs });
|
|
561
561
|
const filePath = resolvedPath || fileReference.file;
|
|
562
|
+
const tsconfig = options.tsconfig ? replacePath(options.tsconfig, options.cwd || process.cwd()) : void 0;
|
|
562
563
|
try {
|
|
563
564
|
return createGenerator({
|
|
564
565
|
path: filePath,
|
|
@@ -568,8 +569,12 @@ async function extractTSType(input, options = {}) {
|
|
|
568
569
|
markdownDescription: true,
|
|
569
570
|
fullDescription: true,
|
|
570
571
|
skipTypeCheck: true,
|
|
571
|
-
tsProgram: createProgramFromFileSystem(filePath,
|
|
572
|
-
|
|
572
|
+
tsProgram: createProgramFromFileSystem(filePath, {
|
|
573
|
+
...options,
|
|
574
|
+
tsconfig
|
|
575
|
+
}),
|
|
576
|
+
...options,
|
|
577
|
+
tsconfig
|
|
573
578
|
}).createSchema(exportName);
|
|
574
579
|
} catch (error) {
|
|
575
580
|
throw new Error(`Failed to generate a JSON schema for "${fileReference.file}"${resolvedPath && resolvedPath !== fileReference.file ? ` (resolved: ${resolvedPath})` : ""} using the type "${exportName}". Error: ${error.message}`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseIssue, BaseSchema } from "valibot";
|
|
2
1
|
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
3
2
|
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
4
3
|
import { Config } from "ts-json-schema-generator/dist/src/Config.js";
|
|
5
4
|
import { Storage } from "unstorage";
|
|
6
5
|
import { InputObject, Schema } from "untyped";
|
|
6
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
7
7
|
import * as z3 from "zod/v3";
|
|
8
8
|
//#region src/constants.d.ts
|
|
9
9
|
declare const JsonSchemaTypeNames: {
|
|
@@ -1209,6 +1209,10 @@ type BaseExtractOptions = {
|
|
|
1209
1209
|
* An optional storage instance to use for caching schema extraction results. If provided, the storage instance will be used to store and retrieve cached schema extraction results, which can improve performance by avoiding redundant schema extraction operations. If not provided, the default storage mechanism will be used.
|
|
1210
1210
|
*/
|
|
1211
1211
|
storage?: Storage;
|
|
1212
|
+
/**
|
|
1213
|
+
* An optional working directory to use for resolving file references. If provided, the working directory will be used to resolve file references, which can improve performance by avoiding redundant file resolution operations. If not provided, the current working directory will be used.
|
|
1214
|
+
*/
|
|
1215
|
+
cwd?: string;
|
|
1212
1216
|
} & Omit<Config, "path" | "type">;
|
|
1213
1217
|
type InferExtractOptions<T extends SchemaConfig> = (T extends LoadReference ? Omit<InferLoadOptions<T>, "fs"> : {}) & BaseExtractOptions;
|
|
1214
1218
|
/**
|
|
@@ -1333,4 +1337,4 @@ declare module "zod" {
|
|
|
1333
1337
|
}
|
|
1334
1338
|
//#endregion
|
|
1335
1339
|
export { SchemaSourceVariant as $, JsonSchemaNumberFormat as A, JsonSchemaString as B, JsonSchemaMap as C, JsonSchemaNull as D, JsonSchemaNever as E, JsonSchemaRecord as F, JsonSchemaUnion as G, JsonSchemaTuple as H, JsonSchemaRecordPropertyNames as I, SchemaConfigVariant as J, JsonSchemaUnknown as K, JsonSchemaRef as L, JsonSchemaOf as M, JsonSchemaPrimitiveType as N, JsonSchemaNullable as O, JsonSchemaPrimitiveUnion as P, SchemaSourceConfig as Q, JsonSchemaSchemaSource as R, JsonSchemaLogicKeywords as S, JsonSchemaNativeEnum as T, JsonSchemaType as U, JsonSchemaStringFormat as V, JsonSchemaUndefined as W, SchemaEnvelopeOf as X, SchemaEnvelope as Y, SchemaSource as Z, JsonSchemaInteger as _, JsonSchema as a, ValibotSchema as at, JsonSchemaLike as b, JsonSchemaAnyOf as c, JSON_SCHEMA_METADATA_KEYS as ct, JsonSchemaBoolean as d, JsonSchemaTypeNames as dt, SpecOf as et, JsonSchemaConditionalKeywords as f, SCHEMA_ARRAY_CONCAT_KEYWORDS as ft, JsonSchemaEnum as g, JsonSchemaDecimalFormat as h, InferExtractOptions as i, UntypedSchemaSource as it, JsonSchemaObject as j, JsonSchemaNumber as k, JsonSchemaArray as l, JSON_SCHEMA_PRIMITIVE_TYPES as lt, JsonSchemaDecimal as m, SCHEMA_SINGLE_KEYWORDS as mt, BaseSchemaSource as n, UntypedConfigObject as nt, JsonSchemaAllOf as o, ValibotSchemaSource as ot, JsonSchemaDate as p, SCHEMA_RECORD_KEYWORDS as pt, SchemaConfig as q, ExtractedSchemaEnvelope as r, UntypedSchema as rt, JsonSchemaAny as s, Zod3SchemaSource as st, BaseExtractOptions as t, StandardSchemaSchemaSource as tt, JsonSchemaBigint as u, JSON_SCHEMA_TYPES as ut, JsonSchemaIntegerFormat as v, JsonSchemaMetadataKeywords as w, JsonSchemaLiteral as x, JsonSchemaKeywords as y, JsonSchemaSet as z };
|
|
1336
|
-
//# sourceMappingURL=types
|
|
1340
|
+
//# sourceMappingURL=types--ig4SQ4Y.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types
|
|
1
|
+
{"version":3,"file":"types--ig4SQ4Y.d.cts","names":[],"sources":["../src/constants.ts","../src/types.ts"],"mappings":";;;;;;;;cAoBa;;;;;;;;;cAUA;cAQA;cAMA;;;;;cA8BA,wBAAsB;;;;;cAYtB,wBAAsB;;;;;cAiBtB,8BAA4B;;;;;;;;KClE7B,kCACF;;;;;;KAOE,yBAAyB;;;;KAKzB;;;;KAaA;;;;KAKA,yBACV,0BAA0B;;;;KAKhB;;;;;;UA6BK;;;;;;;EAOf;;;;;;;EAQA;;;;;;;EAWA,cAAc;;;;;;;EAQd;;;;;;EAOA;;;;;;;;;EAUA,QAAQ,eAAe;;;;;;;;EASvB;;;;;;;EAQA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;IACc;IAAe;IAAsB;;;;;EAMnD;;;;EAKA;;;;EAKA;IAGM;IAAkB;IAAgB;;;;;EAKxC;;;;EAKA;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EAKA;;;;;;;;UASe;;;;;;;;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BAAmB,SACnB,eAAe,aAAa;KAEpB;;;;EAIV,UAAU;;;;EAKV;IACE,KAAK;KAEG,oBAAoB,UAAU,iBACvC,UAAU,gBACP,KAAK,iBAAiB,kBAGxB;;;;UAKa,eAAe,oBAAoB,aAAa;;;;EAI/D;;;;EAKA,SAAS;;;;EAKT,QAAQ;;;;;;;;;KAUE,iBAAiB,SAAS,eAAe,aAAa;;;;UAKjD,iBAAiB;;EAEhC;;EAGA,SAAS;;EAGT,QAAQ,mBAAmB;;;;;UAMZ,uBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,aAAa;;;;;UAMN,2BACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,qBAAqB;;;;;UAMd,iBAAiB,qBAAqB,iBAAiB;;EAEtE;;EAGA,QAAQ,GAAG,QAAQ;;;;;UAMJ,oBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,sBAAsB;;;;;UAMf,oBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,cAAc;;;;;KAMZ,aAAa,eACrB,uBAAuB,SACvB,2BAA2B,SAC3B,iBAAiB,SACjB,oBAAoB,SACpB,oBAAoB;;;;UAKP,wBACf,qBACQ,iBAAiB;;;;EAIzB,QAAQ,aAAa;;;YAIX;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;MACc;MAAe;MAAsB;;IACnD;IACA;IACA;IACA;IACA;KACC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
1
2
|
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
2
3
|
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
3
4
|
import { Config } from "ts-json-schema-generator/dist/src/Config.js";
|
|
4
5
|
import { Storage } from "unstorage";
|
|
5
6
|
import { InputObject, Schema } from "untyped";
|
|
6
|
-
import { BaseIssue, BaseSchema } from "valibot";
|
|
7
7
|
import * as z3 from "zod/v3";
|
|
8
8
|
//#region src/constants.d.ts
|
|
9
9
|
declare const JsonSchemaTypeNames: {
|
|
@@ -1209,6 +1209,10 @@ type BaseExtractOptions = {
|
|
|
1209
1209
|
* An optional storage instance to use for caching schema extraction results. If provided, the storage instance will be used to store and retrieve cached schema extraction results, which can improve performance by avoiding redundant schema extraction operations. If not provided, the default storage mechanism will be used.
|
|
1210
1210
|
*/
|
|
1211
1211
|
storage?: Storage;
|
|
1212
|
+
/**
|
|
1213
|
+
* An optional working directory to use for resolving file references. If provided, the working directory will be used to resolve file references, which can improve performance by avoiding redundant file resolution operations. If not provided, the current working directory will be used.
|
|
1214
|
+
*/
|
|
1215
|
+
cwd?: string;
|
|
1212
1216
|
} & Omit<Config, "path" | "type">;
|
|
1213
1217
|
type InferExtractOptions<T extends SchemaConfig> = (T extends LoadReference ? Omit<InferLoadOptions<T>, "fs"> : {}) & BaseExtractOptions;
|
|
1214
1218
|
/**
|
|
@@ -1333,4 +1337,4 @@ declare module "zod" {
|
|
|
1333
1337
|
}
|
|
1334
1338
|
//#endregion
|
|
1335
1339
|
export { SchemaSourceVariant as $, JsonSchemaNumberFormat as A, JsonSchemaString as B, JsonSchemaMap as C, JsonSchemaNull as D, JsonSchemaNever as E, JsonSchemaRecord as F, JsonSchemaUnion as G, JsonSchemaTuple as H, JsonSchemaRecordPropertyNames as I, SchemaConfigVariant as J, JsonSchemaUnknown as K, JsonSchemaRef as L, JsonSchemaOf as M, JsonSchemaPrimitiveType as N, JsonSchemaNullable as O, JsonSchemaPrimitiveUnion as P, SchemaSourceConfig as Q, JsonSchemaSchemaSource as R, JsonSchemaLogicKeywords as S, JsonSchemaNativeEnum as T, JsonSchemaType as U, JsonSchemaStringFormat as V, JsonSchemaUndefined as W, SchemaEnvelopeOf as X, SchemaEnvelope as Y, SchemaSource as Z, JsonSchemaInteger as _, JsonSchema as a, ValibotSchema as at, JsonSchemaLike as b, JsonSchemaAnyOf as c, JSON_SCHEMA_METADATA_KEYS as ct, JsonSchemaBoolean as d, JsonSchemaTypeNames as dt, SpecOf as et, JsonSchemaConditionalKeywords as f, SCHEMA_ARRAY_CONCAT_KEYWORDS as ft, JsonSchemaEnum as g, JsonSchemaDecimalFormat as h, InferExtractOptions as i, UntypedSchemaSource as it, JsonSchemaObject as j, JsonSchemaNumber as k, JsonSchemaArray as l, JSON_SCHEMA_PRIMITIVE_TYPES as lt, JsonSchemaDecimal as m, SCHEMA_SINGLE_KEYWORDS as mt, BaseSchemaSource as n, UntypedConfigObject as nt, JsonSchemaAllOf as o, ValibotSchemaSource as ot, JsonSchemaDate as p, SCHEMA_RECORD_KEYWORDS as pt, SchemaConfig as q, ExtractedSchemaEnvelope as r, UntypedSchema as rt, JsonSchemaAny as s, Zod3SchemaSource as st, BaseExtractOptions as t, StandardSchemaSchemaSource as tt, JsonSchemaBigint as u, JSON_SCHEMA_TYPES as ut, JsonSchemaIntegerFormat as v, JsonSchemaMetadataKeywords as w, JsonSchemaLiteral as x, JsonSchemaKeywords as y, JsonSchemaSet as z };
|
|
1336
|
-
//# sourceMappingURL=types-
|
|
1340
|
+
//# sourceMappingURL=types-CINa5E2f.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CINa5E2f.d.mts","names":[],"sources":["../src/constants.ts","../src/types.ts"],"mappings":""}
|
package/dist/valibot.d.cts
CHANGED
package/dist/valibot.d.mts
CHANGED
package/dist/zod.d.cts
CHANGED
package/dist/zod.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Power Plant utility package to help managing schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
"untyped": "^1.5.2"
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
145
|
+
"@powerlines/plugin-tsdown": "^0.1.554",
|
|
146
146
|
"@types/node": "^25.9.5",
|
|
147
|
-
"powerlines": "^0.47.
|
|
147
|
+
"powerlines": "^0.47.153",
|
|
148
148
|
"valibot": "^1.4.2",
|
|
149
149
|
"zod": "^4.4.3"
|
|
150
150
|
},
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"zod": { "optional": true }
|
|
158
158
|
},
|
|
159
159
|
"publishConfig": { "access": "public" },
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "1f782a6d68196b61f197e9834bf476e1d77dde54"
|
|
161
161
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-BMC57p-g.d.mts","names":[],"sources":["../src/constants.ts","../src/types.ts"],"mappings":""}
|