@drzl/cli 4.25.0 → 4.26.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/dist/cli.js CHANGED
@@ -22,10 +22,11 @@ import {
22
22
  mcpOutDir,
23
23
  nearestKey,
24
24
  nestjsOutDir,
25
+ nextOutDir,
25
26
  tableAliases,
26
27
  tableFilterWarnings,
27
28
  trpcOutDir
28
- } from "./chunk-J7NGXOAQ.js";
29
+ } from "./chunk-67XCOBVS.js";
29
30
 
30
31
  // src/cli.ts
31
32
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -353,6 +354,34 @@ function mcpOptions(g, cfg) {
353
354
  };
354
355
  }
355
356
 
357
+ // src/next-options.ts
358
+ var VALIDATOR_DEFAULT_DIRS = {
359
+ zod: "src/validators/zod",
360
+ valibot: "src/validators/valibot",
361
+ arktype: "src/validators/arktype"
362
+ };
363
+ function projectRelative(p) {
364
+ return p.startsWith("./") ? p.slice(2) : p;
365
+ }
366
+ function nextOptions(g, cfg) {
367
+ const library = g.validation?.library ?? "zod";
368
+ const siblings = cfg.generators.filter((s) => s.kind === library);
369
+ const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
370
+ return {
371
+ outputDir: nextOutDir(g, cfg),
372
+ naming: g.naming,
373
+ outputHeader: g.outputHeader,
374
+ format: g.format,
375
+ importExtension: g.importExtension,
376
+ validation: {
377
+ ...g.validation,
378
+ library,
379
+ useShared: true,
380
+ importPath: g.validation?.importPath ?? derived
381
+ }
382
+ };
383
+ }
384
+
356
385
  // src/nestjs-options.ts
357
386
  function nestjsOptions(g, cfg) {
358
387
  return {
@@ -421,7 +450,7 @@ function trpcOptions(g, cfg, servicesDir) {
421
450
  }
422
451
 
423
452
  // src/generator-registry.ts
424
- var VALIDATOR_DEFAULT_DIRS = {
453
+ var VALIDATOR_DEFAULT_DIRS2 = {
425
454
  zod: "src/validators/zod",
426
455
  valibot: "src/validators/valibot",
427
456
  arktype: "src/validators/arktype",
@@ -518,6 +547,15 @@ var GENERATORS = [
518
547
  outputDir: (g, cfg) => mcpOutDir(g, cfg),
519
548
  options: (g, cfg) => mcpOptions(g, cfg)
520
549
  },
550
+ {
551
+ kind: "next",
552
+ // Optional for the same reason as `mcp` above, and for the same one release only.
553
+ specifier: "@drzl/generator-next",
554
+ load: () => import("@drzl/generator-next"),
555
+ construct: (m, analysis) => new m.NextGenerator(analysis),
556
+ outputDir: (g, cfg) => nextOutDir(g, cfg),
557
+ options: (g, cfg) => nextOptions(g, cfg)
558
+ },
521
559
  {
522
560
  kind: "service",
523
561
  specifier: "@drzl/generator-service",
@@ -531,7 +569,7 @@ var GENERATORS = [
531
569
  specifier: "@drzl/generator-zod",
532
570
  load: () => import("@drzl/generator-zod"),
533
571
  construct: (m, analysis) => new m.ZodGenerator(analysis),
534
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.zod,
572
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.zod,
535
573
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
536
574
  // four rather than being passed and ignored.
537
575
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -545,7 +583,7 @@ var GENERATORS = [
545
583
  specifier: "@drzl/generator-valibot",
546
584
  load: () => import("@drzl/generator-valibot"),
547
585
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
548
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.valibot,
586
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.valibot,
549
587
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
550
588
  },
551
589
  {
@@ -553,7 +591,7 @@ var GENERATORS = [
553
591
  specifier: "@drzl/generator-arktype",
554
592
  load: () => import("@drzl/generator-arktype"),
555
593
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
556
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.arktype,
594
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.arktype,
557
595
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
558
596
  },
559
597
  {
@@ -561,7 +599,7 @@ var GENERATORS = [
561
599
  specifier: "@drzl/generator-typebox",
562
600
  load: () => import("@drzl/generator-typebox"),
563
601
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
564
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.typebox,
602
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.typebox,
565
603
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
566
604
  },
567
605
  {
@@ -569,7 +607,7 @@ var GENERATORS = [
569
607
  specifier: "@drzl/generator-effect",
570
608
  load: () => import("@drzl/generator-effect"),
571
609
  construct: (m, analysis) => new m.EffectGenerator(analysis),
572
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.effect,
610
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.effect,
573
611
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
574
612
  },
575
613
  {
@@ -577,7 +615,7 @@ var GENERATORS = [
577
615
  specifier: "@drzl/generator-json-schema",
578
616
  load: () => import("@drzl/generator-json-schema"),
579
617
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
580
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS["json-schema"],
618
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2["json-schema"],
581
619
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
582
620
  }
583
621
  ];