@monimesl/dot-compiler 0.1.0-alpha.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.
- package/README.md +1 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1013 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @monimesl/dot-compiler
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import "@monimesl/dot-script-parser";
|
|
2
|
+
import { ComponentManifest, ComponentRegistry, DotPermission, SourceError } from "@monimesl/dot-core";
|
|
3
|
+
import "@monimesl/dot-dml-parser";
|
|
4
|
+
//#region src/project/categories.d.ts
|
|
5
|
+
declare const CATEGORIES: readonly ["agriculture", "asset_finance", "donations", "education", "electricity", "entertainment", "events", "finance", "food_and_drink", "gambling", "games", "government", "health", "insurance", "internet_service_provider", "investments", "jobs", "lifestyle", "loans", "micro_credit", "microfinance", "news", "other", "productivity", "real_estate", "religion", "remittances", "savings", "shopping", "social", "sports", "telecom", "television", "transport", "travel", "utilities", "water"];
|
|
6
|
+
type DotCategory = (typeof CATEGORIES)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/project/dot-json.d.ts
|
|
9
|
+
interface DotJson {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
readonly description?: string | undefined;
|
|
14
|
+
readonly categories?: readonly DotCategory[] | undefined;
|
|
15
|
+
readonly icon?: string | undefined;
|
|
16
|
+
readonly permissions?: Readonly<Partial<Record<DotPermission, string>>> | undefined;
|
|
17
|
+
readonly network?: NetworkAccess | undefined;
|
|
18
|
+
readonly dash?: DashRequirements | undefined;
|
|
19
|
+
}
|
|
20
|
+
interface NetworkAccess {
|
|
21
|
+
readonly hosts: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
interface DashRequirements {
|
|
24
|
+
readonly minVersion?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/project/project.d.ts
|
|
28
|
+
export declare const PAGES_DIR = "pages";
|
|
29
|
+
interface PageSource {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly view: string;
|
|
33
|
+
readonly state: string;
|
|
34
|
+
readonly controller: string;
|
|
35
|
+
}
|
|
36
|
+
interface Project {
|
|
37
|
+
readonly root: string;
|
|
38
|
+
readonly dotJson: DotJson;
|
|
39
|
+
readonly dot: string;
|
|
40
|
+
readonly pages: readonly PageSource[];
|
|
41
|
+
readonly statics: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export declare function loadProject(root: string): Promise<Project>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/errors.d.ts
|
|
46
|
+
export declare class CompileError extends SourceError {
|
|
47
|
+
readonly name = "CompileError";
|
|
48
|
+
}
|
|
49
|
+
/** A problem that does not stop compilation. */
|
|
50
|
+
export declare class CompileWarning extends SourceError {
|
|
51
|
+
readonly name = "CompileWarning";
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/build/build.d.ts
|
|
55
|
+
interface BuildOptions {
|
|
56
|
+
root: string;
|
|
57
|
+
outDir?: string | undefined;
|
|
58
|
+
mode?: 'production' | 'development' | undefined;
|
|
59
|
+
components?: readonly ComponentManifest[] | undefined;
|
|
60
|
+
conditions?: readonly string[] | undefined;
|
|
61
|
+
}
|
|
62
|
+
interface BuildResult {
|
|
63
|
+
readonly outDir: string;
|
|
64
|
+
readonly files: readonly string[];
|
|
65
|
+
readonly warnings: readonly CompileWarning[];
|
|
66
|
+
}
|
|
67
|
+
/** Compiles and bundles the dot into `outDir` for hosts, and refreshes the types in `.dot/`. */
|
|
68
|
+
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
69
|
+
/** What a host needs to run the build: dot.json without `$schema`, where it starts and its pages. */
|
|
70
|
+
interface DotManifest extends Omit<DotJson, 'icon'> {
|
|
71
|
+
readonly runtime: string;
|
|
72
|
+
readonly react: string;
|
|
73
|
+
readonly entry: string;
|
|
74
|
+
readonly pages: readonly string[];
|
|
75
|
+
readonly icon: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/build/packages.d.ts
|
|
79
|
+
interface InstalledRuntime {
|
|
80
|
+
readonly version: string;
|
|
81
|
+
readonly react: ReactHost;
|
|
82
|
+
readonly stylesheet: string;
|
|
83
|
+
}
|
|
84
|
+
interface ReactHost {
|
|
85
|
+
readonly version: string;
|
|
86
|
+
readonly dir: string;
|
|
87
|
+
}
|
|
88
|
+
export declare function installedRuntime(root: string): InstalledRuntime;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/view/compiler.d.ts
|
|
91
|
+
interface ViewContext {
|
|
92
|
+
file: string;
|
|
93
|
+
components?: ComponentRegistry | undefined;
|
|
94
|
+
handlers?: readonly string[] | undefined;
|
|
95
|
+
stateKeys?: readonly string[] | undefined;
|
|
96
|
+
statics?: readonly string[] | undefined;
|
|
97
|
+
onWarning?: ((warning: CompileWarning) => void) | undefined;
|
|
98
|
+
onComponent?: ((name: string) => void) | undefined;
|
|
99
|
+
}
|
|
100
|
+
export declare const ROOT_TAG = "View";
|
|
101
|
+
export declare const DATA_PREFIX = "data-";
|
|
102
|
+
export declare function dataKey(attribute: string): string;
|
|
103
|
+
export declare function canHaveChildren(parent: ComponentManifest, child: ComponentManifest): boolean;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/view/compile.d.ts
|
|
106
|
+
export declare function compileView(source: string, context: ViewContext): string;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/view/control-flow.d.ts
|
|
109
|
+
export declare const CONTROL_FLOW_TAGS: Readonly<Record<string, {
|
|
110
|
+
readonly attributes: readonly string[];
|
|
111
|
+
readonly required: readonly string[];
|
|
112
|
+
}>>;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/project/statics.d.ts
|
|
115
|
+
export declare const STATICS_DIR = "statics";
|
|
116
|
+
export declare function listStatics(root: string): Promise<string[]>;
|
|
117
|
+
//#endregion
|
|
118
|
+
export type { BuildOptions, BuildResult, DotManifest, InstalledRuntime, PageSource, Project, ReactHost, ViewContext };
|
|
119
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/project/categories.ts","../src/project/dot-json.ts","../src/project/project.ts","../src/errors.ts","../src/build/build.ts","../src/build/packages.ts","../src/view/compiler.ts","../src/view/compile.ts","../src/view/control-flow.ts","../src/project/statics.ts"],"mappings":";;;;cACa;KAwCD,sBAAsB;;;UCLjB;WACN;WACA;WACA;WACA;WAEA,sBAAsB;WAEtB;WAEA,cAAc,SAAS,QAAQ,OAAO;WACtC,UAAU;WACV,OAAO;;UAIR;WAEC;;UAID;WAEC;;;;qBChDE;UAOI;WAEN;WAEA;WACA;WACA;WACA;;UAGM;WACN;WAEA,SAAS;WAET;WAEA,gBAAgB;WAEhB;;wBAGW,YAAY,eAAe,QAAQ;;;qBCvC5C,qBAAqB;WACd;;;qBAIP,uBAAuB;WAChB;;;;UC0BH;EACf;EAEA;EAEA;EACA,sBAAsB;EACtB;;UAGe;WACN;WACA;WACA,mBAAmB;;;wBAIR,MAAM,SAAS,eAAe,QAAQ;;UAqJ3C,oBAAoB,KAAK;WAE/B;WAEA;WACA;WACA;WAEA;;;;UCtMM;WACN;WACA,OAAO;WAEP;;UAIM;WACN;WAEA;;wBAQK,iBAAiB,eAAe;;;UCb/B;EACf;EACA,aAAa;EAEb;EAEA;EAEA;EACA,cAAc,SAAS;EAEvB,gBAAgB;;qBAKL;qBAMA;wBAgWG,QAAQ;wBASR,gBAAgB,QAAQ,mBAAmB,OAAO;;;wBC1YlD,YAAY,gBAAgB,SAAS;;;qBCCxC,mBAAmB,SAC9B;WAA0B;WAAwC;;;;qBCCvD;wBAoBS,YAAY,eAAe"}
|