@monimesl/dot-compiler 0.1.0-alpha.2 → 0.1.0-alpha.23
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 +45 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +399 -307
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import "@monimesl/dot-script-parser";
|
|
2
2
|
import { ComponentManifest, ComponentRegistry, DotPermission, SourceError } from "@monimesl/dot-core";
|
|
3
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
4
|
//#region src/project/dot-json.d.ts
|
|
5
|
+
export declare const DOT_JSON_FILE = "dot.json";
|
|
6
|
+
export declare function isDotPackage(name: string): boolean;
|
|
9
7
|
interface DotJson {
|
|
10
|
-
readonly id
|
|
8
|
+
readonly id?: string | undefined;
|
|
9
|
+
readonly package: string;
|
|
11
10
|
readonly name: string;
|
|
12
11
|
readonly version: string;
|
|
13
|
-
readonly description?: string | undefined;
|
|
14
|
-
readonly categories?: readonly DotCategory[] | undefined;
|
|
15
|
-
readonly icon?: string | undefined;
|
|
16
12
|
readonly permissions?: Readonly<Partial<Record<DotPermission, string>>> | undefined;
|
|
17
|
-
readonly
|
|
13
|
+
readonly network?: NetworkAccess | undefined;
|
|
14
|
+
readonly dash?: DashNeeds | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface DashNeeds {
|
|
17
|
+
readonly minApiVersion: string;
|
|
18
18
|
}
|
|
19
|
-
interface
|
|
20
|
-
readonly
|
|
19
|
+
interface NetworkAccess {
|
|
20
|
+
readonly hosts: readonly string[];
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/project/project.d.ts
|
|
24
|
+
export declare const DOT_FILE = "dot.ts";
|
|
25
|
+
export declare const PAGES_DIR = "pages";
|
|
24
26
|
interface PageSource {
|
|
25
27
|
readonly path: string;
|
|
26
28
|
readonly id: string;
|
|
29
|
+
readonly share: readonly string[] | null;
|
|
27
30
|
readonly view: string;
|
|
28
31
|
readonly state: string;
|
|
29
32
|
readonly controller: string;
|
|
@@ -37,6 +40,9 @@ interface Project {
|
|
|
37
40
|
}
|
|
38
41
|
export declare function loadProject(root: string): Promise<Project>;
|
|
39
42
|
//#endregion
|
|
43
|
+
//#region src/build/bundle.d.ts
|
|
44
|
+
type BuildMode = 'production' | 'development';
|
|
45
|
+
//#endregion
|
|
40
46
|
//#region src/errors.d.ts
|
|
41
47
|
export declare class CompileError extends SourceError {
|
|
42
48
|
readonly name = "CompileError";
|
|
@@ -49,10 +55,10 @@ export declare class CompileWarning extends SourceError {
|
|
|
49
55
|
//#region src/build/build.d.ts
|
|
50
56
|
interface BuildOptions {
|
|
51
57
|
root: string;
|
|
52
|
-
outDir?: string;
|
|
53
|
-
mode?:
|
|
54
|
-
components?: readonly ComponentManifest[];
|
|
55
|
-
conditions?: readonly string[];
|
|
58
|
+
outDir?: string | undefined;
|
|
59
|
+
mode?: BuildMode | undefined;
|
|
60
|
+
components?: readonly ComponentManifest[] | undefined;
|
|
61
|
+
conditions?: readonly string[] | undefined;
|
|
56
62
|
}
|
|
57
63
|
interface BuildResult {
|
|
58
64
|
readonly outDir: string;
|
|
@@ -62,18 +68,20 @@ interface BuildResult {
|
|
|
62
68
|
/** Compiles and bundles the dot into `outDir` for hosts, and refreshes the types in `.dot/`. */
|
|
63
69
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
64
70
|
/** What a host needs to run the build: dot.json without `$schema`, where it starts and its pages. */
|
|
65
|
-
interface DotManifest extends
|
|
71
|
+
interface DotManifest extends DotJson {
|
|
66
72
|
readonly runtime: string;
|
|
67
73
|
readonly react: string;
|
|
68
74
|
readonly entry: string;
|
|
69
75
|
readonly pages: readonly string[];
|
|
70
|
-
readonly
|
|
76
|
+
readonly share: Readonly<Record<string, readonly string[]>>;
|
|
77
|
+
readonly dash: DashNeeds;
|
|
71
78
|
}
|
|
72
79
|
//#endregion
|
|
73
80
|
//#region src/build/packages.d.ts
|
|
74
81
|
interface InstalledRuntime {
|
|
75
82
|
readonly version: string;
|
|
76
83
|
readonly react: ReactHost;
|
|
84
|
+
readonly stylesheet: string;
|
|
77
85
|
}
|
|
78
86
|
interface ReactHost {
|
|
79
87
|
readonly version: string;
|
|
@@ -84,21 +92,30 @@ export declare function installedRuntime(root: string): InstalledRuntime;
|
|
|
84
92
|
//#region src/view/compiler.d.ts
|
|
85
93
|
interface ViewContext {
|
|
86
94
|
file: string;
|
|
87
|
-
components?: ComponentRegistry;
|
|
88
|
-
handlers?: readonly string[];
|
|
89
|
-
stateKeys?: readonly string[];
|
|
90
|
-
statics?: readonly string[];
|
|
91
|
-
onWarning?: (warning: CompileWarning) => void;
|
|
95
|
+
components?: ComponentRegistry | undefined;
|
|
96
|
+
handlers?: readonly string[] | undefined;
|
|
97
|
+
stateKeys?: readonly string[] | undefined;
|
|
98
|
+
statics?: readonly string[] | undefined;
|
|
99
|
+
onWarning?: ((warning: CompileWarning) => void) | undefined;
|
|
100
|
+
onComponent?: ((name: string) => void) | undefined;
|
|
92
101
|
}
|
|
102
|
+
export declare const ROOT_TAG = "View";
|
|
103
|
+
export declare const DATA_PREFIX = "data-";
|
|
104
|
+
export declare function dataKey(attribute: string): string;
|
|
105
|
+
export declare function canHaveChildren(parent: ComponentManifest, child: ComponentManifest): boolean;
|
|
93
106
|
//#endregion
|
|
94
107
|
//#region src/view/compile.d.ts
|
|
95
|
-
/**
|
|
96
|
-
* Compiles `.dml` markup into a renderer-agnostic ES module:
|
|
97
|
-
* `export default function render(d, { h, on, text, each }) { return [...] }`.
|
|
98
|
-
*
|
|
99
|
-
* The 'h' will be a function from the renderer to create the virtual element for a component.
|
|
100
|
-
*/
|
|
101
108
|
export declare function compileView(source: string, context: ViewContext): string;
|
|
102
109
|
//#endregion
|
|
110
|
+
//#region src/view/control-flow.d.ts
|
|
111
|
+
export declare const CONTROL_FLOW_TAGS: Readonly<Record<string, {
|
|
112
|
+
readonly attributes: readonly string[];
|
|
113
|
+
readonly required: readonly string[];
|
|
114
|
+
}>>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/project/statics.d.ts
|
|
117
|
+
export declare const STATICS_DIR = "statics";
|
|
118
|
+
export declare function listStatics(root: string): Promise<string[]>;
|
|
119
|
+
//#endregion
|
|
103
120
|
export type { BuildOptions, BuildResult, DotManifest, InstalledRuntime, PageSource, Project, ReactHost, ViewContext };
|
|
104
121
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/project/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/project/dot-json.ts","../src/project/project.ts","../src/build/bundle.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":";;;;qBAea;wBA4BG,aAAa;UAIZ;WAEN;WACA;WACA;WACA;WAEA,cAAc,SAAS,QAAQ,OAAO;WACtC,UAAU;WACV,OAAO;;UAID;WAEN;;UAID;WAEC;;;;qBCzDE;qBACA;UAOI;WAEN;WAEA;WAEA;WACA;WACA;WACA;;UAGM;WACN;WAEA,SAAS;WAET;WAEA,gBAAgB;WAEhB;;wBAGW,YAAY,eAAe,QAAQ;;;KCjC7C;;;qBCRC,qBAAqB;WACd;;;qBAIP,uBAAuB;WAChB;;;;UC4BH;EACf;EAEA;EAEA,OAAO;EACP,sBAAsB;EACtB;;UAGe;WACN;WACA;WACA,mBAAmB;;;wBAIR,MAAM,SAAS,eAAe,QAAQ;;UA4I3C,oBAAoB;WAE1B;WAEA;WACA;WACA;WAEA,OAAO,SAAS;WAEhB,MAAM;;;;UCjMA;WACN;WACA,OAAO;WAEP;;UAIM;WACN;WAEA;;wBAQK,iBAAiB,eAAe;;;UCT/B;EACf;EACA,aAAa;EAEb;EAEA;EAEA;EACA,cAAc,SAAS;EAEvB,gBAAgB;;qBAKL;qBAMA;wBAmZG,QAAQ;wBA2BR,gBAAgB,QAAQ,mBAAmB,OAAO;;;wBCndlD,YAAY,gBAAgB,SAAS;;;qBCCxC,mBAAmB,SAC9B;WAA0B;WAAwC;;;;qBCEvD;wBAoBS,YAAY,eAAe"}
|