@mnemonica/tactica 0.4.6 → 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 +4 -2
- package/lib/analyzer.d.ts +7 -3
- package/lib/analyzer.js +33 -10
- package/lib/cli.js +20 -4
- package/lib/types.d.ts +10 -9
- package/lib/types.js +1 -1
- package/lib/writer.d.ts +6 -4
- package/lib/writer.js +14 -12
- package/package.json +6 -6
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
|
-
|
|
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
|
@@ -77,8 +77,10 @@ export declare class MnemonicaAnalyzer {
|
|
|
77
77
|
* The collections.json manifest: one entry per minted collection, in
|
|
78
78
|
* minting order, preceded by the default-collection entry whenever
|
|
79
79
|
* default-collection types exist. The default entry has no id/location
|
|
80
|
-
* (there is no call site — unprefixed fullPaths are its identity)
|
|
81
|
-
*
|
|
80
|
+
* (there is no call site — unprefixed fullPaths are its identity).
|
|
81
|
+
* Format 1.2: the registry interface is NOT emitted (it is a
|
|
82
|
+
* TypeScript-only concern — the in-memory registryInterfaceName that
|
|
83
|
+
* types.ts/registry.ts are generated from stays on the TypeNode).
|
|
82
84
|
*/
|
|
83
85
|
getCollectionsManifest(): CollectionManifestEntry[];
|
|
84
86
|
/**
|
|
@@ -475,7 +477,9 @@ export declare class MnemonicaAnalyzer {
|
|
|
475
477
|
/**
|
|
476
478
|
* Extract lazy() call arguments into a normalized shape.
|
|
477
479
|
* Handles named/unnamed and explicit-source forms, both as free calls
|
|
478
|
-
* 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.
|
|
479
483
|
*/
|
|
480
484
|
private extractLazyCallArgs;
|
|
481
485
|
/**
|