@metaobjectsdev/codegen-ts 0.7.0-rc.12 → 0.7.0-rc.13

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.
@@ -14,35 +14,40 @@
14
14
  import { existsSync, readFileSync } from "node:fs";
15
15
  import { join, resolve, dirname } from "node:path";
16
16
  import { fileURLToPath } from "node:url";
17
- /** Walk up from `start` until we find a `package.json` (i.e., the codegen-ts
18
- * package root), then return `<pkg-root>/templates`. Works the same way
19
- * from `src/render-engine/framework-provider.ts` (during dev) and
20
- * `dist/render-engine/framework-provider.js` (after `npm install`) because
21
- * in both cases we shipped at the package root. */
17
+ /** Canonical shipped template used to verify a candidate framework
18
+ * templates directory actually contains our defaults. Without this check a
19
+ * hoisted-install layout (pnpm/bun workspaces) can walk up to a CONSUMER
20
+ * package.json and silently return a templates dir that doesn't exist. */
21
+ const CANONICAL_TEMPLATE_REL = "docs/entity-page.md.mustache";
22
+ /** Walk up from `start` until we find a `package.json` whose neighbour
23
+ * `templates/` directory contains our canonical shipped template (i.e., the
24
+ * codegen-ts package root). Works the same way from
25
+ * `src/render-engine/framework-provider.ts` (during dev) and
26
+ * `dist/render-engine/framework-provider.js` (after `npm install`). */
22
27
  function findFrameworkTemplatesDir(start) {
23
28
  let dir = start;
24
- for (let i = 0; i < 12; i++) {
29
+ while (true) {
25
30
  const pkgJson = join(dir, "package.json");
26
31
  if (existsSync(pkgJson)) {
27
- return join(dir, "templates");
32
+ const templatesDir = join(dir, "templates");
33
+ // Assert we landed at the codegen-ts package root, not a consumer's.
34
+ if (existsSync(join(templatesDir, CANONICAL_TEMPLATE_REL))) {
35
+ return templatesDir;
36
+ }
28
37
  }
29
38
  const parent = dirname(dir);
30
39
  if (parent === dir)
31
40
  break;
32
41
  dir = parent;
33
42
  }
34
- // Last resort caller will get an unresolved-ref error when it tries to
35
- // use a framework template that isn't on disk.
36
- return join(start, "templates");
43
+ throw new Error(`framework templates dir unresolved: walked up from ${start} without finding a package.json ` +
44
+ `whose templates/${CANONICAL_TEMPLATE_REL} exists. This usually means codegen-ts was installed ` +
45
+ `via a hoisted layout (pnpm/bun workspaces) into an unexpected location, or the published ` +
46
+ `tarball is missing the templates/ directory.`);
37
47
  }
38
- const SELF_DIR = (() => {
39
- try {
40
- return dirname(fileURLToPath(import.meta.url));
41
- }
42
- catch {
43
- return process.cwd();
44
- }
45
- })();
48
+ // In ESM (CLAUDE.md: "ESM only. No CommonJS."), `import.meta.url` is
49
+ // guaranteed to be a file: URL; no defensive try/catch needed.
50
+ const SELF_DIR = dirname(fileURLToPath(import.meta.url));
46
51
  const FRAMEWORK_TEMPLATES_DIR = findFrameworkTemplatesDir(SELF_DIR);
47
52
  /** Provider backed by an arbitrary on-disk template directory. References
48
53
  * resolve as `<dir>/<ref>.mustache`. Used by both the framework default
@@ -1 +1 @@
1
- {"version":3,"file":"framework-provider.js","sourceRoot":"","sources":["../../src/render-engine/framework-provider.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,EAAE;AACF,0EAA0E;AAC1E,+DAA+D;AAC/D,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,kEAAkE;AAClE,2DAA2D;AAG3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;oDAIoD;AACpD,SAAS,yBAAyB,CAAC,KAAa;IAC9C,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC1C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C/D,OAAO,CAAC,GAAW;QACjB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;QACtC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAED;;4EAE4E;AAC5E,MAAM,UAAU,eAAe,CAAC,WAAoB;IAClD,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,0BAA0B,CAAC;IACjE,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,0BAA0B,CAAC;IAClE,OAAO,IAAI,aAAa,CAAC;QACvB,IAAI,kBAAkB,CAAC,aAAa,CAAC;QACrC,0BAA0B;KAC3B,CAAC,CAAC;AACL,CAAC;AAED;qDACqD;AACrD,MAAM,CAAC,MAAM,+BAA+B,GAAG,uBAAuB,CAAC"}
1
+ {"version":3,"file":"framework-provider.js","sourceRoot":"","sources":["../../src/render-engine/framework-provider.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,EAAE;AACF,0EAA0E;AAC1E,+DAA+D;AAC/D,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,kEAAkE;AAClE,2DAA2D;AAG3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;2EAG2E;AAC3E,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAE9D;;;;wEAIwE;AACxE,SAAS,yBAAyB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KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;gDAC4C;IAC5C,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CA0LpE"}
package/dist/runner.js CHANGED
@@ -118,6 +118,7 @@ export async function runGen(opts) {
118
118
  outputLayout: selfTarget.outputLayout,
119
119
  },
120
120
  renderContext,
121
+ ...(projectRoot !== undefined && { projectRoot }),
121
122
  warn: (msg) => warnings.push(`[${generator.name}] ${msg}`),
122
123
  };
123
124
  let files;
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,cAAc,GAIf,MAAM,uBAAuB,CAAC;AAE/B;kFACkF;AAClF,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AA8BrD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAgB;IAC3C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,IAAI,WAAW,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC;IAC5C,yEAAyE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kB,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,0EAA0E;QAC1E,uEAAuE;QACvE,wEAAwE;QACxE,mDAAmD;QACnD,MAAM,UAAU,GAAuD;YACrE,QAAQ;YACR,WAAW;YACX,QAAQ;SACT,CAAC;QACF,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACvE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,QAAQ,CAAC,IAAI,CACX,qBAAqB,IAAI,CAAC,QAAQ,qCAAqC;gBACvE,4CAA4C,CAC7C,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,QAAQ,CAAC,IAAI,CACX,wBAAwB,IAAI,CAAC,QAAQ,2CAA2C;gBAChF,2EAA2E,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/codegen-ts",
3
- "version": "0.7.0-rc.12",
3
+ "version": "0.7.0-rc.13",
4
4
  "description": "TypeScript codegen engine for MetaObjects — emits Drizzle, Zod, and Fastify artifacts.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,8 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@metaobjectsdev/metadata": "0.7.0-rc.12",
42
- "@metaobjectsdev/render": "0.7.0-rc.12",
41
+ "@metaobjectsdev/metadata": "0.7.0-rc.13",
42
+ "@metaobjectsdev/render": "0.7.0-rc.13",
43
43
  "@biomejs/js-api": "^0.7.0",
44
44
  "@biomejs/wasm-nodejs": "^1.9.4",
45
45
  "ts-poet": "^6.10.0"
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@biomejs/biome": "^1.9.0",
53
- "@metaobjectsdev/codegen-ts-react": "0.7.0-rc.12",
53
+ "@metaobjectsdev/codegen-ts-react": "0.7.0-rc.13",
54
54
  "bun-types": "latest",
55
55
  "drizzle-orm": "^0.36.0",
56
56
  "hono": "^4.6.0",
package/src/generator.ts CHANGED
@@ -24,6 +24,15 @@ export interface GenContext {
24
24
  * present at run time when invoked via runGen(); optional in the type
25
25
  * so tests and custom callers don't need a placeholder. */
26
26
  renderContext?: RenderContext;
27
+ /** Resolved absolute project root — what the runner derives from
28
+ * `opts.projectRoot` (the directory holding `.metaobjects/config.json`).
29
+ * Generators that resolve project-scoped resources (e.g.
30
+ * `templateGenerator` looking up the project's `templates/` directory)
31
+ * should read this rather than `process.cwd()`, which is whatever
32
+ * directory the CLI was invoked from and breaks when `meta gen` runs
33
+ * in a sub-directory. Undefined only when the runner was driven
34
+ * programmatically without an explicit projectRoot. */
35
+ projectRoot?: string;
27
36
  warn: (msg: string) => void;
28
37
  }
29
38
 
@@ -7,6 +7,7 @@ import {
7
7
  type MetaObject,
8
8
  type MetaField,
9
9
  type MetaIdentity,
10
+ type MetaReferenceIdentity,
10
11
  type MetaRoot,
11
12
  TYPE_TEMPLATE,
12
13
  TEMPLATE_ATTR_PAYLOAD_REF,
@@ -188,36 +189,37 @@ function constraintsCell(
188
189
  }
189
190
  }
190
191
 
192
+ // Walk validators once, bucket by subtype. We re-emit in the original
193
+ // emission order to preserve byte-identity with the docs-file-basic
194
+ // conformance fixture: regex pattern → maxLength-from-@maxLength →
195
+ // length-validator (min/max) → numeric-validator (min/max).
196
+ const maxLenAttr = field.ownAttr(FIELD_ATTR_MAX_LENGTH);
197
+ const regexParts: string[] = [];
198
+ const lengthParts: string[] = [];
199
+ const numericParts: string[] = [];
191
200
  for (const v of field.validators()) {
192
201
  if (v.subType === VALIDATOR_SUBTYPE_REGEX) {
193
202
  const pattern = v.ownAttr(VALIDATOR_ATTR_PATTERN);
194
203
  if (typeof pattern === "string" && pattern.length > 0) {
195
- parts.push(`pattern \`${pattern}\``);
204
+ regexParts.push(`pattern \`${pattern}\``);
196
205
  }
197
- }
198
- }
199
-
200
- const maxLenAttr = field.ownAttr(FIELD_ATTR_MAX_LENGTH);
201
- if (typeof maxLenAttr === "number") {
202
- parts.push(`maxLength: ${maxLenAttr}`);
203
- }
204
- for (const v of field.validators()) {
205
- if (v.subType === VALIDATOR_SUBTYPE_LENGTH) {
206
+ } else if (v.subType === VALIDATOR_SUBTYPE_LENGTH) {
206
207
  const min = v.ownAttr(VALIDATOR_ATTR_MIN);
207
208
  const max = v.ownAttr(VALIDATOR_ATTR_MAX);
208
- if (typeof min === "number") parts.push(`minLength: ${min}`);
209
- if (typeof max === "number" && typeof maxLenAttr !== "number") parts.push(`maxLength: ${max}`);
210
- }
211
- }
212
-
213
- for (const v of field.validators()) {
214
- if (v.subType === VALIDATOR_SUBTYPE_NUMERIC) {
209
+ if (typeof min === "number") lengthParts.push(`minLength: ${min}`);
210
+ if (typeof max === "number" && typeof maxLenAttr !== "number") lengthParts.push(`maxLength: ${max}`);
211
+ } else if (v.subType === VALIDATOR_SUBTYPE_NUMERIC) {
215
212
  const min = v.ownAttr(VALIDATOR_ATTR_MIN);
216
213
  const max = v.ownAttr(VALIDATOR_ATTR_MAX);
217
- if (typeof min === "number") parts.push(`min: ${min}`);
218
- if (typeof max === "number") parts.push(`max: ${max}`);
214
+ if (typeof min === "number") numericParts.push(`min: ${min}`);
215
+ if (typeof max === "number") numericParts.push(`max: ${max}`);
219
216
  }
220
217
  }
218
+ parts.push(...regexParts);
219
+ if (typeof maxLenAttr === "number") {
220
+ parts.push(`maxLength: ${maxLenAttr}`);
221
+ }
222
+ parts.push(...lengthParts, ...numericParts);
221
223
 
222
224
  const fk = fkMap.get(field.name);
223
225
  if (fk !== undefined) {
@@ -285,8 +287,9 @@ function describeIdentity(id: MetaIdentity): string {
285
287
  return `**Secondary index:** ${fieldList} — ${uniqueText}`;
286
288
  }
287
289
  if (id.subType === IDENTITY_SUBTYPE_REFERENCE) {
288
- const refIdent = id as unknown as { referencesRaw?: string };
289
- const raw = refIdent.referencesRaw;
290
+ // The subType discriminator guarantees the instance is a MetaReferenceIdentity;
291
+ // narrow to it so we can use its typed `referencesRaw` getter directly.
292
+ const raw = (id as MetaReferenceIdentity).referencesRaw;
290
293
  if (typeof raw === "string" && raw.length > 0) {
291
294
  return `**Reference:** ${fieldList} → \`${raw}\``;
292
295
  }
@@ -1,14 +1,44 @@
1
1
  // Data-dict shapes for the docs templates — the public contract template
2
2
  // authors consume. Versioned per MO major; deprecated before removal.
3
3
  //
4
+ // ## Stability contract (v1)
5
+ //
4
6
  // Per the template-driven codegen design (D3 — data-shape stability), these
5
7
  // types ARE a public API. Template authors who write custom Mustache files
6
8
  // for `docs/entity-page.md` (or any of the partials) reference these keys.
7
9
  //
10
+ // `EntityDocData` is the **Markdown-flavored** data shape — it intentionally
11
+ // mixes raw structural fields (entity, validation, generated) with
12
+ // **pre-rendered Markdown fragments** so cross-port walk functions (TS,
13
+ // Python, C#, Java, Kotlin) don't have to re-derive the same escaping rules
14
+ // (pipe-inside-cell escapes, backtick wrapping, identity bullets,
15
+ // description blockquotes). Fields whose JSDoc carries a `@markdown` tag
16
+ // encode Markdown-specific layout decisions and are stable for the v1
17
+ // contract; they are NOT useful for non-Markdown output (HTML, JSON, plain
18
+ // text).
19
+ //
20
+ // A consumer writing a custom Mustache template with **different table
21
+ // columns** or a **different output format** today must compose their own
22
+ // data from `MetaObject` directly — the v1 shape does not expose a
23
+ // structural-only layer. A future `EntityDocStructure` (raw fields only,
24
+ // no Markdown) may ship in v2 if a real adopter needs that surface; the
25
+ // split is deliberately deferred until then.
26
+ //
27
+ // ## Cross-port consistency
28
+ //
8
29
  // Today's docsFile() refactor populates EntityDocData from MetaObject + the
9
30
  // existing column-mapper / source-detect / enum-meta helpers. Cross-port
10
31
  // implementations (C#, Java, Kotlin, Python) emit the same shape so a single
11
32
  // set of Mustache templates can drive every port's docs codegen.
33
+ //
34
+ // ## Mustache idiom note
35
+ //
36
+ // Some sections carry both a list and a parallel `has*` boolean. The flag is
37
+ // only present to work around Mustache's lack of an "is non-empty array"
38
+ // primitive (`{{#identities}}` iterates but doesn't gate a wrapping section
39
+ // header). A future render engine version may let templates use
40
+ // `{{#identities.0}}` for the same effect, at which point the flag fields
41
+ // can be deprecated.
12
42
 
13
43
  /** One row in the Storage table — fully-rendered as a single Markdown table
14
44
  * row. The escaping rules for pipe-inside-cell are non-trivial and live in
@@ -16,17 +46,20 @@
16
46
  * cross-port walk functions don't have to re-derive the rules. */
17
47
  export interface StorageFieldDoc {
18
48
  name: string; // raw field name (without backticks)
19
- tsTypeCell: string; // already-escaped TS type, with backticks
20
- sqlExprCell: string; // already-escaped SQL expression, wrapped in backticks
21
- constraintsCell: string; // already-formatted constraints text
22
- /** Pre-rendered full Markdown table row, e.g.
49
+ /** @markdown already escaped TS type, with backticks. */
50
+ tsTypeCell: string;
51
+ /** @markdown already escaped SQL expression, wrapped in backticks. */
52
+ sqlExprCell: string;
53
+ /** @markdown — already-formatted constraints text. */
54
+ constraintsCell: string;
55
+ /** @markdown — pre-rendered full Markdown table row, e.g.
23
56
  * "| `id` | `number` | `integer(\"id\")` | primary key |"
24
57
  * Templates emit this verbatim via `{{{rowLine}}}`. */
25
58
  rowLine: string;
26
59
  }
27
60
 
28
61
  export interface IdentityDoc {
29
- /** Pre-formatted bullet text — e.g.
62
+ /** @markdown — pre-formatted bullet text — e.g.
30
63
  * "**Primary key:** `id` — generation: `increment`"
31
64
  * (Carrying the fully-rendered string keeps the template trivial; the
32
65
  * identity rendering rules are non-trivial and live in the builder.) */
@@ -34,13 +67,13 @@ export interface IdentityDoc {
34
67
  }
35
68
 
36
69
  export interface RelationshipDoc {
37
- /** Pre-formatted bullet text — e.g.
70
+ /** @markdown — pre-formatted bullet text — e.g.
38
71
  * "- `posts` — one-to-many → `Post` (composition)" */
39
72
  bullet: string;
40
73
  }
41
74
 
42
75
  export interface UsedByDoc {
43
- /** Pre-formatted bullet text. */
76
+ /** @markdown — pre-formatted bullet text. */
44
77
  bullet: string;
45
78
  }
46
79
 
@@ -50,12 +83,13 @@ export interface GeneratedFileDoc {
50
83
  }
51
84
 
52
85
  export interface EntityDocData {
53
- /** Auto-emitted by the templateGenerator; templates may also echo it for
54
- * human readers. Format: `<!-- @generated by @metaobjectsdev/codegen-ts —
55
- * DO NOT EDIT. -->`. */
86
+ /** @markdown — auto-emitted by the templateGenerator; templates may also
87
+ * echo it for human readers. Format: `<!-- @generated by
88
+ * @metaobjectsdev/codegen-ts — DO NOT EDIT. -->`. */
56
89
  generatedMarker: string;
57
90
 
58
- /** The entity preamble. */
91
+ /** The entity preamble — RAW (not Markdown-flavored). Custom non-Markdown
92
+ * templates can rely on these fields. */
59
93
  entity: {
60
94
  name: string; // "Author"
61
95
  type: string; // "object.entity"
@@ -64,36 +98,41 @@ export interface EntityDocData {
64
98
  description?: string; // raw description text (may be multi-line)
65
99
  };
66
100
 
67
- /** Description as a blockquote (one `> ` per line). Present iff description
68
- * is present. Pre-rendered so multi-line descriptions don't have to be
69
- * expressed as Mustache structural constructs. */
101
+ /** @markdown — description as a blockquote (one `> ` per line). Present
102
+ * iff `entity.description` is present. Pre-rendered so multi-line
103
+ * descriptions don't have to be expressed as Mustache structural
104
+ * constructs. */
70
105
  descriptionQuote?: string;
71
106
 
72
- /** Multi-line preamble block: Type / Source? / Package?, one per line,
73
- * in the exact order matching the legacy emitter. Always present. */
107
+ /** @markdown — multi-line preamble block: Type / Source? / Package?, one
108
+ * per line, in the exact order matching the legacy emitter. Always
109
+ * present. */
74
110
  preambleHeader: string;
75
111
 
76
112
  /** Storage section. Present iff the entity has a writable rdb source and
77
113
  * is NOT object.value. */
78
114
  storage?: {
79
- /** Pre-rendered "| Field | ... |\n|---|---|---|---|" header pair. */
115
+ /** @markdown — pre-rendered "| Field | ... |\n|---|---|---|---|" header
116
+ * pair. */
80
117
  tableHeader: string;
81
118
  rows: StorageFieldDoc[];
82
119
  };
83
120
 
84
- /** Identity section bullets — empty array iff section is omitted. Templates
85
- * check `hasIdentities` (boolean) to decide whether to emit the section
86
- * header; iterate `identities` for the bullets. (Splitting "is the section
87
- * present?" from "iterate the bullets" works around Mustache's lack of an
88
- * "is non-empty array" primitive.) */
121
+ /** Identity section bullets — empty array iff section is omitted.
122
+ * See the "Mustache idiom note" at the top of this file for why this
123
+ * ships alongside a parallel `hasIdentities` boolean. */
89
124
  identities?: IdentityDoc[];
125
+ /** Present-and-non-empty flag for the identities section. See the
126
+ * "Mustache idiom note" at the top of this file. */
90
127
  hasIdentities?: boolean;
91
128
 
92
- /** Relationships section — same pattern as identities. */
129
+ /** Relationships section — same list+flag pattern as identities. */
93
130
  relationships?: RelationshipDoc[];
131
+ /** Present-and-non-empty flag for the relationships section. */
94
132
  hasRelationships?: boolean;
95
133
 
96
- /** Validation section — always emitted. */
134
+ /** Validation section — RAW (not Markdown-flavored). Always emitted.
135
+ * Custom non-Markdown templates can rely on these fields. */
97
136
  validation: {
98
137
  insertSchema: string; // "AuthorInsertSchema"
99
138
  updateSchema: string; // "AuthorUpdateSchema"
@@ -101,11 +140,13 @@ export interface EntityDocData {
101
140
  lower: string; // "author" (lowercased first letter)
102
141
  };
103
142
 
104
- /** "Used by" — present iff any templates declare @payloadRef → this entity. */
143
+ /** "Used by" — present iff any templates declare `@payloadRef` → this
144
+ * entity. Same list+flag pattern as identities. */
105
145
  usedBy?: UsedByDoc[];
146
+ /** Present-and-non-empty flag for the usedBy section. */
106
147
  hasUsedBy?: boolean;
107
148
 
108
- /** Storage section presence flag same pattern as identities. */
149
+ /** Present flag for the storage section. */
109
150
  hasStorage?: boolean;
110
151
 
111
152
  /** Generated-code section — always emitted (at minimum the entity file). */
@@ -1,23 +1,28 @@
1
1
  // docsFile() — emits `<Entity>.md` next to each generated entity module.
2
2
  //
3
- // rc.12+: refactored to use templateGenerator(). The Markdown structure now
4
- // lives in `templates/docs/entity-page.md.mustache`; the data extraction lives
5
- // in `buildEntityDocData()`. Adopters can override the framework template by
6
- // dropping their own `templates/docs/entity-page.md.mustache` into the project
7
- // root (resolved via the project-then-framework provider chain).
3
+ // rc.12+: structured around a shared Mustache template at
4
+ // `templates/docs/entity-page.md.mustache` + a data builder at
5
+ // `docs-data-builder.ts`. Adopters can override the framework template by
6
+ // dropping their own `templates/docs/entity-page.md.mustache` into the
7
+ // project root (resolved via the project-then-framework provider chain).
8
+ //
9
+ // docsFile() calls `render()` directly rather than wrapping
10
+ // `templateGenerator()` because the per-entity output path depends on
11
+ // `GenContext.config.outputLayout`, which the generic templateGenerator
12
+ // `walk(root)` signature doesn't expose. Other future docs-style adopters
13
+ // with ctx-free walks (single-file aggregators, etc.) compose
14
+ // `templateGenerator()` directly.
8
15
  //
9
16
  // The conformance fixture (`fixtures/conformance/docs-file-basic`) gates
10
- // byte-identity through the refactor — the codegen output must match the
11
- // hand-coded rc.11 byte-for-byte. If you're hacking on this and the
12
- // conformance test breaks, the refactor is the bug, not the fixture.
17
+ // byte-identity — the codegen output must match the hand-coded rc.11
18
+ // byte-for-byte. If you're hacking on this and the conformance test
19
+ // breaks, the refactor is the bug, not the fixture.
13
20
 
14
21
  import type { MetaObject } from "@metaobjectsdev/metadata";
15
- import type { Generator, GeneratorFactory, GenContext } from "../generator.js";
22
+ import { render } from "@metaobjectsdev/render";
23
+ import type { Generator, GeneratorFactory } from "../generator.js";
16
24
  import { entityOutputPath } from "../import-path.js";
17
- import {
18
- templateGenerator,
19
- type TemplateGeneratorOpts,
20
- } from "./template-generator.js";
25
+ import { projectProvider } from "../render-engine/framework-provider.js";
21
26
  import { buildEntityDocData } from "./docs-data-builder.js";
22
27
 
23
28
  export interface DocsFileOpts {
@@ -35,48 +40,45 @@ const KNOWN_SIBLING_GENERATORS = new Set([
35
40
  "routes-file-hono",
36
41
  ]);
37
42
 
38
- export const docsFile = function docsFile(opts?: DocsFileOpts): Generator {
39
- // We can't fully delegate to templateGenerator's `walk(root)` because the
40
- // per-entity output path depends on the runtime `outputLayout` (flat /
41
- // package), which only lives on `GenContext.config`. So docsFile wraps
42
- // templateGenerator and threads ctx through.
43
- const tgOpts: TemplateGeneratorOpts = {
44
- name: "docs-file",
45
- template: "docs/entity-page.md",
46
- format: "markdown",
47
- walk: () => [], // placeholder — real walk happens inside generate() below
48
- };
49
- const inner = templateGenerator(tgOpts);
43
+ const TEMPLATE_REF = "docs/entity-page.md";
50
44
 
45
+ export const docsFile = function docsFile(opts?: DocsFileOpts): Generator {
51
46
  const generator: Generator = {
52
47
  name: "docs-file",
53
- async generate(ctx: GenContext) {
48
+ async generate(ctx) {
54
49
  if (!ctx.renderContext) {
55
50
  throw new Error("docs-file: renderContext is required (provided by runGen)");
56
51
  }
57
52
  const rc = ctx.renderContext;
58
- // Drive the templateGenerator by populating its walk via closure.
59
- const realWalk = (root: typeof ctx.loadedRoot) =>
60
- root.objects().filter(ctx.matches).map((entity: MetaObject) => ({
61
- data: buildEntityDocData(entity, {
62
- dialect: rc.dialect,
63
- ...(rc.columnNamingStrategy !== undefined
64
- ? { columnNamingStrategy: rc.columnNamingStrategy }
65
- : {}),
66
- loadedRoot: rc.loadedRoot,
67
- generatorNames: KNOWN_SIBLING_GENERATORS,
53
+ const provider = projectProvider(ctx.projectRoot ?? process.cwd());
54
+ const layout = ctx.config.outputLayout ?? "flat";
55
+ return ctx.loadedRoot.objects().filter(ctx.matches).map((entity: MetaObject) => {
56
+ const path = entityOutputPath(layout, entity.package, `${entity.name}.md`);
57
+ const payload = buildEntityDocData(entity, {
58
+ dialect: rc.dialect,
59
+ ...(rc.columnNamingStrategy !== undefined && {
60
+ columnNamingStrategy: rc.columnNamingStrategy,
68
61
  }),
69
- outputPath: entityOutputPath(
70
- ctx.config.outputLayout ?? "flat",
71
- entity.package,
72
- `${entity.name}.md`,
73
- ),
74
- }));
75
- // Hot-swap walk on the underlying templateGenerator. (The factory
76
- // closes over `opts.walk`, so we mutate the options object's walk
77
- // reference here.)
78
- (tgOpts as { walk: typeof realWalk }).walk = realWalk;
79
- return inner.generate(ctx);
62
+ loadedRoot: rc.loadedRoot,
63
+ generatorNames: KNOWN_SIBLING_GENERATORS,
64
+ });
65
+ let content: string;
66
+ try {
67
+ content = render({
68
+ ref: TEMPLATE_REF,
69
+ payload,
70
+ provider,
71
+ format: "markdown",
72
+ });
73
+ } catch (err) {
74
+ const msg = err instanceof Error ? err.message : String(err);
75
+ throw new Error(
76
+ `docs-file: failed rendering '${TEMPLATE_REF}' for '${path}': ${msg}`,
77
+ { cause: err instanceof Error ? err : undefined },
78
+ );
79
+ }
80
+ return { path, content };
81
+ });
80
82
  },
81
83
  };
82
84
  if (opts?.filter) generator.filter = opts.filter;
@@ -47,10 +47,11 @@ export interface TemplateGeneratorOpts {
47
47
  * default `walk` — adopters apply filters inside their walk function. */
48
48
  filter?: (entity: MetaObject) => boolean;
49
49
  /** Override the Provider used for template resolution. When omitted the
50
- * generator resolves via `projectProvider(<projectRoot>)`, which layers
50
+ * generator resolves via `projectProvider(ctx.projectRoot)`, which layers
51
51
  * the project's `templates/` over the framework defaults. (The project
52
- * root is taken from `process.cwd()` at run time — adopters needing a
53
- * different lookup chain can pass an explicit provider.) */
52
+ * root is the directory holding `.metaobjects/config.json`, threaded
53
+ * through `GenContext` by the runner. Adopters needing a different
54
+ * lookup chain can pass an explicit provider.) */
54
55
  provider?: Provider;
55
56
  /** Optional named target — same as the other generators. */
56
57
  target?: string;
@@ -63,16 +64,37 @@ export const templateGenerator = function templateGenerator(
63
64
  const generator: Generator = {
64
65
  name: opts.name,
65
66
  async generate(ctx: GenContext): Promise<EmittedFile[]> {
66
- const provider = opts.provider ?? projectProvider(process.cwd());
67
+ let provider: Provider;
68
+ if (opts.provider !== undefined) {
69
+ provider = opts.provider;
70
+ } else if (ctx.projectRoot !== undefined) {
71
+ provider = projectProvider(ctx.projectRoot);
72
+ } else {
73
+ ctx.warn(
74
+ "templateGenerator: ctx.projectRoot is undefined; falling back to process.cwd() for project-template resolution. " +
75
+ "Project-scoped template overrides will resolve relative to the current working directory, which is fragile under " +
76
+ "`meta gen` invoked from a sub-directory. Drive via runGen(opts.projectRoot) to remove this warning.",
77
+ );
78
+ provider = projectProvider(process.cwd());
79
+ }
67
80
  const walkRes = await opts.walk(ctx.loadedRoot);
68
81
  const files: EmittedFile[] = [];
69
82
  for (const { data, outputPath } of walkRes) {
70
- const content = render({
71
- ref: opts.template,
72
- payload: data,
73
- provider,
74
- format: fmt,
75
- });
83
+ let content: string;
84
+ try {
85
+ content = render({
86
+ ref: opts.template,
87
+ payload: data,
88
+ provider,
89
+ format: fmt,
90
+ });
91
+ } catch (err) {
92
+ const msg = err instanceof Error ? err.message : String(err);
93
+ throw new Error(
94
+ `templateGenerator(${opts.name}) failed rendering '${opts.template}' for '${outputPath}': ${msg}`,
95
+ { cause: err instanceof Error ? err : undefined },
96
+ );
97
+ }
76
98
  files.push({ path: outputPath, content });
77
99
  }
78
100
  return files;