@mnemonica/tactica 0.4.7 → 0.4.8

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/README.md CHANGED
@@ -131,6 +131,8 @@ You should commit `.tactica/` if you want type information to flow through CI wi
131
131
 
132
132
  EDS tracking is **auto-enabled** when `@mnemonica/dive` is present in `package.json` dependencies; otherwise it is off. `--eds` / `--no-eds` override the auto-detection.
133
133
 
134
+ Analyzer errors (for example the unnamed `lazy()` form, which the runtime rejects with `TYPENAME_MUST_BE_A_STRING`) never abort the run: the offending call is skipped, each error prints once as a `tactica: <file>:<line>:<column> <message>` warning on stderr (not `--verbose`-gated), and the exit code stays 0.
135
+
134
136
  ## Generated Files
135
137
 
136
138
  Tactica writes everything under the `--output` directory (default `.tactica/`). All file paths inside the JSON files are emitted **project-relative** (anchored at the tsconfig directory) so the output is portable across machines; consumers resolve them against the directory holding `.tactica`. Earlier versions emitted absolute paths, so consumers should accept both.
@@ -256,7 +258,7 @@ Chained calls (`define('A').define('B')`) and nested calls via variable referenc
256
258
  ### `lazy()` definitions
257
259
 
258
260
  ```ts
259
- const AdminType = UserType.lazy(() => class AdminType {
261
+ const AdminType = UserType.lazy('AdminType', () => class AdminType {
260
262
  role: string;
261
263
  constructor (role: string) {
262
264
  this.role = role;
@@ -264,7 +266,7 @@ const AdminType = UserType.lazy(() => class AdminType {
264
266
  });
265
267
  ```
266
268
 
267
- All forms are recognized: free `lazy('Name', getter)`, method `Type.lazy(...)`, and chained `define('A').lazy('B', getter)`. The getter is followed, and the returned constructor is analyzed like a direct `define()` handler — properties and constructor parameters are extracted and emitted in `types.ts` / `registry.ts` like any other type.
269
+ The name is required — the runtime throws `TYPENAME_MUST_BE_A_STRING` for the unnamed forms (`lazy(getter)`, `Type.lazy(getter)`, `lazy(source, getter)`), so tactica reports them as analyzer errors naming the call site and generates no type for them. The named forms are all recognized: free `lazy('Name', getter)`, method `Type.lazy('Name', getter)`, chained `define('A').lazy('B', getter)`, and explicit-source `lazy(source, 'Name', getter)`. The getter is followed, and the returned constructor is analyzed like a direct `define()` handler — properties and constructor parameters are extracted and emitted in `types.ts` / `registry.ts` like any other type.
268
270
 
269
271
  ### Construction shapes beyond plain `new`
270
272
 
package/lib/analyzer.d.ts CHANGED
@@ -477,7 +477,9 @@ export declare class MnemonicaAnalyzer {
477
477
  /**
478
478
  * Extract lazy() call arguments into a normalized shape.
479
479
  * Handles named/unnamed and explicit-source forms, both as free calls
480
- * and as method calls.
480
+ * and as method calls. The unnamed shapes return `name: undefined` —
481
+ * processLazyCall rejects them with an analyzer error (the runtime
482
+ * requires the name), so no type is generated for them.
481
483
  */
482
484
  private extractLazyCallArgs;
483
485
  /**