@drzl/cli 4.25.0 → 4.27.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
@@ -4,6 +4,7 @@ import {
4
4
  ConfigValidationError,
5
5
  GENERATOR_KINDS,
6
6
  addressableName,
7
+ aiOutDir,
7
8
  ambiguousPatternWarnings,
8
9
  computeGeneratorOutputDirs,
9
10
  computeWatchTargets,
@@ -22,10 +23,11 @@ import {
22
23
  mcpOutDir,
23
24
  nearestKey,
24
25
  nestjsOutDir,
26
+ nextOutDir,
25
27
  tableAliases,
26
28
  tableFilterWarnings,
27
29
  trpcOutDir
28
- } from "./chunk-J7NGXOAQ.js";
30
+ } from "./chunk-O66F7W63.js";
29
31
 
30
32
  // src/cli.ts
31
33
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -337,6 +339,18 @@ function jsonSchemaOptions(g, cfg, outDir) {
337
339
  };
338
340
  }
339
341
 
342
+ // src/ai-options.ts
343
+ function aiOptions(g, cfg) {
344
+ return {
345
+ outputDir: aiOutDir(g, cfg),
346
+ naming: g.naming,
347
+ outputHeader: g.outputHeader,
348
+ format: g.format,
349
+ importExtension: g.importExtension,
350
+ validation: g.validation
351
+ };
352
+ }
353
+
340
354
  // src/mcp-options.ts
341
355
  function mcpOptions(g, cfg) {
342
356
  return {
@@ -353,6 +367,34 @@ function mcpOptions(g, cfg) {
353
367
  };
354
368
  }
355
369
 
370
+ // src/next-options.ts
371
+ var VALIDATOR_DEFAULT_DIRS = {
372
+ zod: "src/validators/zod",
373
+ valibot: "src/validators/valibot",
374
+ arktype: "src/validators/arktype"
375
+ };
376
+ function projectRelative(p) {
377
+ return p.startsWith("./") ? p.slice(2) : p;
378
+ }
379
+ function nextOptions(g, cfg) {
380
+ const library = g.validation?.library ?? "zod";
381
+ const siblings = cfg.generators.filter((s) => s.kind === library);
382
+ const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
383
+ return {
384
+ outputDir: nextOutDir(g, cfg),
385
+ naming: g.naming,
386
+ outputHeader: g.outputHeader,
387
+ format: g.format,
388
+ importExtension: g.importExtension,
389
+ validation: {
390
+ ...g.validation,
391
+ library,
392
+ useShared: true,
393
+ importPath: g.validation?.importPath ?? derived
394
+ }
395
+ };
396
+ }
397
+
356
398
  // src/nestjs-options.ts
357
399
  function nestjsOptions(g, cfg) {
358
400
  return {
@@ -421,7 +463,7 @@ function trpcOptions(g, cfg, servicesDir) {
421
463
  }
422
464
 
423
465
  // src/generator-registry.ts
424
- var VALIDATOR_DEFAULT_DIRS = {
466
+ var VALIDATOR_DEFAULT_DIRS2 = {
425
467
  zod: "src/validators/zod",
426
468
  valibot: "src/validators/valibot",
427
469
  arktype: "src/validators/arktype",
@@ -518,6 +560,24 @@ var GENERATORS = [
518
560
  outputDir: (g, cfg) => mcpOutDir(g, cfg),
519
561
  options: (g, cfg) => mcpOptions(g, cfg)
520
562
  },
563
+ {
564
+ kind: "next",
565
+ // Optional for the same reason as `mcp` above, and for the same one release only.
566
+ specifier: "@drzl/generator-next",
567
+ load: () => import("@drzl/generator-next"),
568
+ construct: (m, analysis) => new m.NextGenerator(analysis),
569
+ outputDir: (g, cfg) => nextOutDir(g, cfg),
570
+ options: (g, cfg) => nextOptions(g, cfg)
571
+ },
572
+ {
573
+ kind: "ai",
574
+ // Optional for the same reason as `mcp` and `next` above, and for the same one release only.
575
+ specifier: "@drzl/generator-ai",
576
+ load: () => import("@drzl/generator-ai"),
577
+ construct: (m, analysis) => new m.AIGenerator(analysis),
578
+ outputDir: (g, cfg) => aiOutDir(g, cfg),
579
+ options: (g, cfg) => aiOptions(g, cfg)
580
+ },
521
581
  {
522
582
  kind: "service",
523
583
  specifier: "@drzl/generator-service",
@@ -531,7 +591,7 @@ var GENERATORS = [
531
591
  specifier: "@drzl/generator-zod",
532
592
  load: () => import("@drzl/generator-zod"),
533
593
  construct: (m, analysis) => new m.ZodGenerator(analysis),
534
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.zod,
594
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.zod,
535
595
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
536
596
  // four rather than being passed and ignored.
537
597
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -545,7 +605,7 @@ var GENERATORS = [
545
605
  specifier: "@drzl/generator-valibot",
546
606
  load: () => import("@drzl/generator-valibot"),
547
607
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
548
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.valibot,
608
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.valibot,
549
609
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
550
610
  },
551
611
  {
@@ -553,7 +613,7 @@ var GENERATORS = [
553
613
  specifier: "@drzl/generator-arktype",
554
614
  load: () => import("@drzl/generator-arktype"),
555
615
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
556
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.arktype,
616
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.arktype,
557
617
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
558
618
  },
559
619
  {
@@ -561,7 +621,7 @@ var GENERATORS = [
561
621
  specifier: "@drzl/generator-typebox",
562
622
  load: () => import("@drzl/generator-typebox"),
563
623
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
564
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.typebox,
624
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.typebox,
565
625
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
566
626
  },
567
627
  {
@@ -569,7 +629,7 @@ var GENERATORS = [
569
629
  specifier: "@drzl/generator-effect",
570
630
  load: () => import("@drzl/generator-effect"),
571
631
  construct: (m, analysis) => new m.EffectGenerator(analysis),
572
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS.effect,
632
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.effect,
573
633
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
574
634
  },
575
635
  {
@@ -577,7 +637,7 @@ var GENERATORS = [
577
637
  specifier: "@drzl/generator-json-schema",
578
638
  load: () => import("@drzl/generator-json-schema"),
579
639
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
580
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS["json-schema"],
640
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2["json-schema"],
581
641
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
582
642
  }
583
643
  ];