@monimesl/dot-compiler 0.1.0-alpha.2 → 0.1.0-alpha.21

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 CHANGED
@@ -1,26 +1,24 @@
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: string;
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 dash?: DashRequirements | undefined;
13
+ readonly network?: NetworkAccess | undefined;
18
14
  }
19
- interface DashRequirements {
20
- readonly minVersion?: string | undefined;
15
+ interface NetworkAccess {
16
+ readonly hosts: readonly string[];
21
17
  }
22
18
  //#endregion
23
19
  //#region src/project/project.d.ts
20
+ export declare const DOT_FILE = "dot.ts";
21
+ export declare const PAGES_DIR = "pages";
24
22
  interface PageSource {
25
23
  readonly path: string;
26
24
  readonly id: string;
@@ -49,10 +47,10 @@ export declare class CompileWarning extends SourceError {
49
47
  //#region src/build/build.d.ts
50
48
  interface BuildOptions {
51
49
  root: string;
52
- outDir?: string;
53
- mode?: 'production' | 'development';
54
- components?: readonly ComponentManifest[];
55
- conditions?: readonly string[];
50
+ outDir?: string | undefined;
51
+ mode?: 'production' | 'development' | undefined;
52
+ components?: readonly ComponentManifest[] | undefined;
53
+ conditions?: readonly string[] | undefined;
56
54
  }
57
55
  interface BuildResult {
58
56
  readonly outDir: string;
@@ -62,18 +60,18 @@ interface BuildResult {
62
60
  /** Compiles and bundles the dot into `outDir` for hosts, and refreshes the types in `.dot/`. */
63
61
  export declare function build(options: BuildOptions): Promise<BuildResult>;
64
62
  /** What a host needs to run the build: dot.json without `$schema`, where it starts and its pages. */
65
- interface DotManifest extends Omit<DotJson, 'icon'> {
63
+ interface DotManifest extends DotJson {
66
64
  readonly runtime: string;
67
65
  readonly react: string;
68
66
  readonly entry: string;
69
67
  readonly pages: readonly string[];
70
- readonly icon: string | undefined;
71
68
  }
72
69
  //#endregion
73
70
  //#region src/build/packages.d.ts
74
71
  interface InstalledRuntime {
75
72
  readonly version: string;
76
73
  readonly react: ReactHost;
74
+ readonly stylesheet: string;
77
75
  }
78
76
  interface ReactHost {
79
77
  readonly version: string;
@@ -84,21 +82,30 @@ export declare function installedRuntime(root: string): InstalledRuntime;
84
82
  //#region src/view/compiler.d.ts
85
83
  interface ViewContext {
86
84
  file: string;
87
- components?: ComponentRegistry;
88
- handlers?: readonly string[];
89
- stateKeys?: readonly string[];
90
- statics?: readonly string[];
91
- onWarning?: (warning: CompileWarning) => void;
85
+ components?: ComponentRegistry | undefined;
86
+ handlers?: readonly string[] | undefined;
87
+ stateKeys?: readonly string[] | undefined;
88
+ statics?: readonly string[] | undefined;
89
+ onWarning?: ((warning: CompileWarning) => void) | undefined;
90
+ onComponent?: ((name: string) => void) | undefined;
92
91
  }
92
+ export declare const ROOT_TAG = "View";
93
+ export declare const DATA_PREFIX = "data-";
94
+ export declare function dataKey(attribute: string): string;
95
+ export declare function canHaveChildren(parent: ComponentManifest, child: ComponentManifest): boolean;
93
96
  //#endregion
94
97
  //#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
98
  export declare function compileView(source: string, context: ViewContext): string;
102
99
  //#endregion
100
+ //#region src/view/control-flow.d.ts
101
+ export declare const CONTROL_FLOW_TAGS: Readonly<Record<string, {
102
+ readonly attributes: readonly string[];
103
+ readonly required: readonly string[];
104
+ }>>;
105
+ //#endregion
106
+ //#region src/project/statics.d.ts
107
+ export declare const STATICS_DIR = "statics";
108
+ export declare function listStatics(root: string): Promise<string[]>;
109
+ //#endregion
103
110
  export type { BuildOptions, BuildResult, DotManifest, InstalledRuntime, PageSource, Project, ReactHost, ViewContext };
104
111
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"],"mappings":";;;;cACa;KAwCD,sBAAsB;;;UCNjB;WACN;WACA;WACA;WACA;WAEA,sBAAsB;WAEtB;WAEA,cAAc,SAAS,QAAQ,OAAO;WACtC,OAAO;;UAID;WAEN;;;;UCjCM;WAEN;WAEA;WACA;WACA;WACA;;UAGM;WACN;WAEA,SAAS;WAET;WAEA,gBAAgB;WAEhB;;wBAGW,YAAY,eAAe,QAAQ;;;qBCvC5C,qBAAqB;WACd;;;qBAIP,uBAAuB;WAChB;;;;UCqBH;EACf;EAEA;EAEA;EACA,sBAAsB;EACtB;;UAGe;WACN;WACA;WACA,mBAAmB;;;wBAIR,MAAM,SAAS,eAAe,QAAQ;;UAoH3C,oBAAoB,KAAK;WAE/B;WAEA;WACA;WACA;WAEA;;;;UChKM;WACN;WACA,OAAO;;UAID;WACN;WAEA;;wBAQK,iBAAiB,eAAe;;;UCZ/B;EACf;EACA,aAAa;EAEb;EAEA;EAEA;EAEA,aAAa,SAAS;;;;;;;;;;wBCfR,YAAY,gBAAgB,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../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":";;;;qBAQa;wBA0BG,aAAa;UAIZ;WAEN;WACA;WACA;WACA;WAEA,cAAc,SAAS,QAAQ,OAAO;WACtC,UAAU;;UAIX;WAEC;;;;qBCzCE;qBACA;UAOI;WAEN;WAEA;WACA;WACA;WACA;;UAGM;WACN;WAEA,SAAS;WAET;WAEA,gBAAgB;WAEhB;;wBAGW,YAAY,eAAe,QAAQ;;;qBCvC5C,qBAAqB;WACd;;;qBAIP,uBAAuB;WAChB;;;;UCyBH;EACf;EAEA;EAEA;EACA,sBAAsB;EACtB;;UAGe;WACN;WACA;WACA,mBAAmB;;;wBAIR,MAAM,SAAS,eAAe,QAAQ;;UAuI3C,oBAAoB;WAE1B;WAEA;WACA;WACA;;;;UCrLM;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;wBA+XG,QAAQ;wBASR,gBAAgB,QAAQ,mBAAmB,OAAO;;;wBC7alD,YAAY,gBAAgB,SAAS;;;qBCCxC,mBAAmB,SAC9B;WAA0B;WAAwC;;;;qBCCvD;wBAoBS,YAAY,eAAe"}