@supacloud/compiler 0.4.0 → 0.4.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.
- package/dist/analyze.d.ts +3 -3
- package/dist/compile.d.ts +2 -2
- package/dist/types.d.ts +20 -20
- package/dist/util.d.ts +7 -7
- package/dist/validate.d.ts +2 -2
- package/package.json +1 -1
package/dist/analyze.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApplicationGraph } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Analyzes source code under rootDir (via ts-morph AST, without typecheck dependency) to build ApplicationGraph.
|
|
4
|
+
* Decorators are matched by name only (Module/Injectable/Inject/Command/Query/Controller/Get/...),
|
|
5
|
+
* without checking import origins, so this package does not need to depend on @supacloud/app.
|
|
6
6
|
*/
|
|
7
7
|
export declare function analyzeProject(rootDir: string, include?: string[]): Promise<ApplicationGraph>;
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CheckProjectResult, CompileOptions, CompileResult } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Complete compilation pipeline: AST analysis -> validation -> generate static factory code and manifest.
|
|
4
|
+
* Files are emitted even when error-level diagnostics exist; caller decides adoption based on diagnostics.
|
|
5
5
|
*/
|
|
6
6
|
export declare function compileProject(options: CompileOptions): Promise<CompileResult>;
|
|
7
7
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ApplicationGraph
|
|
3
|
-
*
|
|
2
|
+
* ApplicationGraph: Static application graph built by the compiler from source AST.
|
|
3
|
+
* No runtime reflection or container; all metadata is explicitly represented here and in generated code.
|
|
4
4
|
*/
|
|
5
5
|
export type Scope = "application" | "request" | "job";
|
|
6
6
|
export type ProviderKind = "class" | "value" | "factory" | "existing";
|
|
@@ -13,7 +13,7 @@ export interface Diagnostic {
|
|
|
13
13
|
line?: number;
|
|
14
14
|
}
|
|
15
15
|
export interface ProviderNode {
|
|
16
|
-
/**
|
|
16
|
+
/** Token name (InjectionToken variable name or class name). */
|
|
17
17
|
token: string;
|
|
18
18
|
tokenKind: TokenKind;
|
|
19
19
|
kind: ProviderKind;
|
|
@@ -22,12 +22,12 @@ export interface ProviderNode {
|
|
|
22
22
|
useFactoryName?: string;
|
|
23
23
|
useExisting?: string;
|
|
24
24
|
scope: Scope;
|
|
25
|
-
/**
|
|
25
|
+
/** Token names in constructor/factory parameter order. */
|
|
26
26
|
deps: string[];
|
|
27
27
|
exported: boolean;
|
|
28
28
|
file: string;
|
|
29
29
|
line: number;
|
|
30
|
-
/** useClass/useFactory/useValue
|
|
30
|
+
/** Relative module path of useClass/useFactory/useValue symbol (for import generation). */
|
|
31
31
|
importPath?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface RouteNode {
|
|
@@ -49,7 +49,7 @@ export interface ControllerNode {
|
|
|
49
49
|
routes: RouteNode[];
|
|
50
50
|
file: string;
|
|
51
51
|
importPath: string;
|
|
52
|
-
/**
|
|
52
|
+
/** Route schema symbol name -> relative module path (for import generation). */
|
|
53
53
|
schemaImports?: Record<string, string>;
|
|
54
54
|
}
|
|
55
55
|
export interface CommandNode {
|
|
@@ -65,46 +65,46 @@ export interface QueryNode {
|
|
|
65
65
|
name: string;
|
|
66
66
|
}
|
|
67
67
|
export interface ModuleNode {
|
|
68
|
-
/** @Module({ name })
|
|
68
|
+
/** Name from @Module({ name }) or defineModule. */
|
|
69
69
|
name: string;
|
|
70
70
|
className: string;
|
|
71
|
-
/**
|
|
71
|
+
/** Module tags (e.g. ['scope:case', 'type:feature']) for architecture boundary governance. */
|
|
72
72
|
tags?: string[];
|
|
73
73
|
file: string;
|
|
74
74
|
line: number;
|
|
75
|
-
/**
|
|
75
|
+
/** Names of imported modules. */
|
|
76
76
|
imports: string[];
|
|
77
77
|
providers: ProviderNode[];
|
|
78
78
|
controllers: ControllerNode[];
|
|
79
79
|
commands: CommandNode[];
|
|
80
80
|
queries: QueryNode[];
|
|
81
|
-
/**
|
|
81
|
+
/** Exported token names. */
|
|
82
82
|
exports: string[];
|
|
83
83
|
}
|
|
84
84
|
export interface ApplicationGraph {
|
|
85
85
|
modules: ModuleNode[];
|
|
86
|
-
/**
|
|
86
|
+
/** Depended token names provided by platform injection rather than any module. */
|
|
87
87
|
externalTokens: string[];
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* Diagnostics produced during analysis (e.g. missing-deps), merged by compileProject.
|
|
90
|
+
* Omitted from app.manifest.json.
|
|
91
91
|
*/
|
|
92
92
|
diagnostics?: Diagnostic[];
|
|
93
93
|
/**
|
|
94
|
-
* InjectionToken
|
|
95
|
-
* "supacloud.request-context"
|
|
96
|
-
*
|
|
94
|
+
* InjectionToken variable name -> string name (e.g. REQUEST_CONTEXT ->
|
|
95
|
+
* "supacloud.request-context"), used during code generation to identify built-in context tokens.
|
|
96
|
+
* Omitted from app.manifest.json.
|
|
97
97
|
*/
|
|
98
98
|
tokenNames?: Record<string, string>;
|
|
99
99
|
}
|
|
100
100
|
export interface CompileOptions {
|
|
101
|
-
/**
|
|
101
|
+
/** Project root directory (containing tsconfig). */
|
|
102
102
|
rootDir: string;
|
|
103
|
-
/**
|
|
103
|
+
/** Glob patterns, defaults to ['**\/*.module.ts', '**\/*.ts']. */
|
|
104
104
|
include?: string[];
|
|
105
|
-
/**
|
|
105
|
+
/** Output directory (e.g. <rootDir>/generated). */
|
|
106
106
|
outDir: string;
|
|
107
|
-
/** warn
|
|
107
|
+
/** Upgrade warn-level diagnostics to error. */
|
|
108
108
|
strict?: boolean;
|
|
109
109
|
/** Built-in architecture boundary preset (for example, 'modular-monolith'). */
|
|
110
110
|
moduleBoundaryPreset?: ModuleBoundaryPresetName;
|
package/dist/util.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* CASE_REPOSITORY
|
|
4
|
-
* CaseService
|
|
2
|
+
* Token name -> key in services object.
|
|
3
|
+
* CASE_REPOSITORY -> caseRepository, LOGGER -> logger (convert CONSTANT_CASE to camelCase),
|
|
4
|
+
* CaseService -> caseService (lowercase first letter of PascalCase).
|
|
5
5
|
*/
|
|
6
6
|
export declare function camelName(token: string): string;
|
|
7
|
-
/**
|
|
7
|
+
/** Computes relative import path from fromDir to toFile (stripping extension, ensuring ./ or ../ prefix). */
|
|
8
8
|
export declare function relativeImportPath(fromDir: string, toFile: string): string;
|
|
9
|
-
/**
|
|
9
|
+
/** String names of built-in context tokens (aligned with REQUEST_CONTEXT/JOB_CONTEXT in @supacloud/app). */
|
|
10
10
|
export declare const REQUEST_CONTEXT_TOKEN_NAME = "supacloud.request-context";
|
|
11
11
|
export declare const JOB_CONTEXT_TOKEN_NAME = "supacloud.job-context";
|
|
12
|
-
/**
|
|
12
|
+
/** Determines whether token is built-in request context (variable name REQUEST_CONTEXT or matching token name). */
|
|
13
13
|
export declare function isRequestContextToken(token: string, tokenNames?: Record<string, string>): boolean;
|
|
14
|
-
/**
|
|
14
|
+
/** Determines whether token is built-in job context. */
|
|
15
15
|
export declare function isJobContextToken(token: string, tokenNames?: Record<string, string>): boolean;
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApplicationGraph, Diagnostic, ValidateOptions } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* strict
|
|
3
|
+
* Validates ApplicationGraph and produces diagnostics list.
|
|
4
|
+
* In strict mode, warn-level diagnostics are promoted to error.
|
|
5
5
|
*/
|
|
6
6
|
export declare function validateGraph(graph: ApplicationGraph, options?: boolean | ValidateOptions): Diagnostic[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/compiler",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Static compiler for @supacloud/app metadata: builds the application graph from AST, validates it, and generates reflection-free factory code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|