@monimesl/dot-compiler 0.1.0-alpha.3 → 0.1.0-alpha.31

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,33 +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: 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
13
  readonly network?: NetworkAccess | undefined;
18
- readonly dash?: DashRequirements | undefined;
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";
25
+ export declare const PAGES_DIR = "pages";
28
26
  interface PageSource {
29
27
  readonly path: string;
30
28
  readonly id: string;
29
+ readonly share: readonly string[] | null;
31
30
  readonly view: string;
32
31
  readonly state: string;
33
32
  readonly controller: string;
@@ -41,6 +40,9 @@ interface Project {
41
40
  }
42
41
  export declare function loadProject(root: string): Promise<Project>;
43
42
  //#endregion
43
+ //#region src/build/bundle.d.ts
44
+ type BuildMode = 'production' | 'development';
45
+ //#endregion
44
46
  //#region src/errors.d.ts
45
47
  export declare class CompileError extends SourceError {
46
48
  readonly name = "CompileError";
@@ -53,10 +55,10 @@ export declare class CompileWarning extends SourceError {
53
55
  //#region src/build/build.d.ts
54
56
  interface BuildOptions {
55
57
  root: string;
56
- outDir?: string;
57
- mode?: 'production' | 'development';
58
- components?: readonly ComponentManifest[];
59
- conditions?: readonly string[];
58
+ outDir?: string | undefined;
59
+ mode?: BuildMode | undefined;
60
+ components?: readonly ComponentManifest[] | undefined;
61
+ conditions?: readonly string[] | undefined;
60
62
  }
61
63
  interface BuildResult {
62
64
  readonly outDir: string;
@@ -66,18 +68,20 @@ interface BuildResult {
66
68
  /** Compiles and bundles the dot into `outDir` for hosts, and refreshes the types in `.dot/`. */
67
69
  export declare function build(options: BuildOptions): Promise<BuildResult>;
68
70
  /** What a host needs to run the build: dot.json without `$schema`, where it starts and its pages. */
69
- interface DotManifest extends Omit<DotJson, 'icon'> {
71
+ interface DotManifest extends DotJson {
70
72
  readonly runtime: string;
71
73
  readonly react: string;
72
74
  readonly entry: string;
73
75
  readonly pages: readonly string[];
74
- readonly icon: string | undefined;
76
+ readonly share: Readonly<Record<string, readonly string[]>>;
77
+ readonly dash: DashNeeds;
75
78
  }
76
79
  //#endregion
77
80
  //#region src/build/packages.d.ts
78
81
  interface InstalledRuntime {
79
82
  readonly version: string;
80
83
  readonly react: ReactHost;
84
+ readonly stylesheet: string;
81
85
  }
82
86
  interface ReactHost {
83
87
  readonly version: string;
@@ -88,11 +92,12 @@ export declare function installedRuntime(root: string): InstalledRuntime;
88
92
  //#region src/view/compiler.d.ts
89
93
  interface ViewContext {
90
94
  file: string;
91
- components?: ComponentRegistry;
92
- handlers?: readonly string[];
93
- stateKeys?: readonly string[];
94
- statics?: readonly string[];
95
- 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;
96
101
  }
97
102
  export declare const ROOT_TAG = "View";
98
103
  export declare const DATA_PREFIX = "data-";
@@ -100,13 +105,6 @@ export declare function dataKey(attribute: string): string;
100
105
  export declare function canHaveChildren(parent: ComponentManifest, child: ComponentManifest): boolean;
101
106
  //#endregion
102
107
  //#region src/view/compile.d.ts
103
- /**
104
- * Compiles `.dml` markup into a renderer-agnostic ES module:
105
- * `export default function render(d, { h, on, text, each }) { return h("View", ...) }`.
106
- *
107
- * The 'h' will be a function from the renderer to create the virtual element for a component. The
108
- * function returns the page's root element, the <View>.
109
- */
110
108
  export declare function compileView(source: string, context: ViewContext): string;
111
109
  //#endregion
112
110
  //#region src/view/control-flow.d.ts
@@ -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","../src/view/control-flow.ts","../src/project/statics.ts"],"mappings":";;;;cACa;KAwCD,sBAAsB;;;UCJjB;WACN;WACA;WACA;WACA;WAEA,sBAAsB;WAEtB;WAEA,cAAc,SAAS,QAAQ,OAAO;WACtC,UAAU;WACV,OAAO;;UAID;WAEN;;UAIM;WAEN;;;;UC1CM;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;;qBAKX;qBAMA;wBAoWG,QAAQ;wBASR,gBAAgB,QAAQ,mBAAmB,OAAO;;;;;;;;;;wBCvYlD,YAAY,gBAAgB,SAAS;;;qBCHxC,mBAAmB,SAC9B;WAA0B;WAAwC;;;;qBCAvD;wBAoBS,YAAY,eAAe"}
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"}