@jay-framework/compiler 0.5.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/index.d.ts +77 -0
- package/dist/index.js +1918 -0
- package/package.json +55 -0
- package/readme.md +41 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import ts__default, { SourceFile } from 'typescript';
|
|
3
|
+
import { WithValidations, RuntimeMode, CompilerSourceFile, GenericTypescriptSourceFile, MainRuntimeModes, GenerateTarget } from '@jay-framework/compiler-shared';
|
|
4
|
+
import { JayHtmlSourceFile } from '@jay-framework/compiler-jay-html';
|
|
5
|
+
export { generateElementDefinitionFile } from '@jay-framework/compiler-jay-html';
|
|
6
|
+
|
|
7
|
+
interface ResolvedType {
|
|
8
|
+
canBeAssignedFrom(rightSide: ResolvedType): any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare enum CompilePatternType {
|
|
12
|
+
RETURN = 0,
|
|
13
|
+
CALL = 1,
|
|
14
|
+
CHAINABLE_CALL = 2,
|
|
15
|
+
ASSIGNMENT_LEFT_SIDE = 3,
|
|
16
|
+
KNOWN_VARIABLE_READ = 4,
|
|
17
|
+
CONST_READ = 5,
|
|
18
|
+
INLINE_ARROW_FUNCTION = 6
|
|
19
|
+
}
|
|
20
|
+
declare enum JayTargetEnv {
|
|
21
|
+
main = 0,
|
|
22
|
+
any = 1,
|
|
23
|
+
sandbox = 2
|
|
24
|
+
}
|
|
25
|
+
interface CompiledPattern {
|
|
26
|
+
patternType: CompilePatternType;
|
|
27
|
+
leftSidePath: string[];
|
|
28
|
+
leftSideType: ResolvedType;
|
|
29
|
+
callArgumentTypes?: ResolvedType[];
|
|
30
|
+
returnType: ResolvedType;
|
|
31
|
+
targetEnvForStatement: JayTargetEnv;
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
34
|
+
declare function compileFunctionSplitPatternsBlock(patternFiles: SourceFile[]): WithValidations<CompiledPattern[]>;
|
|
35
|
+
|
|
36
|
+
interface FunctionRepositoryCodeFragment {
|
|
37
|
+
handlerCode: string;
|
|
38
|
+
key: string;
|
|
39
|
+
}
|
|
40
|
+
declare class GeneratedFunctionRepository {
|
|
41
|
+
readonly hasFunctionRepository: boolean;
|
|
42
|
+
readonly functionRepository: string;
|
|
43
|
+
constructor(hasFunctionRepository: boolean, functionRepository: string);
|
|
44
|
+
map(mapper: (value: string) => string): GeneratedFunctionRepository;
|
|
45
|
+
}
|
|
46
|
+
declare class FunctionRepositoryBuilder {
|
|
47
|
+
readonly fragments: Array<FunctionRepositoryCodeFragment>;
|
|
48
|
+
readonly consts: Array<string>;
|
|
49
|
+
private nextIndex;
|
|
50
|
+
addFunction(handlerCode: string): string;
|
|
51
|
+
addConst(constCode: string): void;
|
|
52
|
+
generate(): GeneratedFunctionRepository;
|
|
53
|
+
generateGlobalFile(): GeneratedFunctionRepository;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare function transformComponentBridge(importerMode: RuntimeMode, patterns: CompiledPattern[], globalFunctionRepository: FunctionRepositoryBuilder): (context: ts__default.TransformationContext) => ts__default.Transformer<ts__default.SourceFile>;
|
|
57
|
+
|
|
58
|
+
declare function transformComponent(patterns: CompiledPattern[], globalFunctionRepository: FunctionRepositoryBuilder): (context: ts__default.TransformationContext) => ts__default.Transformer<ts__default.SourceFile>;
|
|
59
|
+
|
|
60
|
+
declare function extractImportDeclarations(sourceFile: ts.SourceFile): ts.ImportDeclaration[];
|
|
61
|
+
declare function extractImportedModules(sourceFile: ts.SourceFile): string[];
|
|
62
|
+
declare function isRelativeImport(module: string): boolean;
|
|
63
|
+
declare function getImportSpecifiers(importDeclaration: ts.ImportDeclaration): ts.NodeArray<ts.ImportSpecifier> | undefined;
|
|
64
|
+
declare function getImportName(importSpecifier: ts.ImportSpecifier): string;
|
|
65
|
+
|
|
66
|
+
declare function generateImportsFileFromTsSource(filename: string, source: string): string;
|
|
67
|
+
declare function generateImportsFileFromJayFile(jayFile: CompilerSourceFile): string;
|
|
68
|
+
|
|
69
|
+
declare function parseGenericTypescriptFile(filePath: string, code: string): WithValidations<GenericTypescriptSourceFile>;
|
|
70
|
+
|
|
71
|
+
declare function createTsSourceFileFromSource(filePath: string, sourceCode: string, scriptKind?: ts.ScriptKind): ts.SourceFile;
|
|
72
|
+
|
|
73
|
+
declare function transformComponentImports(needsHandler$: boolean, needsFunc$: boolean, needsFuncGlobal$: boolean, transformedSourceFile: ts__default.SourceFile, context: ts__default.TransformationContext, factory: ts__default.NodeFactory, sourceFile: ts__default.SourceFile): ts__default.SourceFile;
|
|
74
|
+
|
|
75
|
+
declare function generateElementFile(jayFile: JayHtmlSourceFile, importerMode: MainRuntimeModes, generateTarget?: GenerateTarget): WithValidations<string>;
|
|
76
|
+
|
|
77
|
+
export { type CompiledPattern, FunctionRepositoryBuilder, compileFunctionSplitPatternsBlock, createTsSourceFileFromSource, extractImportDeclarations, extractImportedModules, generateElementFile, generateImportsFileFromJayFile, generateImportsFileFromTsSource, getImportName, getImportSpecifiers, isRelativeImport, parseGenericTypescriptFile, transformComponent, transformComponentBridge, transformComponentImports };
|