@drzl/cli 4.26.0 → 4.28.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,
@@ -25,8 +26,9 @@ import {
25
26
  nextOutDir,
26
27
  tableAliases,
27
28
  tableFilterWarnings,
29
+ tanstackStartOutDir,
28
30
  trpcOutDir
29
- } from "./chunk-67XCOBVS.js";
31
+ } from "./chunk-WS3MT5CH.js";
30
32
 
31
33
  // src/cli.ts
32
34
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -338,6 +340,18 @@ function jsonSchemaOptions(g, cfg, outDir) {
338
340
  };
339
341
  }
340
342
 
343
+ // src/ai-options.ts
344
+ function aiOptions(g, cfg) {
345
+ return {
346
+ outputDir: aiOutDir(g, cfg),
347
+ naming: g.naming,
348
+ outputHeader: g.outputHeader,
349
+ format: g.format,
350
+ importExtension: g.importExtension,
351
+ validation: g.validation
352
+ };
353
+ }
354
+
341
355
  // src/mcp-options.ts
342
356
  function mcpOptions(g, cfg) {
343
357
  return {
@@ -382,6 +396,34 @@ function nextOptions(g, cfg) {
382
396
  };
383
397
  }
384
398
 
399
+ // src/tanstack-start-options.ts
400
+ var VALIDATOR_DEFAULT_DIRS2 = {
401
+ zod: "src/validators/zod",
402
+ valibot: "src/validators/valibot",
403
+ arktype: "src/validators/arktype"
404
+ };
405
+ function projectRelative2(p) {
406
+ return p.startsWith("./") ? p.slice(2) : p;
407
+ }
408
+ function tanstackStartOptions(g, cfg) {
409
+ const library = g.validation?.library ?? "zod";
410
+ const siblings = cfg.generators.filter((s) => s.kind === library);
411
+ const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
412
+ return {
413
+ outputDir: tanstackStartOutDir(g, cfg),
414
+ naming: g.naming,
415
+ outputHeader: g.outputHeader,
416
+ format: g.format,
417
+ importExtension: g.importExtension,
418
+ validation: {
419
+ ...g.validation,
420
+ library,
421
+ useShared: true,
422
+ importPath: g.validation?.importPath ?? derived
423
+ }
424
+ };
425
+ }
426
+
385
427
  // src/nestjs-options.ts
386
428
  function nestjsOptions(g, cfg) {
387
429
  return {
@@ -450,7 +492,7 @@ function trpcOptions(g, cfg, servicesDir) {
450
492
  }
451
493
 
452
494
  // src/generator-registry.ts
453
- var VALIDATOR_DEFAULT_DIRS2 = {
495
+ var VALIDATOR_DEFAULT_DIRS3 = {
454
496
  zod: "src/validators/zod",
455
497
  valibot: "src/validators/valibot",
456
498
  arktype: "src/validators/arktype",
@@ -556,6 +598,24 @@ var GENERATORS = [
556
598
  outputDir: (g, cfg) => nextOutDir(g, cfg),
557
599
  options: (g, cfg) => nextOptions(g, cfg)
558
600
  },
601
+ {
602
+ kind: "ai",
603
+ // Optional for the same reason as `mcp` and `next` above, and for the same one release only.
604
+ specifier: "@drzl/generator-ai",
605
+ load: () => import("@drzl/generator-ai"),
606
+ construct: (m, analysis) => new m.AIGenerator(analysis),
607
+ outputDir: (g, cfg) => aiOutDir(g, cfg),
608
+ options: (g, cfg) => aiOptions(g, cfg)
609
+ },
610
+ {
611
+ kind: "tanstack-start",
612
+ // Optional for the same reason as the three above, and for the same one release only.
613
+ specifier: "@drzl/generator-tanstack-start",
614
+ load: () => import("@drzl/generator-tanstack-start"),
615
+ construct: (m, analysis) => new m.TanStackStartGenerator(analysis),
616
+ outputDir: (g, cfg) => tanstackStartOutDir(g, cfg),
617
+ options: (g, cfg) => tanstackStartOptions(g, cfg)
618
+ },
559
619
  {
560
620
  kind: "service",
561
621
  specifier: "@drzl/generator-service",
@@ -569,7 +629,7 @@ var GENERATORS = [
569
629
  specifier: "@drzl/generator-zod",
570
630
  load: () => import("@drzl/generator-zod"),
571
631
  construct: (m, analysis) => new m.ZodGenerator(analysis),
572
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.zod,
632
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.zod,
573
633
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
574
634
  // four rather than being passed and ignored.
575
635
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -583,7 +643,7 @@ var GENERATORS = [
583
643
  specifier: "@drzl/generator-valibot",
584
644
  load: () => import("@drzl/generator-valibot"),
585
645
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
586
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.valibot,
646
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.valibot,
587
647
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
588
648
  },
589
649
  {
@@ -591,7 +651,7 @@ var GENERATORS = [
591
651
  specifier: "@drzl/generator-arktype",
592
652
  load: () => import("@drzl/generator-arktype"),
593
653
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
594
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.arktype,
654
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.arktype,
595
655
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
596
656
  },
597
657
  {
@@ -599,7 +659,7 @@ var GENERATORS = [
599
659
  specifier: "@drzl/generator-typebox",
600
660
  load: () => import("@drzl/generator-typebox"),
601
661
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
602
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.typebox,
662
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.typebox,
603
663
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
604
664
  },
605
665
  {
@@ -607,7 +667,7 @@ var GENERATORS = [
607
667
  specifier: "@drzl/generator-effect",
608
668
  load: () => import("@drzl/generator-effect"),
609
669
  construct: (m, analysis) => new m.EffectGenerator(analysis),
610
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2.effect,
670
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3.effect,
611
671
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
612
672
  },
613
673
  {
@@ -615,7 +675,7 @@ var GENERATORS = [
615
675
  specifier: "@drzl/generator-json-schema",
616
676
  load: () => import("@drzl/generator-json-schema"),
617
677
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
618
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS2["json-schema"],
678
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS3["json-schema"],
619
679
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
620
680
  }
621
681
  ];