@monimesl/dot-compiler 0.1.0-alpha.8 → 1.0.0-beta.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 +28 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +284 -295
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import "@monimesl/dot-script-parser";
|
|
2
|
-
import { ComponentManifest, ComponentRegistry,
|
|
2
|
+
import { ComponentManifest, ComponentRegistry, DotJsonPermission, 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
|
|
14
|
-
readonly categories?: readonly DotCategory[] | undefined;
|
|
15
|
-
readonly icon?: string | undefined;
|
|
16
|
-
readonly permissions?: Readonly<Partial<Record<DotPermission, string>>> | undefined;
|
|
12
|
+
readonly permissions?: Readonly<Partial<Record<DotJsonPermission, string>>> | undefined;
|
|
17
13
|
readonly network?: NetworkAccess | undefined;
|
|
18
|
-
readonly dash?:
|
|
14
|
+
readonly dash?: DashNeeds | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface DashNeeds {
|
|
17
|
+
readonly minApiVersion: string;
|
|
19
18
|
}
|
|
20
19
|
interface NetworkAccess {
|
|
21
20
|
readonly hosts: readonly string[];
|
|
22
21
|
}
|
|
23
|
-
interface DashRequirements {
|
|
24
|
-
readonly minVersion?: string | undefined;
|
|
25
|
-
}
|
|
26
22
|
//#endregion
|
|
27
23
|
//#region src/project/project.d.ts
|
|
24
|
+
export declare const DOT_FILE = "dot.ts";
|
|
28
25
|
export declare const PAGES_DIR = "pages";
|
|
29
26
|
interface PageSource {
|
|
30
27
|
readonly path: string;
|
|
31
28
|
readonly id: string;
|
|
29
|
+
readonly share: readonly string[] | null;
|
|
32
30
|
readonly view: string;
|
|
33
31
|
readonly state: string;
|
|
34
32
|
readonly controller: string;
|
|
@@ -42,6 +40,9 @@ interface Project {
|
|
|
42
40
|
}
|
|
43
41
|
export declare function loadProject(root: string): Promise<Project>;
|
|
44
42
|
//#endregion
|
|
43
|
+
//#region src/build/bundle.d.ts
|
|
44
|
+
type BuildMode = 'production' | 'development';
|
|
45
|
+
//#endregion
|
|
45
46
|
//#region src/errors.d.ts
|
|
46
47
|
export declare class CompileError extends SourceError {
|
|
47
48
|
readonly name = "CompileError";
|
|
@@ -54,10 +55,10 @@ export declare class CompileWarning extends SourceError {
|
|
|
54
55
|
//#region src/build/build.d.ts
|
|
55
56
|
interface BuildOptions {
|
|
56
57
|
root: string;
|
|
57
|
-
outDir?: string;
|
|
58
|
-
mode?:
|
|
59
|
-
components?: readonly ComponentManifest[];
|
|
60
|
-
conditions?: readonly string[];
|
|
58
|
+
outDir?: string | undefined;
|
|
59
|
+
mode?: BuildMode | undefined;
|
|
60
|
+
components?: readonly ComponentManifest[] | undefined;
|
|
61
|
+
conditions?: readonly string[] | undefined;
|
|
61
62
|
}
|
|
62
63
|
interface BuildResult {
|
|
63
64
|
readonly outDir: string;
|
|
@@ -67,12 +68,13 @@ interface BuildResult {
|
|
|
67
68
|
/** Compiles and bundles the dot into `outDir` for hosts, and refreshes the types in `.dot/`. */
|
|
68
69
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
69
70
|
/** What a host needs to run the build: dot.json without `$schema`, where it starts and its pages. */
|
|
70
|
-
interface DotManifest extends
|
|
71
|
+
interface DotManifest extends DotJson {
|
|
71
72
|
readonly runtime: string;
|
|
72
73
|
readonly react: string;
|
|
73
74
|
readonly entry: string;
|
|
74
75
|
readonly pages: readonly string[];
|
|
75
|
-
readonly
|
|
76
|
+
readonly share: Readonly<Record<string, readonly string[]>>;
|
|
77
|
+
readonly dash: DashNeeds;
|
|
76
78
|
}
|
|
77
79
|
//#endregion
|
|
78
80
|
//#region src/build/packages.d.ts
|
|
@@ -90,11 +92,12 @@ export declare function installedRuntime(root: string): InstalledRuntime;
|
|
|
90
92
|
//#region src/view/compiler.d.ts
|
|
91
93
|
interface ViewContext {
|
|
92
94
|
file: string;
|
|
93
|
-
components?: ComponentRegistry;
|
|
94
|
-
handlers?: readonly string[];
|
|
95
|
-
stateKeys?: readonly string[];
|
|
96
|
-
statics?: readonly string[];
|
|
97
|
-
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;
|
|
98
101
|
}
|
|
99
102
|
export declare const ROOT_TAG = "View";
|
|
100
103
|
export declare const DATA_PREFIX = "data-";
|
|
@@ -102,13 +105,6 @@ export declare function dataKey(attribute: string): string;
|
|
|
102
105
|
export declare function canHaveChildren(parent: ComponentManifest, child: ComponentManifest): boolean;
|
|
103
106
|
//#endregion
|
|
104
107
|
//#region src/view/compile.d.ts
|
|
105
|
-
/**
|
|
106
|
-
* Compiles `.dml` markup into a renderer-agnostic ES module:
|
|
107
|
-
* `export default function render(d, { h, on, text, each }) { return h("View", ...) }`.
|
|
108
|
-
*
|
|
109
|
-
* The 'h' will be a function from the renderer to create the virtual element for a component. The
|
|
110
|
-
* function returns the page's root element, the <View>.
|
|
111
|
-
*/
|
|
112
108
|
export declare function compileView(source: string, context: ViewContext): string;
|
|
113
109
|
//#endregion
|
|
114
110
|
//#region src/view/control-flow.d.ts
|
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;;;;UC+BH;EACf;EAEA;EAEA,OAAO;EACP,sBAAsB;EACtB;;UAGe;WACN;WACA;WACA,mBAAmB;;;wBAIR,MAAM,SAAS,eAAe,QAAQ;;UA2J3C,oBAAoB;WAE1B;WAEA;WACA;WACA;WAEA,OAAO,SAAS;WAEhB,MAAM;;;;UCnNA;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"}
|