@gabrielbryk/json-schema-to-zod 2.7.4 → 2.9.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/CHANGELOG.md +23 -1
- package/dist/cjs/core/analyzeSchema.js +62 -0
- package/dist/cjs/core/emitZod.js +141 -0
- package/dist/cjs/generators/generateBundle.js +355 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/jsonSchemaToZod.js +5 -73
- package/dist/cjs/parsers/parseArray.js +34 -15
- package/dist/cjs/parsers/parseIfThenElse.js +2 -1
- package/dist/cjs/parsers/parseNumber.js +81 -39
- package/dist/cjs/parsers/parseObject.js +24 -0
- package/dist/cjs/parsers/parseSchema.js +147 -25
- package/dist/cjs/parsers/parseString.js +294 -54
- package/dist/cjs/utils/buildRefRegistry.js +56 -0
- package/dist/cjs/utils/cycles.js +113 -0
- package/dist/cjs/utils/resolveUri.js +16 -0
- package/dist/cjs/utils/withMessage.js +4 -5
- package/dist/esm/core/analyzeSchema.js +58 -0
- package/dist/esm/core/emitZod.js +137 -0
- package/dist/esm/generators/generateBundle.js +351 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/jsonSchemaToZod.js +5 -73
- package/dist/esm/parsers/parseArray.js +34 -15
- package/dist/esm/parsers/parseIfThenElse.js +2 -1
- package/dist/esm/parsers/parseNumber.js +81 -39
- package/dist/esm/parsers/parseObject.js +24 -0
- package/dist/esm/parsers/parseSchema.js +147 -25
- package/dist/esm/parsers/parseString.js +294 -54
- package/dist/esm/utils/buildRefRegistry.js +52 -0
- package/dist/esm/utils/cycles.js +107 -0
- package/dist/esm/utils/resolveUri.js +12 -0
- package/dist/esm/utils/withMessage.js +4 -5
- package/dist/types/Types.d.ts +36 -0
- package/dist/types/core/analyzeSchema.d.ts +24 -0
- package/dist/types/core/emitZod.d.ts +2 -0
- package/dist/types/generators/generateBundle.d.ts +62 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/jsonSchemaToZod.d.ts +1 -1
- package/dist/types/parsers/parseSchema.d.ts +2 -1
- package/dist/types/parsers/parseString.d.ts +2 -2
- package/dist/types/utils/buildRefRegistry.d.ts +12 -0
- package/dist/types/utils/cycles.d.ts +7 -0
- package/dist/types/utils/jsdocs.d.ts +1 -1
- package/dist/types/utils/resolveUri.d.ts +1 -0
- package/dist/types/utils/withMessage.d.ts +6 -1
- package/docs/proposals/bundle-refactor.md +43 -0
- package/docs/proposals/ref-anchor-support.md +65 -0
- package/eslint.config.js +26 -0
- package/package.json +10 -4
- /package/{jest.config.js → jest.config.cjs} +0 -0
- /package/{postcjs.js → postcjs.cjs} +0 -0
- /package/{postesm.js → postesm.cjs} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { JsonSchema, Options } from "../Types.js";
|
|
2
|
+
export type SplitDefsOptions = {
|
|
3
|
+
/** Include a root schema file in addition to $defs */
|
|
4
|
+
includeRoot?: boolean;
|
|
5
|
+
/** Override file name for each schema (default: `${def}.schema.ts`) */
|
|
6
|
+
fileName?: (defName: string, ctx: {
|
|
7
|
+
isRoot: boolean;
|
|
8
|
+
}) => string;
|
|
9
|
+
/** Override exported schema const name (default: PascalCase(def) + "Schema") */
|
|
10
|
+
schemaName?: (defName: string, ctx: {
|
|
11
|
+
isRoot: boolean;
|
|
12
|
+
}) => string;
|
|
13
|
+
/** Override exported type name (default: PascalCase(def)) */
|
|
14
|
+
typeName?: (defName: string, ctx: {
|
|
15
|
+
isRoot: boolean;
|
|
16
|
+
}) => string | undefined;
|
|
17
|
+
/** Optional root schema name (defaults to provided `name` option or "RootSchema") */
|
|
18
|
+
rootName?: string;
|
|
19
|
+
/** Optional root type name (defaults to provided `type` option if string) */
|
|
20
|
+
rootTypeName?: string;
|
|
21
|
+
};
|
|
22
|
+
export type RefResolutionResult = string;
|
|
23
|
+
export type RefResolutionOptions = {
|
|
24
|
+
/** Called for each internal $ref that targets a known $def */
|
|
25
|
+
onRef?: (ctx: {
|
|
26
|
+
ref: string;
|
|
27
|
+
refName: string;
|
|
28
|
+
currentDef: string | null;
|
|
29
|
+
path: (string | number)[];
|
|
30
|
+
isCycle: boolean;
|
|
31
|
+
}) => RefResolutionResult | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* When true, cross-def references that participate in a cycle are emitted as z.lazy(() => Ref)
|
|
34
|
+
* to avoid TDZ issues across files.
|
|
35
|
+
*/
|
|
36
|
+
lazyCrossRefs?: boolean;
|
|
37
|
+
/** Called for unknown $refs (outside of $defs/definitions) */
|
|
38
|
+
onUnknownRef?: (ctx: {
|
|
39
|
+
ref: string;
|
|
40
|
+
currentDef: string | null;
|
|
41
|
+
}) => RefResolutionResult | undefined;
|
|
42
|
+
};
|
|
43
|
+
export type NestedTypesOptions = {
|
|
44
|
+
enable?: boolean;
|
|
45
|
+
fileName?: string;
|
|
46
|
+
};
|
|
47
|
+
export type GenerateBundleOptions = Options & {
|
|
48
|
+
splitDefs?: SplitDefsOptions;
|
|
49
|
+
refResolution?: RefResolutionOptions;
|
|
50
|
+
nestedTypes?: NestedTypesOptions;
|
|
51
|
+
/** Force module kind for generated files (defaults to esm) */
|
|
52
|
+
module?: "esm" | "cjs" | "none";
|
|
53
|
+
};
|
|
54
|
+
export type GeneratedFile = {
|
|
55
|
+
fileName: string;
|
|
56
|
+
contents: string;
|
|
57
|
+
};
|
|
58
|
+
export type SchemaBundleResult = {
|
|
59
|
+
files: GeneratedFile[];
|
|
60
|
+
defNames: string[];
|
|
61
|
+
};
|
|
62
|
+
export declare const generateSchemaBundle: (schema: JsonSchema, options?: GenerateBundleOptions) => SchemaBundleResult;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./Types.js";
|
|
2
|
+
export * from "./core/analyzeSchema.js";
|
|
3
|
+
export * from "./core/emitZod.js";
|
|
4
|
+
export * from "./generators/generateBundle.js";
|
|
2
5
|
export * from "./jsonSchemaToZod.js";
|
|
3
6
|
export * from "./parsers/parseAllOf.js";
|
|
4
7
|
export * from "./parsers/parseAnyOf.js";
|
|
@@ -19,9 +22,12 @@ export * from "./parsers/parseSchema.js";
|
|
|
19
22
|
export * from "./parsers/parseSimpleDiscriminatedOneOf.js";
|
|
20
23
|
export * from "./parsers/parseString.js";
|
|
21
24
|
export * from "./utils/anyOrUnknown.js";
|
|
25
|
+
export * from "./utils/buildRefRegistry.js";
|
|
26
|
+
export * from "./utils/cycles.js";
|
|
22
27
|
export * from "./utils/half.js";
|
|
23
28
|
export * from "./utils/jsdocs.js";
|
|
24
29
|
export * from "./utils/omit.js";
|
|
30
|
+
export * from "./utils/resolveUri.js";
|
|
25
31
|
export * from "./utils/withMessage.js";
|
|
26
32
|
export * from "./zodToJsonSchema.js";
|
|
27
33
|
import { jsonSchemaToZod } from "./jsonSchemaToZod.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Options, JsonSchema } from "./Types.js";
|
|
2
|
-
export declare const jsonSchemaToZod: (schema: JsonSchema,
|
|
2
|
+
export declare const jsonSchemaToZod: (schema: JsonSchema, options?: Options) => string;
|
|
@@ -29,7 +29,8 @@ export declare const its: {
|
|
|
29
29
|
not: JsonSchema;
|
|
30
30
|
};
|
|
31
31
|
ref: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
32
|
-
$ref
|
|
32
|
+
$ref?: string;
|
|
33
|
+
$dynamicRef?: string;
|
|
33
34
|
};
|
|
34
35
|
const: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
35
36
|
const: Serializable;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JsonSchema, Options } from "../Types.js";
|
|
2
|
+
export type RefRegistryEntry = {
|
|
3
|
+
schema: JsonSchema;
|
|
4
|
+
path: (string | number)[];
|
|
5
|
+
baseUri: string;
|
|
6
|
+
dynamic?: boolean;
|
|
7
|
+
anchor?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const buildRefRegistry: (schema: JsonSchema, rootBaseUri?: string, opts?: Options) => {
|
|
10
|
+
registry: Map<string, RefRegistryEntry>;
|
|
11
|
+
rootBaseUri: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JsonSchema } from "../Types.js";
|
|
2
|
+
export declare const findRefDependencies: (schema: JsonSchema | undefined, validDefNames: string[]) => Set<string>;
|
|
3
|
+
export declare const detectCycles: (defNames: string[], deps: Map<string, Set<string>>) => Set<string>;
|
|
4
|
+
export declare const computeScc: (defNames: string[], deps: Map<string, Set<string>>) => {
|
|
5
|
+
cycleMembers: Set<string>;
|
|
6
|
+
componentByName: Map<string, number>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveUri: (base: string, ref: string) => string;
|
|
@@ -2,7 +2,12 @@ import { JsonSchemaObject } from "../Types.js";
|
|
|
2
2
|
type Opener = string;
|
|
3
3
|
type MessagePrefix = string;
|
|
4
4
|
type Closer = string;
|
|
5
|
-
type Builder =
|
|
5
|
+
type Builder = {
|
|
6
|
+
opener: Opener;
|
|
7
|
+
closer: Closer;
|
|
8
|
+
messagePrefix?: MessagePrefix;
|
|
9
|
+
messageCloser?: Closer;
|
|
10
|
+
};
|
|
6
11
|
export declare function withMessage(schema: JsonSchemaObject, key: string, get: (props: {
|
|
7
12
|
value: unknown;
|
|
8
13
|
json: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Schema Bundling Refactor (Analyzer + Emitters)
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- `generateSchemaBundle` currently recurses via `parserOverride` and can overflow the stack when inline `$defs` are present (root hits immediately). Inline `$defs` inside `$defs` are also overwritten when stitching schemas.
|
|
5
|
+
- The conversion pipeline mixes concerns: parsing/analysis, code emission, and bundling strategy live together in `jsonSchemaToZod` and the bundle generator.
|
|
6
|
+
|
|
7
|
+
## Goals
|
|
8
|
+
- Single responsibility: analyze JsonSchema once, emit code through pluggable strategies (single file, bundle, nested types).
|
|
9
|
+
- Open for extension: new emitters (e.g., type-only), new ref resolution policies, without touching the analyzer.
|
|
10
|
+
- Safer bundling: no recursive parser overrides; import-aware ref resolution; preserve inline `$defs`.
|
|
11
|
+
- Testable units: analyzer IR and emitters have focused tests; bundle strategy tested with snapshots.
|
|
12
|
+
|
|
13
|
+
## Proposed Architecture
|
|
14
|
+
- **Analyzer (`analyzeSchema`)**: Convert JsonSchema + options into an intermediate representation (IR) containing symbols, ref pointer map, dependency graph, cycle info, and metadata flags. No code strings.
|
|
15
|
+
- **Emitters**:
|
|
16
|
+
- `emitZod(ir, emitOptions)`: IR → zod code (esm/cjs/none), with naming hooks and export policies.
|
|
17
|
+
- `emitTypes(ir, typeOptions)`: optional type-only exports (for nested types or barrel typing).
|
|
18
|
+
- **Strategies**:
|
|
19
|
+
- `SingleFileStrategy`: analyze root → emit zod once.
|
|
20
|
+
- `BundleStrategy`: analyze root once → slice IR per `$def` + root → emit per-file zod using an import-capable RefResolutionStrategy. Inline `$defs` remain scoped; cross-def `$ref`s become imports; unknown refs handled via policy.
|
|
21
|
+
- `NestedTypesStrategy`: walk IR titles/property paths to emit a dedicated types file.
|
|
22
|
+
- **Public API**:
|
|
23
|
+
- `analyzeSchema(schema, options): AnalysisResult`
|
|
24
|
+
- `emitZod(ir, emitOptions): string`
|
|
25
|
+
- `generateSchemaBundle(schema, bundleOptions): { files }` implemented via BundleStrategy
|
|
26
|
+
- `jsonSchemaToZod(schema, options): string` becomes a thin wrapper (analyze + emit single file).
|
|
27
|
+
|
|
28
|
+
## SOLID Alignment
|
|
29
|
+
- SRP: analyzer, emitter, strategy are separate modules.
|
|
30
|
+
- OCP: new emitters/strategies plug in without changing analyzer.
|
|
31
|
+
- LSP/ISP: narrow contracts (naming hooks, ref resolution hooks) instead of monolithic option bags.
|
|
32
|
+
- DIP: bundle strategy depends on IR abstractions, not on concrete `jsonSchemaToZod` string output.
|
|
33
|
+
|
|
34
|
+
## Migration Plan
|
|
35
|
+
1) **Foundations**: Extract analyzer + zod emitter modules; make `jsonSchemaToZod` call them. Preserve output parity and option validation. Add tests around analyzer/emitter.
|
|
36
|
+
2) **Bundle Strategy**: Rework `generateSchemaBundle` to use the analyzer IR and an import-aware ref strategy; remove recursive `parserOverride`; preserve inline `$defs` within defs.
|
|
37
|
+
3) **Nested Types**: Move nested type extraction to IR-based walker; emit via `emitTypes`.
|
|
38
|
+
4) **Cleanups & API polish**: Reduce option bag coupling; document new APIs; consider default export ergonomics.
|
|
39
|
+
|
|
40
|
+
## Risks / Mitigations
|
|
41
|
+
- Risk: Output regressions. Mitigation: snapshot tests for single-file and bundle outputs.
|
|
42
|
+
- Risk: Bundle import mapping errors. Mitigation: ref-strategy unit tests (cycles, unknown refs, cross-def).
|
|
43
|
+
- Risk: Incremental refactor churn. Mitigation: keep `jsonSchemaToZod` wrapper stable while internals shift; land in stages with tests.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Proposal: Robust `$ref` / `$id` / `$anchor` / `$dynamicRef` Support
|
|
2
|
+
|
|
3
|
+
## Goals
|
|
4
|
+
- Resolve `$ref` using full URI semantics (RFC 3986), not just `#/` pointers.
|
|
5
|
+
- Support `$id`/`$anchor`/`$dynamicAnchor`/`$dynamicRef` (and legacy `$recursiveRef/$recursiveAnchor`).
|
|
6
|
+
- Keep resolver logic in the analyzer/IR layer so emitters/strategies stay SOLID (SRP/OCP).
|
|
7
|
+
- Provide hooks for external schema resolution and unresolved-ref handling.
|
|
8
|
+
- Preserve existing `$defs`/JSON Pointer behavior for compatibility.
|
|
9
|
+
|
|
10
|
+
## Architecture alignment (with bundle refactor)
|
|
11
|
+
- Implement ref/anchor logic in the analyzer; emitters consume IR edges, not URIs.
|
|
12
|
+
- Define a pluggable `RefResolutionStrategy` used by the analyzer:
|
|
13
|
+
- Inputs: `ref`, `contextBaseUri`, `dynamicStack`, `registry`, optional `externalResolver`, `onUnresolvedRef`.
|
|
14
|
+
- Output: resolved IR node (or unresolved marker/fallback).
|
|
15
|
+
- Registry and dynamic stacks are built/maintained during analysis; IR carries resolved targets keyed by URI+fragment.
|
|
16
|
+
|
|
17
|
+
## Plan
|
|
18
|
+
|
|
19
|
+
### 1) Build a URI/anchor registry (analyzer prepass)
|
|
20
|
+
- Walk the schema once, tracking base URI (respect `$id`).
|
|
21
|
+
- Register base URI entries, `$anchor` (base#anchor), `$dynamicAnchor` (base#anchor, dynamic flag).
|
|
22
|
+
- Handle relative `$id` resolution per RFC 3986.
|
|
23
|
+
- Attach registry to IR/context.
|
|
24
|
+
|
|
25
|
+
### 2) URI-based ref resolution
|
|
26
|
+
- `resolveRef(ref, contextBaseUri, registry, dynamicStack)`:
|
|
27
|
+
- Resolve against `contextBaseUri` → absolute URI; split base/fragment.
|
|
28
|
+
- For `$dynamicRef`, search `dynamicStack` top-down for matching anchor; else fallback to registry lookup.
|
|
29
|
+
- For normal `$ref`, look up base+fragment in registry; empty fragment hits base entry.
|
|
30
|
+
- On miss: invoke `onUnresolvedRef` hook and return unresolved marker.
|
|
31
|
+
- Analyzer produces IR references keyed by resolved URI+fragment; name generation uses this key.
|
|
32
|
+
|
|
33
|
+
### 3) Thread base URI & dynamic stack in analyzer
|
|
34
|
+
- Extend analyzer traversal context (similar to Refs) with `currentBaseUri`, `dynamicAnchors`.
|
|
35
|
+
- On `$id`, compute new base; pass to children.
|
|
36
|
+
- On `$dynamicAnchor`, push onto stack for node scope; pop on exit.
|
|
37
|
+
- Emitters receive IR that already encodes resolved refs.
|
|
38
|
+
|
|
39
|
+
### 4) Legacy recursive keywords
|
|
40
|
+
- Treat `$recursiveAnchor` as a special dynamic anchor name.
|
|
41
|
+
- Treat `$recursiveRef` like `$dynamicRef` targeting that name.
|
|
42
|
+
|
|
43
|
+
### 5) External refs (optional, pluggable)
|
|
44
|
+
- Analyzer option `resolveExternalRef(uri)` (sync/async) to fetch external schemas.
|
|
45
|
+
- On external base URI miss, call resolver, prewalk and cache registry for that URI, then resolve.
|
|
46
|
+
- Guard against cycles with in-progress cache.
|
|
47
|
+
|
|
48
|
+
### 6) Naming & cycles
|
|
49
|
+
- Key ref names by resolved URI+fragment; store map in IR for consistent imports/aliases.
|
|
50
|
+
- Preserve cycle detection using these names.
|
|
51
|
+
|
|
52
|
+
### 7) Error/warning handling
|
|
53
|
+
- Option `onUnresolvedRef(uri, path)` for logging/throwing.
|
|
54
|
+
- Policy for fallback (`z.any()`/`z.unknown()` or error) lives in emitter/strategy but is driven by analyzer’s unresolved marker.
|
|
55
|
+
|
|
56
|
+
### 8) Tests
|
|
57
|
+
- Analyzer-level tests: `$id`/`$anchor` resolution (absolute/relative), `$dynamicAnchor`/`$dynamicRef` scoping, legacy recursive, external resolver stub, cycles, backward-compatible `#/` refs.
|
|
58
|
+
- Strategy/emitter tests: bundle imports for cross-file refs, naming stability with URI keys.
|
|
59
|
+
|
|
60
|
+
### 9) Migration steps
|
|
61
|
+
- Add registry prepass and URI resolver in analyzer.
|
|
62
|
+
- Thread `currentBaseUri`/`dynamicAnchors` through analysis context.
|
|
63
|
+
- Produce IR refs keyed by resolved URI; update naming map/cycle tracking.
|
|
64
|
+
- Add resolver hooks and unresolved handling.
|
|
65
|
+
- Add tests/fixtures; keep emitters unchanged except to consume new IR ref keys.
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import parser from "@typescript-eslint/parser";
|
|
2
|
+
import pluginTs from "@typescript-eslint/eslint-plugin";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
ignores: ["dist", "node_modules"],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser,
|
|
12
|
+
parserOptions: {
|
|
13
|
+
ecmaVersion: "latest",
|
|
14
|
+
sourceType: "module",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
plugins: {
|
|
18
|
+
"@typescript-eslint": pluginTs,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...pluginTs.configs.recommended.rules,
|
|
22
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
23
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gabrielbryk/json-schema-to-zod",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Converts JSON schema objects or files into Zod schemas",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"types": "./dist/types/index.d.ts",
|
|
6
7
|
"bin": "./dist/cjs/cli.js",
|
|
7
8
|
"main": "./dist/cjs/index.js",
|
|
@@ -62,9 +63,12 @@
|
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"@changesets/cli": "^2.29.8",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.49.0",
|
|
65
68
|
"@types/json-schema": "^7.0.15",
|
|
66
69
|
"@types/node": "^20.9.0",
|
|
67
70
|
"fast-diff": "^1.3.0",
|
|
71
|
+
"eslint": "^9.39.1",
|
|
68
72
|
"js-yaml": "^4.1.0",
|
|
69
73
|
"rimraf": "^5.0.5",
|
|
70
74
|
"tsx": "^4.1.1",
|
|
@@ -73,12 +77,14 @@
|
|
|
73
77
|
},
|
|
74
78
|
"scripts": {
|
|
75
79
|
"build:types": "tsc -p tsconfig.types.json",
|
|
76
|
-
"build:cjs": "tsc -p tsconfig.cjs.json && node postcjs.
|
|
77
|
-
"build:esm": "tsc -p tsconfig.esm.json && node postesm.
|
|
80
|
+
"build:cjs": "tsc -p tsconfig.cjs.json && node postcjs.cjs",
|
|
81
|
+
"build:esm": "tsc -p tsconfig.esm.json && node postesm.cjs",
|
|
78
82
|
"build": "pnpm gen && pnpm test && rimraf ./dist && pnpm build:types && pnpm build:cjs && pnpm build:esm",
|
|
79
83
|
"dry": "pnpm build && pnpm publish --dry-run",
|
|
80
84
|
"dev": "tsx watch test/index.ts",
|
|
81
85
|
"gen": "tsx ./createIndex.ts",
|
|
82
|
-
"test": "tsx test/index.ts"
|
|
86
|
+
"test": "tsx test/index.ts",
|
|
87
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" \"test/**/*.ts\"",
|
|
88
|
+
"smoke:esm": "pnpm build:esm && node --input-type=module -e \"import { jsonSchemaToZod } from './dist/esm/index.js'; console.log(jsonSchemaToZod({type:'string'}));\""
|
|
83
89
|
}
|
|
84
90
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|