motoko 3.0.0-beta4 → 3.0.0-beta6
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/contrib/hljs.js +13 -15
- package/contrib/monaco.js +4 -10
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -6
- package/lib/index.js.map +1 -1
- package/lib/keywords.d.ts +3 -0
- package/lib/keywords.d.ts.map +1 -0
- package/lib/keywords.js +75 -0
- package/lib/keywords.js.map +1 -0
- package/lib/versions/interpreter.d.ts +2 -2
- package/lib/versions/interpreter.d.ts.map +1 -1
- package/lib/versions/interpreter.js +1 -1
- package/lib/versions/interpreter.js.map +1 -1
- package/lib/versions/moc.d.ts +2 -2
- package/lib/versions/moc.d.ts.map +1 -1
- package/lib/versions/moc.js +1 -1
- package/lib/versions/moc.js.map +1 -1
- package/package.json +1 -1
- package/packages/latest/base.json +1 -1
- package/src/index.ts +5 -8
- package/src/keywords.ts +72 -0
- package/src/versions/interpreter.ts +1 -1
- package/src/versions/moc.ts +1 -1
- package/versions/latest/moc.min.js +1 -1
- package/versions/latest/moc_interpreter.min.js +1 -1
package/src/index.ts
CHANGED
@@ -28,15 +28,11 @@ export type Diagnostic = {
|
|
28
28
|
|
29
29
|
export type WasmMode = 'ic' | 'wasi';
|
30
30
|
|
31
|
-
export default function wrapMotoko(compiler: Compiler
|
31
|
+
export default function wrapMotoko(compiler: Compiler) {
|
32
|
+
const version = compiler.version || '(unknown)';
|
32
33
|
const debug = require('debug')(`motoko:${version}`);
|
33
34
|
|
34
35
|
const invoke = (key: string, unwrap: boolean, args: any[]) => {
|
35
|
-
if (!compiler) {
|
36
|
-
throw new Error(
|
37
|
-
'Please load a Motoko compiler before running this function',
|
38
|
-
);
|
39
|
-
}
|
40
36
|
if (typeof compiler[key] !== 'function') {
|
41
37
|
throw new Error(`Unknown compiler function: '${key}'`);
|
42
38
|
}
|
@@ -143,8 +139,9 @@ export default function wrapMotoko(compiler: Compiler, version: string) {
|
|
143
139
|
validatePackage(pkg: Package) {
|
144
140
|
validatePackage(pkg);
|
145
141
|
},
|
146
|
-
setAliases(aliases: Record<string, string>) {
|
147
|
-
debug('aliases', aliases);
|
142
|
+
setAliases(directory: string, aliases: Record<string, string>) {
|
143
|
+
debug('aliases', directory, aliases);
|
144
|
+
invoke('setCandidPath', false, [directory]);
|
148
145
|
invoke('setActorAliases', false, [Object.entries(aliases)]);
|
149
146
|
},
|
150
147
|
setMetadata(values: string) {
|
package/src/keywords.ts
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
export const keywords = [
|
2
|
+
'actor',
|
3
|
+
'and',
|
4
|
+
'async',
|
5
|
+
'assert',
|
6
|
+
'await',
|
7
|
+
'break',
|
8
|
+
'case',
|
9
|
+
'catch',
|
10
|
+
'class',
|
11
|
+
'continue',
|
12
|
+
'debug',
|
13
|
+
'debug_show',
|
14
|
+
'do',
|
15
|
+
'else',
|
16
|
+
'false',
|
17
|
+
'flexible',
|
18
|
+
'for',
|
19
|
+
'from_candid',
|
20
|
+
'func',
|
21
|
+
'if',
|
22
|
+
'ignore',
|
23
|
+
'in',
|
24
|
+
'import',
|
25
|
+
'label',
|
26
|
+
'let',
|
27
|
+
'loop',
|
28
|
+
'module',
|
29
|
+
'not',
|
30
|
+
'null',
|
31
|
+
'object',
|
32
|
+
'or',
|
33
|
+
'private',
|
34
|
+
'public',
|
35
|
+
'query',
|
36
|
+
'return',
|
37
|
+
'shared',
|
38
|
+
'stable',
|
39
|
+
'switch',
|
40
|
+
'system',
|
41
|
+
'throw',
|
42
|
+
'to_candid',
|
43
|
+
'true',
|
44
|
+
'try',
|
45
|
+
'type',
|
46
|
+
'var',
|
47
|
+
'while',
|
48
|
+
'with',
|
49
|
+
];
|
50
|
+
|
51
|
+
export const typeKeywords = [
|
52
|
+
'Any',
|
53
|
+
'None',
|
54
|
+
'Null',
|
55
|
+
'Bool',
|
56
|
+
'Int',
|
57
|
+
'Int8',
|
58
|
+
'Int16',
|
59
|
+
'Int32',
|
60
|
+
'Int64',
|
61
|
+
'Nat',
|
62
|
+
'Nat8',
|
63
|
+
'Nat16',
|
64
|
+
'Nat32',
|
65
|
+
'Nat64',
|
66
|
+
'Float',
|
67
|
+
'Char',
|
68
|
+
'Text',
|
69
|
+
'Blob',
|
70
|
+
'Error',
|
71
|
+
'Principal',
|
72
|
+
];
|
package/src/versions/moc.ts
CHANGED