@quenk/wml 2.13.10 → 2.14.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/lib/cli.d.ts +8 -8
- package/lib/cli.js +1 -3
- package/lib/cli.js.map +1 -1
- package/lib/cli.ts +48 -60
- package/lib/compile/codegen.d.ts +4 -9
- package/lib/compile/codegen.js +164 -369
- package/lib/compile/codegen.js.map +1 -1
- package/lib/compile/codegen.ts +644 -952
- package/lib/compile/index.d.ts +2 -2
- package/lib/compile/index.js +4 -4
- package/lib/compile/index.js.map +1 -1
- package/lib/compile/index.ts +14 -17
- package/lib/compile/transform.d.ts +8 -6
- package/lib/compile/transform.js +46 -18
- package/lib/compile/transform.js.map +1 -1
- package/lib/compile/transform.ts +139 -116
- package/lib/{dom.d.ts → dom/index.d.ts} +8 -2
- package/lib/{dom.js → dom/index.js} +84 -66
- package/lib/dom/index.js.map +1 -0
- package/lib/dom/index.ts +425 -0
- package/lib/dom/monitor.d.ts +33 -0
- package/lib/dom/monitor.js +60 -0
- package/lib/dom/monitor.js.map +1 -0
- package/lib/dom/monitor.ts +75 -0
- package/lib/index.d.ts +10 -95
- package/lib/index.js +10 -10
- package/lib/index.js.map +1 -1
- package/lib/index.ts +57 -182
- package/lib/main.js +17 -17
- package/lib/main.js.map +1 -1
- package/lib/main.ts +38 -44
- package/lib/parse/ast.d.ts +12 -6
- package/lib/parse/ast.js +68 -58
- package/lib/parse/ast.js.map +1 -1
- package/lib/parse/ast.ts +400 -482
- package/lib/parse/generated.d.ts +3 -5
- package/lib/parse/generated.js +9504 -9264
- package/lib/parse/index.d.ts +2 -3
- package/lib/parse/index.js.map +1 -1
- package/lib/parse/index.ts +7 -9
- package/lib/parse/test.js +194 -192
- package/lib/parse/test.js.map +1 -1
- package/lib/parse/test.ts +294 -404
- package/lib/parse/wml.y +4 -0
- package/lib/tsconfig.json +19 -20
- package/lib/util.d.ts +10 -0
- package/lib/util.js +21 -0
- package/lib/util.js.map +1 -0
- package/lib/util.ts +39 -0
- package/lib/view/frame.d.ts +103 -0
- package/lib/view/frame.js +206 -0
- package/lib/view/frame.js.map +1 -0
- package/lib/view/frame.ts +249 -0
- package/lib/view/index.d.ts +58 -0
- package/lib/view/index.js +48 -0
- package/lib/view/index.js.map +1 -0
- package/lib/view/index.ts +97 -0
- package/package.json +4 -3
- package/lib/dom.js.map +0 -1
- package/lib/dom.ts +0 -475
package/lib/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Future } from
|
|
2
|
-
import { Options } from
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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.compileDir = compileDir;
|
|
17
15
|
/**
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["cli.ts"],"names":[],"mappings":";;;AAAA,+BAA2D;AAE3D,iEAO8C;AAC9C,kDAIiC;AAEjC,uCAA6C;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["cli.ts"],"names":[],"mappings":";;;AAAA,+BAA2D;AAE3D,iEAO8C;AAC9C,kDAIiC;AAEjC,uCAA6C;AAmC7C;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,IAAgB,EAAE,EAAE,CAC3D,IAAA,mBAAY,EAAC,IAAI,CAAC;KACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,cAAO,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CACnE;KACA,KAAK,CAAC,iBAAQ,CAAC,CAAC;AALR,QAAA,UAAU,cAKF;AAErB;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,IAAgB,EAAgB,EAAE,CAC1E,IAAA,iBAAQ,EAAC,QAAQ,CAAC;IAChB,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QAChD,OAAO,IAAA,aAAI,EAAO,SAAS,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
|
|
1
|
+
import { dirname, basename, resolve, extname } from "path";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from
|
|
4
|
+
Future,
|
|
5
|
+
pure,
|
|
6
|
+
raise,
|
|
7
|
+
parallel,
|
|
8
|
+
doFuture,
|
|
9
|
+
voidPure,
|
|
10
|
+
} from "@quenk/noni/lib/control/monad/future";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from
|
|
12
|
+
listFilesRec,
|
|
13
|
+
readTextFile,
|
|
14
|
+
writeTextFile,
|
|
15
|
+
} from "@quenk/noni/lib/io/file";
|
|
16
16
|
|
|
17
|
-
import { Options, compile } from
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
'--outputExtension': string,
|
|
41
|
+
"--outputExtension": string;
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
"--inputExtension": string;
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
"--module": string;
|
|
49
46
|
|
|
50
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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)
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
let buf = yield readTextFile(path);
|
|
85
|
-
|
|
86
|
-
let eitherTs = compile(buf, opts);
|
|
75
|
+
let buf = yield readTextFile(path);
|
|
87
76
|
|
|
88
|
-
|
|
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
|
-
|
|
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
|
-
|
|
94
|
+
`${dirname(file)}/${basename(file, extname(file))}`;
|
package/lib/compile/codegen.d.ts
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* Typescript code generator.
|
|
3
3
|
*/
|
|
4
4
|
/** imports */
|
|
5
|
-
import * as ast from
|
|
6
|
-
import { Record } from
|
|
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
|
*
|