@jay-framework/compiler-jay-html 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 +96 -0
- package/dist/index.js +6464 -0
- package/docs/compiler-patterns.md +145 -0
- package/docs/contract-file-format.md +297 -0
- package/docs/jay-html-docs.md +178 -0
- package/package.json +62 -0
- package/readme.md +115 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CompilerSourceFile, SourceFileFormat, JayType, RefsTree, JayImportLink, WithValidations, MainRuntimeModes, JayEnumType, GenerateTarget, Imports } from '@jay-framework/compiler-shared';
|
|
2
|
+
import { HTMLElement } from 'node-html-parser';
|
|
3
|
+
import { ResolveTsConfigOptions } from '@jay-framework/compiler-analyze-exported-types';
|
|
4
|
+
|
|
5
|
+
interface JayHtmlNamespace {
|
|
6
|
+
prefix: string;
|
|
7
|
+
namespace: string;
|
|
8
|
+
}
|
|
9
|
+
interface JayHeadlessImports {
|
|
10
|
+
key: string;
|
|
11
|
+
refs: RefsTree;
|
|
12
|
+
rootType: JayType;
|
|
13
|
+
contractLinks: JayImportLink[];
|
|
14
|
+
codeLink: JayImportLink;
|
|
15
|
+
}
|
|
16
|
+
interface JayHtmlSourceFile extends CompilerSourceFile {
|
|
17
|
+
format: SourceFileFormat.JayHtml;
|
|
18
|
+
baseElementName: string;
|
|
19
|
+
types: JayType;
|
|
20
|
+
body: HTMLElement;
|
|
21
|
+
namespaces: JayHtmlNamespace[];
|
|
22
|
+
headlessImports: JayHeadlessImports[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare function generateElementDefinitionFile(parsedFile: WithValidations<JayHtmlSourceFile>): WithValidations<string>;
|
|
26
|
+
declare function generateElementFile(jayFile: JayHtmlSourceFile, importerMode: MainRuntimeModes): WithValidations<string>;
|
|
27
|
+
declare function generateElementBridgeFile(jayFile: JayHtmlSourceFile): string;
|
|
28
|
+
declare function generateSandboxRootFile(jayFile: JayHtmlSourceFile): string;
|
|
29
|
+
|
|
30
|
+
declare function generateElementFileReactTarget(jayFile: JayHtmlSourceFile, importerMode: MainRuntimeModes): WithValidations<string>;
|
|
31
|
+
|
|
32
|
+
declare enum ContractTagType {
|
|
33
|
+
data = 0,
|
|
34
|
+
interactive = 1,
|
|
35
|
+
variant = 2,
|
|
36
|
+
subContract = 3
|
|
37
|
+
}
|
|
38
|
+
interface ContractTag {
|
|
39
|
+
tag: string;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
type: Array<ContractTagType>;
|
|
42
|
+
dataType?: JayType;
|
|
43
|
+
elementType?: Array<string>;
|
|
44
|
+
description?: Array<string>;
|
|
45
|
+
tags?: Array<ContractTag>;
|
|
46
|
+
repeated?: boolean;
|
|
47
|
+
link?: string;
|
|
48
|
+
}
|
|
49
|
+
interface Contract {
|
|
50
|
+
name: string;
|
|
51
|
+
tags: Array<ContractTag>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare function compileContract(contractWithValidations: WithValidations<Contract>, contractFilePath: string, jayImportResolver: JayImportResolver): Promise<WithValidations<string>>;
|
|
55
|
+
|
|
56
|
+
declare function parseContract(contractYaml: string, fileName: string): WithValidations<Contract>;
|
|
57
|
+
|
|
58
|
+
interface JayContractImportLink {
|
|
59
|
+
module: string;
|
|
60
|
+
viewState: string;
|
|
61
|
+
refs: string;
|
|
62
|
+
repeatedRefs: string;
|
|
63
|
+
}
|
|
64
|
+
interface EnumToImport {
|
|
65
|
+
declaringModule: string;
|
|
66
|
+
type: JayEnumType;
|
|
67
|
+
}
|
|
68
|
+
interface SubContractTraverseResult {
|
|
69
|
+
type?: JayType;
|
|
70
|
+
refs: RefsTree;
|
|
71
|
+
importLinks: JayContractImportLink[];
|
|
72
|
+
enumsToImport: EnumToImport[];
|
|
73
|
+
}
|
|
74
|
+
declare function contractToImportsViewStateAndRefs(contract: Contract, contractFilePath: string, jayImportResolver: JayImportResolver, isRepeated?: boolean): Promise<WithValidations<SubContractTraverseResult>>;
|
|
75
|
+
|
|
76
|
+
interface JayImportResolver {
|
|
77
|
+
resolveLink(importingModuleDir: string, link: string): string;
|
|
78
|
+
loadContract(fullPath: string): WithValidations<Contract>;
|
|
79
|
+
analyzeExportedTypes(fullPath: string, options: ResolveTsConfigOptions): JayType[];
|
|
80
|
+
}
|
|
81
|
+
declare const JAY_IMPORT_RESOLVER: JayImportResolver;
|
|
82
|
+
|
|
83
|
+
declare function parseJayFile(html: string, filename: string, filePath: string, options: ResolveTsConfigOptions, linkedContractResolver: JayImportResolver): Promise<WithValidations<JayHtmlSourceFile>>;
|
|
84
|
+
declare function getJayHtmlImports(html: string): string[];
|
|
85
|
+
|
|
86
|
+
declare function parseIsEnum(expression: string): boolean;
|
|
87
|
+
declare function parseEnumValues(expression: string): string[];
|
|
88
|
+
|
|
89
|
+
declare function renderRefsType(refs: RefsTree, refsType: string, generateTarget?: GenerateTarget): {
|
|
90
|
+
imports: Imports;
|
|
91
|
+
renderedRefs: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare function generateTypes(types: JayType): string;
|
|
95
|
+
|
|
96
|
+
export { type Contract, type ContractTag, ContractTagType, type EnumToImport, JAY_IMPORT_RESOLVER, type JayContractImportLink, type JayHtmlSourceFile, type JayImportResolver, compileContract, contractToImportsViewStateAndRefs, generateElementBridgeFile, generateElementDefinitionFile, generateElementFile, generateElementFileReactTarget, generateSandboxRootFile, generateTypes, getJayHtmlImports, parseContract, parseEnumValues, parseIsEnum, parseJayFile, renderRefsType };
|