@drzl/cli 4.27.0 → 4.29.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/{chunk-O66F7W63.js → chunk-WZQV2WVN.js} +59 -2
- package/dist/chunk-WZQV2WVN.js.map +1 -0
- package/dist/cli.cjs +145 -19
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +92 -19
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +60 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +39 -3
- package/dist/config.d.ts +39 -3
- package/dist/config.js +5 -1
- package/dist/drzl.config.schema.json +9 -0
- package/package.json +11 -9
- package/dist/chunk-O66F7W63.js.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -508,8 +508,10 @@ var GeneratorKindSchema = import_zod.z.enum([
|
|
|
508
508
|
"nestjs",
|
|
509
509
|
"graphql",
|
|
510
510
|
"ai",
|
|
511
|
+
"h3",
|
|
511
512
|
"mcp",
|
|
512
513
|
"next",
|
|
514
|
+
"tanstack-start",
|
|
513
515
|
"service",
|
|
514
516
|
"zod",
|
|
515
517
|
"valibot",
|
|
@@ -539,6 +541,15 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
539
541
|
* refuses that combination rather than emitting a server that dies on startup.
|
|
540
542
|
*/
|
|
541
543
|
sdk: import_zod.z.enum(["v1", "v2"]).optional(),
|
|
544
|
+
/**
|
|
545
|
+
* Which h3 major the emitted route handlers are written against. `h3` only.
|
|
546
|
+
*
|
|
547
|
+
* `v1` is the default and is what released Nitro depends on: nitropack 2.13.4 names
|
|
548
|
+
* `h3: ^1.15.11`, while h3's own `latest` tag is a 2.x release candidate. v1 has no Standard
|
|
549
|
+
* Schema overload on its validation helpers, so the emitted modules carry an adapter; v2 takes a
|
|
550
|
+
* schema directly and carries none.
|
|
551
|
+
*/
|
|
552
|
+
h3: import_zod.z.enum(["v1", "v2"]).optional(),
|
|
542
553
|
/** The name and version the emitted MCP server reports at initialize. `mcp` only. */
|
|
543
554
|
serverName: import_zod.z.string().optional(),
|
|
544
555
|
serverVersion: import_zod.z.string().optional(),
|
|
@@ -925,7 +936,17 @@ function buildConfigJsonSchema() {
|
|
|
925
936
|
properties
|
|
926
937
|
};
|
|
927
938
|
}
|
|
928
|
-
var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
939
|
+
var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
940
|
+
"orpc",
|
|
941
|
+
"trpc",
|
|
942
|
+
"hono",
|
|
943
|
+
"express",
|
|
944
|
+
"mcp",
|
|
945
|
+
"next",
|
|
946
|
+
"ai",
|
|
947
|
+
"tanstack-start",
|
|
948
|
+
"h3"
|
|
949
|
+
]);
|
|
929
950
|
var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
|
|
930
951
|
function trpcOutDir(g, cfg) {
|
|
931
952
|
return g.path ?? cfg.outDir;
|
|
@@ -954,6 +975,12 @@ function nextOutDir(g, cfg) {
|
|
|
954
975
|
function aiOutDir(g, cfg) {
|
|
955
976
|
return g.path ?? cfg.outDir;
|
|
956
977
|
}
|
|
978
|
+
function tanstackStartOutDir(g, cfg) {
|
|
979
|
+
return g.path ?? cfg.outDir;
|
|
980
|
+
}
|
|
981
|
+
function h3OutDir(g, cfg) {
|
|
982
|
+
return g.path ?? cfg.outDir;
|
|
983
|
+
}
|
|
957
984
|
function sharedSchemaNames(opts) {
|
|
958
985
|
const resolved = (0, import_validation_core.resolveAffix)(opts);
|
|
959
986
|
return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
|
|
@@ -1019,6 +1046,32 @@ function resolveConfig(cfg) {
|
|
|
1019
1046
|
}
|
|
1020
1047
|
continue;
|
|
1021
1048
|
}
|
|
1049
|
+
if (g.kind === "h3") {
|
|
1050
|
+
if (g.includeRelations) {
|
|
1051
|
+
warnings.push(
|
|
1052
|
+
`drzl config: the "h3" generator sets includeRelations, which it does not read yet. Relation lookups are a route this generator does not emit. Remove the flag.`
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
const library2 = g.validation?.library ?? "zod";
|
|
1056
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
1057
|
+
warnings.push(
|
|
1058
|
+
`drzl config: the "h3" generator validates with the schemas a validation generator writes, and this config has no "${library2}" generator for it to import from. Add { kind: "${library2}" }, or set validation.importPath to wherever those schemas live.`
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
if (g.kind === "tanstack-start") {
|
|
1063
|
+
if (g.includeRelations) {
|
|
1064
|
+
warnings.push(
|
|
1065
|
+
`drzl config: the "tanstack-start" generator sets includeRelations, which it does not read. Relation lookups are routes, and this generator emits server functions. Remove the flag.`
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
const library2 = g.validation?.library ?? "zod";
|
|
1069
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
1070
|
+
warnings.push(
|
|
1071
|
+
`drzl config: the "tanstack-start" generator validates with the schemas a validation generator writes, and this config has no "${library2}" generator for it to import from. Add { kind: "${library2}" }, or set validation.importPath to wherever those schemas live.`
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1022
1075
|
if (g.kind === "ai" && g.includeRelations) {
|
|
1023
1076
|
warnings.push(
|
|
1024
1077
|
`drzl config: the "ai" generator sets includeRelations, which it does not read. Relation lookups are routes, and this generator emits AI SDK tools rather than routes. Remove the flag.`
|
|
@@ -1196,6 +1249,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
|
|
|
1196
1249
|
if (g.kind === "mcp") dirs.add(abs(mcpOutDir(g, cfg)));
|
|
1197
1250
|
if (g.kind === "next") dirs.add(abs(nextOutDir(g, cfg)));
|
|
1198
1251
|
if (g.kind === "ai") dirs.add(abs(aiOutDir(g, cfg)));
|
|
1252
|
+
if (g.kind === "tanstack-start") dirs.add(abs(tanstackStartOutDir(g, cfg)));
|
|
1253
|
+
if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
|
|
1199
1254
|
if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
|
|
1200
1255
|
if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
|
|
1201
1256
|
if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
|
|
@@ -1392,6 +1447,35 @@ function aiOptions(g, cfg) {
|
|
|
1392
1447
|
};
|
|
1393
1448
|
}
|
|
1394
1449
|
|
|
1450
|
+
// src/h3-options.ts
|
|
1451
|
+
var VALIDATOR_DEFAULT_DIRS = {
|
|
1452
|
+
zod: "src/validators/zod",
|
|
1453
|
+
valibot: "src/validators/valibot",
|
|
1454
|
+
arktype: "src/validators/arktype"
|
|
1455
|
+
};
|
|
1456
|
+
function projectRelative(p) {
|
|
1457
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
1458
|
+
}
|
|
1459
|
+
function h3Options(g, cfg) {
|
|
1460
|
+
const library = g.validation?.library ?? "zod";
|
|
1461
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1462
|
+
const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
|
|
1463
|
+
return {
|
|
1464
|
+
outputDir: h3OutDir(g, cfg),
|
|
1465
|
+
h3: g.h3,
|
|
1466
|
+
naming: g.naming,
|
|
1467
|
+
outputHeader: g.outputHeader,
|
|
1468
|
+
format: g.format,
|
|
1469
|
+
importExtension: g.importExtension,
|
|
1470
|
+
validation: {
|
|
1471
|
+
...g.validation,
|
|
1472
|
+
library,
|
|
1473
|
+
useShared: true,
|
|
1474
|
+
importPath: g.validation?.importPath ?? derived
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1395
1479
|
// src/mcp-options.ts
|
|
1396
1480
|
function mcpOptions(g, cfg) {
|
|
1397
1481
|
return {
|
|
@@ -1409,18 +1493,18 @@ function mcpOptions(g, cfg) {
|
|
|
1409
1493
|
}
|
|
1410
1494
|
|
|
1411
1495
|
// src/next-options.ts
|
|
1412
|
-
var
|
|
1496
|
+
var VALIDATOR_DEFAULT_DIRS2 = {
|
|
1413
1497
|
zod: "src/validators/zod",
|
|
1414
1498
|
valibot: "src/validators/valibot",
|
|
1415
1499
|
arktype: "src/validators/arktype"
|
|
1416
1500
|
};
|
|
1417
|
-
function
|
|
1501
|
+
function projectRelative2(p) {
|
|
1418
1502
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1419
1503
|
}
|
|
1420
1504
|
function nextOptions(g, cfg) {
|
|
1421
1505
|
const library = g.validation?.library ?? "zod";
|
|
1422
1506
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1423
|
-
const derived = siblings.length === 1 ?
|
|
1507
|
+
const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
|
|
1424
1508
|
return {
|
|
1425
1509
|
outputDir: nextOutDir(g, cfg),
|
|
1426
1510
|
naming: g.naming,
|
|
@@ -1436,6 +1520,34 @@ function nextOptions(g, cfg) {
|
|
|
1436
1520
|
};
|
|
1437
1521
|
}
|
|
1438
1522
|
|
|
1523
|
+
// src/tanstack-start-options.ts
|
|
1524
|
+
var VALIDATOR_DEFAULT_DIRS3 = {
|
|
1525
|
+
zod: "src/validators/zod",
|
|
1526
|
+
valibot: "src/validators/valibot",
|
|
1527
|
+
arktype: "src/validators/arktype"
|
|
1528
|
+
};
|
|
1529
|
+
function projectRelative3(p) {
|
|
1530
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
1531
|
+
}
|
|
1532
|
+
function tanstackStartOptions(g, cfg) {
|
|
1533
|
+
const library = g.validation?.library ?? "zod";
|
|
1534
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1535
|
+
const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
|
|
1536
|
+
return {
|
|
1537
|
+
outputDir: tanstackStartOutDir(g, cfg),
|
|
1538
|
+
naming: g.naming,
|
|
1539
|
+
outputHeader: g.outputHeader,
|
|
1540
|
+
format: g.format,
|
|
1541
|
+
importExtension: g.importExtension,
|
|
1542
|
+
validation: {
|
|
1543
|
+
...g.validation,
|
|
1544
|
+
library,
|
|
1545
|
+
useShared: true,
|
|
1546
|
+
importPath: g.validation?.importPath ?? derived
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1439
1551
|
// src/nestjs-options.ts
|
|
1440
1552
|
function nestjsOptions(g, cfg) {
|
|
1441
1553
|
return {
|
|
@@ -1504,7 +1616,7 @@ function trpcOptions(g, cfg, servicesDir) {
|
|
|
1504
1616
|
}
|
|
1505
1617
|
|
|
1506
1618
|
// src/generator-registry.ts
|
|
1507
|
-
var
|
|
1619
|
+
var VALIDATOR_DEFAULT_DIRS4 = {
|
|
1508
1620
|
zod: "src/validators/zod",
|
|
1509
1621
|
valibot: "src/validators/valibot",
|
|
1510
1622
|
arktype: "src/validators/arktype",
|
|
@@ -1589,12 +1701,12 @@ var GENERATORS = [
|
|
|
1589
1701
|
},
|
|
1590
1702
|
{
|
|
1591
1703
|
kind: "mcp",
|
|
1592
|
-
//
|
|
1593
|
-
// has never existed cannot publish through npm's trusted-publisher OIDC flow
|
|
1594
|
-
// a hard dependency in the release that introduces it breaks `npm i @drzl/cli`
|
|
1595
|
-
// until the first publish lands.
|
|
1596
|
-
//
|
|
1597
|
-
//
|
|
1704
|
+
// This one and the three below spent one release each in `optionalDependencies`, because a
|
|
1705
|
+
// package that has never existed cannot publish through npm's trusted-publisher OIDC flow and
|
|
1706
|
+
// naming it as a hard dependency in the release that introduces it breaks `npm i @drzl/cli`
|
|
1707
|
+
// for everyone until the first publish lands. All four are on the registry now, so all four
|
|
1708
|
+
// are ordinary dependencies. `scripts/verify/stages/33-registry-deps.sh` gates both halves of
|
|
1709
|
+
// that rule and is what reported the promotion was due.
|
|
1598
1710
|
specifier: "@drzl/generator-mcp",
|
|
1599
1711
|
load: () => import("@drzl/generator-mcp"),
|
|
1600
1712
|
construct: (m, analysis) => new m.MCPGenerator(analysis),
|
|
@@ -1603,7 +1715,6 @@ var GENERATORS = [
|
|
|
1603
1715
|
},
|
|
1604
1716
|
{
|
|
1605
1717
|
kind: "next",
|
|
1606
|
-
// Optional for the same reason as `mcp` above, and for the same one release only.
|
|
1607
1718
|
specifier: "@drzl/generator-next",
|
|
1608
1719
|
load: () => import("@drzl/generator-next"),
|
|
1609
1720
|
construct: (m, analysis) => new m.NextGenerator(analysis),
|
|
@@ -1612,13 +1723,28 @@ var GENERATORS = [
|
|
|
1612
1723
|
},
|
|
1613
1724
|
{
|
|
1614
1725
|
kind: "ai",
|
|
1615
|
-
// Optional for the same reason as `mcp` and `next` above, and for the same one release only.
|
|
1616
1726
|
specifier: "@drzl/generator-ai",
|
|
1617
1727
|
load: () => import("@drzl/generator-ai"),
|
|
1618
1728
|
construct: (m, analysis) => new m.AIGenerator(analysis),
|
|
1619
1729
|
outputDir: (g, cfg) => aiOutDir(g, cfg),
|
|
1620
1730
|
options: (g, cfg) => aiOptions(g, cfg)
|
|
1621
1731
|
},
|
|
1732
|
+
{
|
|
1733
|
+
kind: "tanstack-start",
|
|
1734
|
+
specifier: "@drzl/generator-tanstack-start",
|
|
1735
|
+
load: () => import("@drzl/generator-tanstack-start"),
|
|
1736
|
+
construct: (m, analysis) => new m.TanStackStartGenerator(analysis),
|
|
1737
|
+
outputDir: (g, cfg) => tanstackStartOutDir(g, cfg),
|
|
1738
|
+
options: (g, cfg) => tanstackStartOptions(g, cfg)
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
kind: "h3",
|
|
1742
|
+
specifier: "@drzl/generator-h3",
|
|
1743
|
+
load: () => import("@drzl/generator-h3"),
|
|
1744
|
+
construct: (m, analysis) => new m.H3Generator(analysis),
|
|
1745
|
+
outputDir: (g, cfg) => h3OutDir(g, cfg),
|
|
1746
|
+
options: (g, cfg) => h3Options(g, cfg)
|
|
1747
|
+
},
|
|
1622
1748
|
{
|
|
1623
1749
|
kind: "service",
|
|
1624
1750
|
specifier: "@drzl/generator-service",
|
|
@@ -1632,7 +1758,7 @@ var GENERATORS = [
|
|
|
1632
1758
|
specifier: "@drzl/generator-zod",
|
|
1633
1759
|
load: () => import("@drzl/generator-zod"),
|
|
1634
1760
|
construct: (m, analysis) => new m.ZodGenerator(analysis),
|
|
1635
|
-
outputDir: (g) => g.path ??
|
|
1761
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4.zod,
|
|
1636
1762
|
// `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
|
|
1637
1763
|
// four rather than being passed and ignored.
|
|
1638
1764
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
|
|
@@ -1646,7 +1772,7 @@ var GENERATORS = [
|
|
|
1646
1772
|
specifier: "@drzl/generator-valibot",
|
|
1647
1773
|
load: () => import("@drzl/generator-valibot"),
|
|
1648
1774
|
construct: (m, analysis) => new m.ValibotGenerator(analysis),
|
|
1649
|
-
outputDir: (g) => g.path ??
|
|
1775
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4.valibot,
|
|
1650
1776
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
|
|
1651
1777
|
},
|
|
1652
1778
|
{
|
|
@@ -1654,7 +1780,7 @@ var GENERATORS = [
|
|
|
1654
1780
|
specifier: "@drzl/generator-arktype",
|
|
1655
1781
|
load: () => import("@drzl/generator-arktype"),
|
|
1656
1782
|
construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
|
|
1657
|
-
outputDir: (g) => g.path ??
|
|
1783
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4.arktype,
|
|
1658
1784
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
|
|
1659
1785
|
},
|
|
1660
1786
|
{
|
|
@@ -1662,7 +1788,7 @@ var GENERATORS = [
|
|
|
1662
1788
|
specifier: "@drzl/generator-typebox",
|
|
1663
1789
|
load: () => import("@drzl/generator-typebox"),
|
|
1664
1790
|
construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
|
|
1665
|
-
outputDir: (g) => g.path ??
|
|
1791
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4.typebox,
|
|
1666
1792
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
|
|
1667
1793
|
},
|
|
1668
1794
|
{
|
|
@@ -1670,7 +1796,7 @@ var GENERATORS = [
|
|
|
1670
1796
|
specifier: "@drzl/generator-effect",
|
|
1671
1797
|
load: () => import("@drzl/generator-effect"),
|
|
1672
1798
|
construct: (m, analysis) => new m.EffectGenerator(analysis),
|
|
1673
|
-
outputDir: (g) => g.path ??
|
|
1799
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4.effect,
|
|
1674
1800
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
|
|
1675
1801
|
},
|
|
1676
1802
|
{
|
|
@@ -1678,7 +1804,7 @@ var GENERATORS = [
|
|
|
1678
1804
|
specifier: "@drzl/generator-json-schema",
|
|
1679
1805
|
load: () => import("@drzl/generator-json-schema"),
|
|
1680
1806
|
construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
|
|
1681
|
-
outputDir: (g) => g.path ??
|
|
1807
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS4["json-schema"],
|
|
1682
1808
|
options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
|
|
1683
1809
|
}
|
|
1684
1810
|
];
|