@akanjs/language 3.2.0-rc.0 → 3.2.0-rc.10

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.
@@ -0,0 +1,18 @@
1
+ import type { AkanGraphEdgeKind, AkanGraphLocation, AkanGraphNode, AkanGraphNodeKind } from "akanjs/common/akanGraph.ts";
2
+ import type { AkanGraphSource } from "./akanGraph";
3
+ import { type GuardResolver } from "./guardResolver";
4
+ import type { AkanSpan, Extent, FileFacts, ServiceClassFact } from "./moduleFacts";
5
+ export interface GraphSink {
6
+ key: (kind: AkanGraphNodeKind, owner: string | null, scope: string) => string;
7
+ addNode: (id: string, kind: AkanGraphNodeKind, owner: string | null, name: string, span: AkanSpan | null, detail: string[]) => AkanGraphNode;
8
+ addEdge: (from: string, to: string, kind: AkanGraphEdgeKind, label: string | null, at: AkanGraphLocation | null) => void;
9
+ digest: (node: AkanGraphNode, text: string | undefined, extent: Extent) => void;
10
+ location: (span: AkanSpan) => AkanGraphLocation;
11
+ }
12
+ export declare class AdaptorResolver {
13
+ #private;
14
+ constructor(source: AkanGraphSource, resolver: GuardResolver, sink: GraphSink);
15
+ declare(facts: FileFacts[]): void;
16
+ addService(refName: string, service: ServiceClassFact, file: FileFacts): void;
17
+ pluggedOf(owner: string | null, module: string | null, field: string): string[];
18
+ }
package/akanGraph.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AkanGraph } from "akanjs/common/akanGraph.ts";
2
2
  import type * as TS from "typescript";
3
3
  import type { Ts } from "./ast";
4
- import { type AkanFactReader, type FileFacts } from "./moduleFacts";
4
+ import type { AkanFactReader, FileFacts } from "./moduleFacts";
5
5
  import type { AkanTarget } from "./nameTable";
6
6
  export interface AkanGraphSource {
7
7
  ts: Ts;
@@ -6,5 +6,5 @@ export interface AkanGraphChanges extends AkanGraph {
6
6
  }
7
7
  export declare class AkanGraphDiff {
8
8
  #private;
9
- static between(base: AkanGraph, head: AkanGraph): AkanGraphChanges;
9
+ static between(given: AkanGraph, head: AkanGraph): AkanGraphChanges;
10
10
  }
@@ -0,0 +1 @@
1
+ export declare const escapeRegExp: (text: string) => string;
@@ -0,0 +1,50 @@
1
+ import type * as TS from "typescript";
2
+ import type { AkanAst, Ts } from "./ast";
3
+ import type { AkanSpan, Extent, ImportFact, MemberFact } from "./moduleFacts";
4
+ export interface GuardFact extends MemberFact {
5
+ scope: string | null;
6
+ doc: string | null;
7
+ factory: string | null;
8
+ layers: number;
9
+ }
10
+ export interface GuardVia {
11
+ callee: string;
12
+ layers: number;
13
+ }
14
+ export interface GuardFactoryFact extends MemberFact {
15
+ scope: string | null;
16
+ doc: string | null;
17
+ direct: boolean;
18
+ via: GuardVia[];
19
+ layers: number;
20
+ }
21
+ export interface GuardCallFact extends MemberFact {
22
+ callee: string;
23
+ kind: "call" | "extends";
24
+ scope: string | null;
25
+ doc: string | null;
26
+ layers: number;
27
+ }
28
+ export interface InPlaceGuard {
29
+ call: TS.CallExpression;
30
+ name: string;
31
+ }
32
+ export declare const guardLabelOf: (guard: string, labels: Record<string, string>) => string;
33
+ interface GuardReaderBase {
34
+ spanOf: (source: TS.SourceFile, node: TS.Node) => AkanSpan;
35
+ extentOf: (source: TS.SourceFile, node: TS.Node) => Extent;
36
+ unwrap: (expression: TS.Expression) => TS.Expression;
37
+ docOf: (source: TS.SourceFile, node: TS.Node) => string | null;
38
+ }
39
+ export declare const createGuardFactReader: (ts: Ts, ast: AkanAst, base: GuardReaderBase) => {
40
+ guardsIn: (source: TS.SourceFile, object: TS.ObjectLiteralExpression | undefined, made: InPlaceGuard[], member: string) => string[];
41
+ guardsOf: (source: TS.SourceFile, imports: ImportFact[], madeInPlace: InPlaceGuard[]) => {
42
+ guards: GuardFact[];
43
+ guardFactories: GuardFactoryFact[];
44
+ guardCalls: GuardCallFact[];
45
+ guardLabels: {
46
+ [k: string]: string;
47
+ };
48
+ };
49
+ };
50
+ export {};
@@ -0,0 +1,75 @@
1
+ import type * as TS from "typescript";
2
+ import type { AkanGraphSource } from "./akanGraph";
3
+ import { type AkanSpan, type Extent, type FileFacts } from "./moduleFacts";
4
+ import type { RouteFactReader } from "./routeFacts";
5
+ export type GuardSite = Pick<FileFacts, "fileName" | "owner" | "imports">;
6
+ interface GuardPart {
7
+ fileName: string;
8
+ extent: Extent;
9
+ }
10
+ export interface DeclaredGuard {
11
+ name: string;
12
+ owner: string | null;
13
+ span: AkanSpan;
14
+ scope: string | null;
15
+ doc: string | null;
16
+ parts: GuardPart[];
17
+ file: string | null;
18
+ label?: string;
19
+ }
20
+ type GuardLookup = {
21
+ guard: DeclaredGuard;
22
+ } | {
23
+ name: string;
24
+ from: string | undefined;
25
+ } | {
26
+ external: true;
27
+ };
28
+ interface Reexport {
29
+ name: string;
30
+ from: string | null;
31
+ }
32
+ interface StarExports {
33
+ owners: string[];
34
+ packages: string[];
35
+ paths: string[];
36
+ isOpaque: boolean;
37
+ }
38
+ interface ModuleExports {
39
+ named: (Reexport & {
40
+ fileName: string;
41
+ }) | null;
42
+ stars: string[];
43
+ }
44
+ interface Declaration {
45
+ source: TS.SourceFile;
46
+ statement: TS.Statement;
47
+ declared: TS.Node;
48
+ extent: Extent;
49
+ name: string;
50
+ }
51
+ export declare const frameworkOwner = "akanjs";
52
+ export declare const frameworkPattern: RegExp;
53
+ export declare class GuardResolver {
54
+ #private;
55
+ constructor(source: AkanGraphSource, routes: RouteFactReader);
56
+ find(local: string, site: GuardSite): GuardLookup;
57
+ madeInPlace(fileName: string, name: string): DeclaredGuard | undefined;
58
+ declare(facts: FileFacts[]): DeclaredGuard[];
59
+ reexportOf(owner: string, name: string, near: string | null): {
60
+ local: string;
61
+ site: GuardSite;
62
+ } | null;
63
+ declarationOf(owner: string, name: string, near: string | null, depth?: number): Declaration | null;
64
+ starExportsOf(owner: string, near: string): StarExports;
65
+ exportsAt(path: string, name: string): ModuleExports;
66
+ hasModule(path: string): boolean;
67
+ packagesUnder(owner: string, folder: string): string[];
68
+ declares(owner: string, name: string): boolean;
69
+ declaresAt(path: string, name: string): boolean;
70
+ inOwner(fileName: string, owner: string | null): string;
71
+ ownerOfSpecifier(fileName: string, specifier: string): string | undefined;
72
+ pathOfSpecifier(fileName: string, specifier: string): string | null;
73
+ visible(target: string | null, from: string | null): boolean;
74
+ }
75
+ export {};