@akanjs/language 0.0.0-stage → 3.1.2-rc.1

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,68 @@
1
+ import type * as TS from "typescript";
2
+ import type { AkanAst, Ts } from "./ast";
3
+ export interface AkanSpan {
4
+ fileName: string;
5
+ start: number;
6
+ end: number;
7
+ line: number;
8
+ character: number;
9
+ endLine: number;
10
+ endCharacter: number;
11
+ }
12
+ export interface NamedFact {
13
+ name: string;
14
+ span: AkanSpan;
15
+ }
16
+ export interface SliceKeyFact extends NamedFact {
17
+ guards: string[];
18
+ live: boolean;
19
+ argCount: number;
20
+ }
21
+ export interface EndpointKeyFact extends NamedFact {
22
+ verb: string | null;
23
+ guards: string[];
24
+ argCount: number;
25
+ }
26
+ export interface ConstantClassFact extends NamedFact {
27
+ fields: NamedFact[];
28
+ parents: string[];
29
+ }
30
+ export interface FilterClassFact extends NamedFact {
31
+ queries: NamedFact[];
32
+ }
33
+ export interface ModuleClassFact extends NamedFact {
34
+ model: string | null;
35
+ }
36
+ export interface SliceClassFact extends ModuleClassFact {
37
+ guards: string[];
38
+ keys: SliceKeyFact[];
39
+ }
40
+ export interface EndpointClassFact extends ModuleClassFact {
41
+ keys: EndpointKeyFact[];
42
+ }
43
+ export interface StoreClassFact extends ModuleClassFact {
44
+ stateKeys: NamedFact[];
45
+ }
46
+ export interface FileFacts {
47
+ fileName: string;
48
+ owner: string | null;
49
+ constants: ConstantClassFact[];
50
+ filters: FilterClassFact[];
51
+ models: ModuleClassFact[];
52
+ services: ModuleClassFact[];
53
+ slices: SliceClassFact[];
54
+ endpoints: EndpointClassFact[];
55
+ stores: StoreClassFact[];
56
+ }
57
+ export declare const ownerOf: (relativePath: string) => string | null;
58
+ export declare const createFactReader: (ts: Ts, ast: AkanAst) => {
59
+ read: (source: TS.SourceFile, owner: string | null) => FileFacts;
60
+ spanOf: (source: TS.SourceFile, node: TS.Node) => AkanSpan;
61
+ moduleRefOf: (expression: TS.Expression | undefined, holder: string) => string | null;
62
+ chainOf: (initializer: TS.Expression) => {
63
+ root: TS.CallExpression | null;
64
+ methods: string[];
65
+ };
66
+ unwrap: (expression: TS.Expression) => TS.Expression;
67
+ };
68
+ export type AkanFactReader = ReturnType<typeof createFactReader>;
package/nameTable.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import type { AkanSpan, FileFacts } from "./moduleFacts";
2
+ export type AkanFamily = "slice" | "query" | "model" | "formSetter" | "storeState" | "endpoint" | "module";
3
+ export type AkanReceiverGate = "srv" | "sig" | "db" | "slice" | "state";
4
+ export interface AkanTarget {
5
+ family: AkanFamily;
6
+ refName: string;
7
+ owner: string | null;
8
+ sourceKey: string;
9
+ label: string;
10
+ detail: string[];
11
+ span: AkanSpan;
12
+ }
13
+ export interface AkanEntry extends AkanTarget {
14
+ name: string;
15
+ role: string;
16
+ gate: AkanReceiverGate | null;
17
+ renamed?: (sourceKey: string) => string;
18
+ dictionary?: {
19
+ section: "slice" | "query";
20
+ className: string;
21
+ };
22
+ }
23
+ export declare class NameTable {
24
+ #private;
25
+ constructor(files: Iterable<FileFacts>);
26
+ lookup(name: string): AkanEntry[];
27
+ entriesTargeting(fileName: string): AkanEntry[];
28
+ }
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@akanjs/language",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.1.2-rc.1",
4
+ "description": "Editor-independent Akan.js language core: resolves derived names (slices, queries, CRUD, form setters) back to the source key that produced them.",
5
+ "sourceType": "module",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "homepage": "https://akanjs.com",
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/akan-team/akanjs.git",
15
+ "directory": "pkgs/@akanjs/language"
16
+ },
17
+ "peerDependencies": {
18
+ "typescript": ">=5.0.0"
19
+ },
20
+ "peerDependenciesMeta": {
21
+ "typescript": {
22
+ "optional": true
23
+ }
24
+ },
25
+ "main": "./index.cjs",
26
+ "module": "./index.js",
27
+ "types": "./index.d.ts",
28
+ "sideEffects": false,
29
+ "exports": {
30
+ ".": {
31
+ "types": "./index.d.ts",
32
+ "import": "./index.js",
33
+ "require": "./index.cjs"
34
+ },
35
+ "./package.json": "./package.json"
36
+ }
37
+ }