@quenk/wml 2.13.11 → 2.14.1

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.
Files changed (60) hide show
  1. package/lib/cli.d.ts +8 -8
  2. package/lib/cli.js +1 -3
  3. package/lib/cli.js.map +1 -1
  4. package/lib/cli.ts +48 -60
  5. package/lib/compile/codegen.d.ts +4 -9
  6. package/lib/compile/codegen.js +161 -367
  7. package/lib/compile/codegen.js.map +1 -1
  8. package/lib/compile/codegen.ts +643 -952
  9. package/lib/compile/index.d.ts +2 -2
  10. package/lib/compile/index.js +4 -4
  11. package/lib/compile/index.js.map +1 -1
  12. package/lib/compile/index.ts +14 -17
  13. package/lib/compile/transform.d.ts +1 -1
  14. package/lib/compile/transform.js +9 -11
  15. package/lib/compile/transform.js.map +1 -1
  16. package/lib/compile/transform.ts +136 -143
  17. package/lib/{dom.d.ts → dom/index.d.ts} +8 -2
  18. package/lib/{dom.js → dom/index.js} +84 -70
  19. package/lib/dom/index.js.map +1 -0
  20. package/lib/dom/index.ts +425 -0
  21. package/lib/dom/monitor.d.ts +33 -0
  22. package/lib/dom/monitor.js +60 -0
  23. package/lib/dom/monitor.js.map +1 -0
  24. package/lib/dom/monitor.ts +75 -0
  25. package/lib/index.d.ts +10 -95
  26. package/lib/index.js +10 -10
  27. package/lib/index.js.map +1 -1
  28. package/lib/index.ts +57 -182
  29. package/lib/main.js +17 -17
  30. package/lib/main.js.map +1 -1
  31. package/lib/main.ts +38 -44
  32. package/lib/parse/ast.d.ts +2 -2
  33. package/lib/parse/ast.js +52 -53
  34. package/lib/parse/ast.js.map +1 -1
  35. package/lib/parse/ast.ts +396 -483
  36. package/lib/parse/generated.d.ts +3 -5
  37. package/lib/parse/generated.js +9504 -9264
  38. package/lib/parse/index.d.ts +2 -3
  39. package/lib/parse/index.js.map +1 -1
  40. package/lib/parse/index.ts +7 -9
  41. package/lib/parse/test.js +194 -192
  42. package/lib/parse/test.js.map +1 -1
  43. package/lib/parse/test.ts +294 -404
  44. package/lib/parse/wml.y +4 -0
  45. package/lib/tsconfig.json +19 -20
  46. package/lib/util.d.ts +10 -0
  47. package/lib/util.js +21 -0
  48. package/lib/util.js.map +1 -0
  49. package/lib/util.ts +39 -0
  50. package/lib/view/frame.d.ts +127 -0
  51. package/lib/view/frame.js +214 -0
  52. package/lib/view/frame.js.map +1 -0
  53. package/lib/view/frame.ts +295 -0
  54. package/lib/view/index.d.ts +58 -0
  55. package/lib/view/index.js +48 -0
  56. package/lib/view/index.js.map +1 -0
  57. package/lib/view/index.ts +98 -0
  58. package/package.json +3 -3
  59. package/lib/dom.js.map +0 -1
  60. package/lib/dom.ts +0 -479
package/lib/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Future } from '@quenk/noni/lib/control/monad/future';
2
- import { Options } from './compile';
1
+ import { Future } from "@quenk/noni/lib/control/monad/future";
2
+ import { Options } from "./compile";
3
3
  /**
4
4
  * CLIOptions
5
5
  */
@@ -18,12 +18,12 @@ export interface CLIOptions extends Partial<Options> {
18
18
  * Arguments passed on the command line.
19
19
  */
20
20
  export interface Arguments {
21
- '--main': string;
22
- '--outputExtension': string;
23
- '--inputExtension': string;
24
- '--module': string;
25
- '--dom': string;
26
- '<path>': string;
21
+ "--main": string;
22
+ "--outputExtension": string;
23
+ "--inputExtension": string;
24
+ "--module": string;
25
+ "--dom": string;
26
+ "<path>": string;
27
27
  }
28
28
  /**
29
29
  * compileDir will compile each wml file found in the specified path.
package/lib/cli.js CHANGED
@@ -9,9 +9,7 @@ const compile_1 = require("./compile");
9
9
  * compileDir will compile each wml file found in the specified path.
10
10
  */
11
11
  const compileDir = (path, opts) => (0, file_1.listFilesRec)(path)
12
- .map(list => list
13
- .map(p => (0, path_1.resolve)(path, p))
14
- .map(p => (0, exports.compileFile)(p, opts)))
12
+ .map((list) => list.map((p) => (0, path_1.resolve)(path, p)).map((p) => (0, exports.compileFile)(p, opts)))
15
13
  .chain(future_1.parallel);
16
14
  exports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,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvD,IAAI,GAAG,GAAG,MAAM,IAAA,mBAAY,EAAC,IAAI,CAAC,CAAC;QAEnC,IAAI,QAAQ,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAElC,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACtB,IAAI,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;YAEtC,OAAO,IAAA,cAAK,EACV,IAAI,KAAK,CAAC,mCAAmC,IAAI,QAAQ,GAAG,EAAE,CAAC,CAChE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAA,oBAAa,EAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,iBAAQ,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAvBQ,QAAA,WAAW,eAuBnB;AAEL,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CACnC,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,IAAI,IAAA,eAAQ,EAAC,IAAI,EAAE,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC"}
package/lib/cli.ts CHANGED
@@ -1,68 +1,63 @@
1
- import { dirname, basename, resolve, extname } from 'path';
1
+ import { dirname, basename, resolve, extname } from "path";
2
2
 
3
3
  import {
4
- Future,
5
- pure,
6
- raise,
7
- parallel,
8
- doFuture,
9
- voidPure
10
- } from '@quenk/noni/lib/control/monad/future';
4
+ Future,
5
+ pure,
6
+ raise,
7
+ parallel,
8
+ doFuture,
9
+ voidPure,
10
+ } from "@quenk/noni/lib/control/monad/future";
11
11
  import {
12
- listFilesRec,
13
- readTextFile,
14
- writeTextFile
15
- } from '@quenk/noni/lib/io/file';
12
+ listFilesRec,
13
+ readTextFile,
14
+ writeTextFile,
15
+ } from "@quenk/noni/lib/io/file";
16
16
 
17
- import { Options, compile } from './compile';
17
+ import { Options, compile } from "./compile";
18
18
 
19
19
  /**
20
20
  * CLIOptions
21
21
  */
22
22
  export interface CLIOptions extends Partial<Options> {
23
-
24
- /**
25
- * inputExtension is the file extension used when searching for files to
26
- * compile.
27
- */
28
- inputExtension: string,
29
-
30
- /**
31
- * outputExtension is the file extension used when outputing directly to file.
32
- */
33
- outputExtension: string
34
-
23
+ /**
24
+ * inputExtension is the file extension used when searching for files to
25
+ * compile.
26
+ */
27
+ inputExtension: string;
28
+
29
+ /**
30
+ * outputExtension is the file extension used when outputing directly to file.
31
+ */
32
+ outputExtension: string;
35
33
  }
36
34
 
37
35
  /**
38
36
  * Arguments passed on the command line.
39
37
  */
40
38
  export interface Arguments {
39
+ "--main": string;
41
40
 
42
- '--main': string,
43
-
44
- '--outputExtension': string,
41
+ "--outputExtension": string;
45
42
 
46
- '--inputExtension': string,
43
+ "--inputExtension": string;
47
44
 
48
- '--module': string,
45
+ "--module": string;
49
46
 
50
- '--dom': string,
51
-
52
- '<path>': string
47
+ "--dom": string;
53
48
 
49
+ "<path>": string;
54
50
  }
55
51
 
56
52
  /**
57
53
  * compileDir will compile each wml file found in the specified path.
58
54
  */
59
55
  export const compileDir = (path: string, opts: CLIOptions) =>
60
- listFilesRec(path)
61
- .map(list =>
62
- list
63
- .map(p => resolve(path, p))
64
- .map(p => compileFile(p, opts)))
65
- .chain(parallel);
56
+ listFilesRec(path)
57
+ .map((list) =>
58
+ list.map((p) => resolve(path, p)).map((p) => compileFile(p, opts)),
59
+ )
60
+ .chain(parallel);
66
61
 
67
62
  /**
68
63
  * compileFile will compile a single wml file.
@@ -70,37 +65,30 @@ export const compileDir = (path: string, opts: CLIOptions) =>
70
65
  * If that file does not have the specified inputExtension, it will be
71
66
  * ignored.
72
67
  */
73
- export const compileFile = (path: string, opts: CLIOptions) : Future<void> =>
74
- doFuture(function*() {
75
-
68
+ export const compileFile = (path: string, opts: CLIOptions): Future<void> =>
69
+ doFuture(function* () {
76
70
  if (extname(path) !== `.${opts.inputExtension}`) {
77
-
78
- return pure(<void>undefined);
79
-
71
+ return pure(<void>undefined);
80
72
  } else {
73
+ let p = `${getFileName(path)}.${opts.outputExtension}`;
81
74
 
82
- let p = `${getFileName(path)}.${opts.outputExtension}`;
83
-
84
- let buf = yield readTextFile(path);
85
-
86
- let eitherTs = compile(buf, opts);
75
+ let buf = yield readTextFile(path);
87
76
 
88
- if(eitherTs.isLeft()) {
77
+ let eitherTs = compile(buf, opts);
89
78
 
79
+ if (eitherTs.isLeft()) {
90
80
  let msg = eitherTs.takeLeft().message;
91
-
92
- return raise(new Error(
93
- `Error occurred while compiling "${path}":\n ${msg}`));
94
81
 
82
+ return raise(
83
+ new Error(`Error occurred while compiling "${path}":\n ${msg}`),
84
+ );
95
85
  } else {
96
-
97
- yield writeTextFile(p, eitherTs.takeRight());
98
- }
86
+ yield writeTextFile(p, eitherTs.takeRight());
87
+ }
99
88
 
100
89
  return voidPure;
101
-
102
90
  }
103
- });
91
+ });
104
92
 
105
93
  const getFileName = (file: string) =>
106
- `${dirname(file)}/${basename(file, extname(file))}`;
94
+ `${dirname(file)}/${basename(file, extname(file))}`;
@@ -2,13 +2,15 @@
2
2
  * Typescript code generator.
3
3
  */
4
4
  /** imports */
5
- import * as ast from '../parse/ast';
6
- import { Record } from '@quenk/noni/lib/data/record';
5
+ import * as ast from "../parse/ast";
6
+ import { Record } from "@quenk/noni/lib/data/record";
7
7
  export declare const CONTEXT = "__context";
8
8
  export declare const VIEW = "__view";
9
9
  export declare const WML = "__wml";
10
10
  export declare const DOCUMENT = "__document";
11
+ export declare const UTILS = "__utils";
11
12
  export declare const THIS = "__this";
13
+ export declare const VIEW_FRAME = "__viewFrame";
12
14
  /**
13
15
  * TypeScript code.
14
16
  */
@@ -111,13 +113,6 @@ export declare const contextStatement2TS: (n: ast.ContextStatement) => string;
111
113
  * letStatement2TS
112
114
  */
113
115
  export declare const letStatement2TS: (ctx: CodeGenerator, n: ast.LetStatement) => string;
114
- /**
115
- * funStatement2TS generates Typescript output for fun statements.
116
- *
117
- * This is a curried function that first accepts zero or more arguments then
118
- * a single Registry, finally the content.
119
- */
120
- export declare const funStatement2TS: (ctx: CodeGenerator, n: ast.FunStatement) => string;
121
116
  /**
122
117
  * viewStatement2TS converts a ViewStatement to its typescript form.
123
118
  *