@nwire/scan 0.12.0 → 0.13.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/ast-extract.d.ts +71 -0
- package/dist/ast-extract.js +1024 -0
- package/dist/graph.d.ts +56 -0
- package/dist/graph.js +325 -0
- package/dist/manifest.d.ts +67 -0
- package/dist/manifest.js +103 -0
- package/dist/scan.d.ts +46 -108
- package/dist/scan.js +13 -381
- package/dist/telemetry-runs.d.ts +37 -0
- package/dist/telemetry-runs.js +87 -0
- package/dist/topology.d.ts +10 -0
- package/dist/topology.js +10 -0
- package/dist/vite-plugin.d.ts +14 -6
- package/dist/vite-plugin.js +27 -12
- package/package.json +8 -6
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static AST discovery (Phase 0) — extract `defineEvent` + `defineAction`
|
|
3
|
+
* declarations from source WITHOUT booting the app. "Scan the graph, not the
|
|
4
|
+
* runtime." Uses the TypeScript compiler API (already a `@nwire/scan` dep) to
|
|
5
|
+
* parse each file; reads name, `.public()`, `emits`, literal metadata, and
|
|
6
|
+
* source location straight off the AST node positions.
|
|
7
|
+
*
|
|
8
|
+
* Runs ALONGSIDE the jiti scanner — the equivalence harness diffs the two
|
|
9
|
+
* manifests. Anything not statically analyzable (computed name, dynamic
|
|
10
|
+
* `emits`) is recorded in `unanalyzable`, never silently dropped (plan §2,
|
|
11
|
+
* Law 2). Covers events, actions, actors, projections, queries, and
|
|
12
|
+
* workflows (including the workflow closure edge-walk and the projection /
|
|
13
|
+
* workflow event-graph edges).
|
|
14
|
+
*/
|
|
15
|
+
import type { ActionEntry, ActorEntry, CommandEntry, CronEntry, ErrorEntry, EventEntry, EventGraphEdge, ExternalCallEntry, InboundWebhookEntry, InboxEntry, OutboxEntry, ProjectionEntry, QueryEntry, ResourceEntry, SourceLocationEntry, WorkflowEntry } from "./scan.js";
|
|
16
|
+
/** A `config/*.ts` module — its file and the top-level config field names it exposes. */
|
|
17
|
+
export interface ConfigModuleEntry {
|
|
18
|
+
readonly file: string;
|
|
19
|
+
readonly keys: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/** A `defineSchema` declaration — the actor's data/key/states shape. */
|
|
22
|
+
export interface SchemaEntry {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly app: string;
|
|
25
|
+
readonly key?: string;
|
|
26
|
+
readonly states: readonly string[];
|
|
27
|
+
readonly source?: SourceLocationEntry;
|
|
28
|
+
}
|
|
29
|
+
export interface UnanalyzableEntry {
|
|
30
|
+
readonly kind: "event" | "action" | "actor" | "projection" | "query" | "workflow" | "command" | "cron" | "externalCall" | "inboundWebhook" | "outbox" | "inbox" | "resource" | "error" | "schema";
|
|
31
|
+
readonly reason: string;
|
|
32
|
+
readonly source: SourceLocationEntry;
|
|
33
|
+
}
|
|
34
|
+
export interface AstExtract {
|
|
35
|
+
readonly events: EventEntry[];
|
|
36
|
+
readonly actions: ActionEntry[];
|
|
37
|
+
readonly actors: ActorEntry[];
|
|
38
|
+
readonly projections: ProjectionEntry[];
|
|
39
|
+
readonly queries: QueryEntry[];
|
|
40
|
+
readonly workflows: WorkflowEntry[];
|
|
41
|
+
readonly commands: CommandEntry[];
|
|
42
|
+
readonly crons: CronEntry[];
|
|
43
|
+
readonly externalCalls: ExternalCallEntry[];
|
|
44
|
+
readonly inboundWebhooks: InboundWebhookEntry[];
|
|
45
|
+
readonly outboxes: OutboxEntry[];
|
|
46
|
+
readonly inboxes: InboxEntry[];
|
|
47
|
+
readonly resources: ResourceEntry[];
|
|
48
|
+
readonly errors: ErrorEntry[];
|
|
49
|
+
readonly schemas: SchemaEntry[];
|
|
50
|
+
/** Environment variable names the app's source reads (sorted, de-duped). */
|
|
51
|
+
readonly env: string[];
|
|
52
|
+
/** Config modules discovered under a `config/` directory (file + top-level keys). */
|
|
53
|
+
readonly config: ConfigModuleEntry[];
|
|
54
|
+
readonly unanalyzable: UnanalyzableEntry[];
|
|
55
|
+
/** Event-graph edges (`folds` / `subscribes` / `dispatches`), mirroring the jiti scanner. */
|
|
56
|
+
readonly graph: {
|
|
57
|
+
readonly events: EventGraphEdge[];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extract `defineEvent` + `defineAction` from a set of source files. Two
|
|
62
|
+
* passes: events first (so `emits` identifiers can resolve to event names),
|
|
63
|
+
* then actions.
|
|
64
|
+
*/
|
|
65
|
+
export declare function extractFromFiles(files: readonly string[], app?: string): AstExtract;
|
|
66
|
+
/**
|
|
67
|
+
* Discover config modules: any parsed file living in a `config/` directory.
|
|
68
|
+
* Captures each module's top-level config field names (best-effort), sorted by
|
|
69
|
+
* file so the output is stable.
|
|
70
|
+
*/
|
|
71
|
+
export declare function collectConfigModules(files: readonly string[]): ConfigModuleEntry[];
|