@keymanapp/kmc-kmn 18.0.41-alpha → 18.0.45-alpha

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 (45) hide show
  1. package/build/src/compiler/compiler.d.ts +181 -181
  2. package/build/src/compiler/compiler.js +493 -496
  3. package/build/src/compiler/compiler.js.map +1 -1
  4. package/build/src/compiler/kmn-compiler-messages.d.ts +458 -458
  5. package/build/src/compiler/kmn-compiler-messages.d.ts.map +1 -1
  6. package/build/src/compiler/kmn-compiler-messages.js +459 -462
  7. package/build/src/compiler/kmn-compiler-messages.js.map +1 -1
  8. package/build/src/compiler/osk.d.ts +31 -31
  9. package/build/src/compiler/osk.js +84 -87
  10. package/build/src/compiler/osk.js.map +1 -1
  11. package/build/src/import/kmcmplib/wasm-host.d.ts +2 -2
  12. package/build/src/import/kmcmplib/wasm-host.js +3262 -3265
  13. package/build/src/import/kmcmplib/wasm-host.js.map +1 -1
  14. package/build/src/import/kmcmplib/wasm-host.wasm +0 -0
  15. package/build/src/kmw-compiler/compiler-globals.d.ts +19 -19
  16. package/build/src/kmw-compiler/compiler-globals.js +38 -41
  17. package/build/src/kmw-compiler/compiler-globals.js.map +1 -1
  18. package/build/src/kmw-compiler/constants.d.ts +16 -16
  19. package/build/src/kmw-compiler/constants.js +79 -82
  20. package/build/src/kmw-compiler/constants.js.map +1 -1
  21. package/build/src/kmw-compiler/javascript-strings.d.ts +32 -32
  22. package/build/src/kmw-compiler/javascript-strings.js +852 -855
  23. package/build/src/kmw-compiler/javascript-strings.js.map +1 -1
  24. package/build/src/kmw-compiler/keymanweb-key-codes.d.ts +22 -22
  25. package/build/src/kmw-compiler/keymanweb-key-codes.js +819 -822
  26. package/build/src/kmw-compiler/keymanweb-key-codes.js.map +1 -1
  27. package/build/src/kmw-compiler/kmw-compiler-messages.d.ts +30 -30
  28. package/build/src/kmw-compiler/kmw-compiler-messages.js +40 -43
  29. package/build/src/kmw-compiler/kmw-compiler-messages.js.map +1 -1
  30. package/build/src/kmw-compiler/kmw-compiler.d.ts +13 -13
  31. package/build/src/kmw-compiler/kmw-compiler.js +547 -550
  32. package/build/src/kmw-compiler/kmw-compiler.js.map +1 -1
  33. package/build/src/kmw-compiler/util.d.ts +74 -74
  34. package/build/src/kmw-compiler/util.js +247 -250
  35. package/build/src/kmw-compiler/util.js.map +1 -1
  36. package/build/src/kmw-compiler/validate-layout-file.d.ts +8 -8
  37. package/build/src/kmw-compiler/validate-layout-file.js +276 -279
  38. package/build/src/kmw-compiler/validate-layout-file.js.map +1 -1
  39. package/build/src/kmw-compiler/visual-keyboard-compiler.d.ts +2 -2
  40. package/build/src/kmw-compiler/visual-keyboard-compiler.js +119 -122
  41. package/build/src/kmw-compiler/visual-keyboard-compiler.js.map +1 -1
  42. package/build/src/main.d.ts +9 -9
  43. package/build/src/main.js +10 -13
  44. package/build/src/main.js.map +1 -1
  45. package/package.json +5 -5
@@ -1,182 +1,182 @@
1
- import { UnicodeSetParser, UnicodeSet, KeymanCompiler, KeymanCompilerArtifacts, KeymanCompilerArtifactOptional, KeymanCompilerResult } from '@keymanapp/common-types';
2
- import { CompilerCallbacks, CompilerOptions } from '@keymanapp/common-types';
3
- import * as Osk from './osk.js';
4
- export declare const STORETYPE_STORE = 1;
5
- export declare const STORETYPE_RESERVED = 2;
6
- export declare const STORETYPE_OPTION = 4;
7
- export declare const STORETYPE_DEBUG = 8;
8
- export declare const STORETYPE_CALL = 16;
9
- export declare const STORETYPE__MASK = 31;
10
- /** @internal */
11
- export interface CompilerResultExtraStore {
12
- storeType: number;
13
- name: string;
14
- line: number;
15
- }
16
- /** @internal */
17
- export interface CompilerResultExtraGroup {
18
- isReadOnly: boolean;
19
- name: string;
20
- }
21
- export declare const COMPILETARGETS_KMX = 1;
22
- export declare const COMPILETARGETS_JS = 2;
23
- export declare const COMPILETARGETS__MASK = 3;
24
- /**
25
- * @internal
26
- * Data in CompilerResultExtra comes from kmcmplib. This is used by other
27
- * compilers such as KmwCompiler and is not intended for external use.
28
- */
29
- export interface KmnCompilerResultExtra {
30
- /**
31
- * A bitmask, consisting of COMPILETARGETS_KMX and/or COMPILETARGETS_JS
32
- */
33
- targets: number;
34
- kvksFilename?: string;
35
- displayMapFilename?: string;
36
- stores: CompilerResultExtraStore[];
37
- groups: CompilerResultExtraGroup[];
38
- }
39
- /**
40
- * @public
41
- * Internal in-memory build artifacts from a successful compilation
42
- */
43
- export interface KmnCompilerArtifacts extends KeymanCompilerArtifacts {
44
- /**
45
- * Binary keyboard filedata and filename - installable into Keyman desktop
46
- * projects
47
- */
48
- kmx?: KeymanCompilerArtifactOptional;
49
- /**
50
- * Binary on screen keyboard filedata and filename - installable into Keyman
51
- * desktop projects alongside .kmx
52
- */
53
- kvk?: KeymanCompilerArtifactOptional;
54
- /**
55
- * Javascript keyboard filedata and filename - installable into KeymanWeb,
56
- * Keyman mobile products
57
- */
58
- js?: KeymanCompilerArtifactOptional;
59
- }
60
- /**
61
- * @public
62
- * Build artifacts from the .kmn compiler
63
- */
64
- export interface KmnCompilerResult extends KeymanCompilerResult {
65
- /**
66
- * Internal in-memory build artifacts from a successful compilation. Caller
67
- * can write these to disk with {@link KmnCompiler.write}
68
- */
69
- artifacts: KmnCompilerArtifacts;
70
- /**
71
- * Internal additional metadata used by secondary compile phases such as
72
- * KmwCompiler, not intended for external use
73
- */
74
- extra: KmnCompilerResultExtra;
75
- /**
76
- * Mapping data for `&displayMap`, intended for use by kmc-analyze
77
- */
78
- displayMap?: Osk.PuaMap;
79
- }
80
- /**
81
- * @public
82
- * Options for the .kmn compiler
83
- */
84
- export interface KmnCompilerOptions extends CompilerOptions {
85
- }
86
- /**
87
- * @public
88
- * Compiles a .kmn file to a .kmx, .kvk, and/or .js. The compiler does not read
89
- * or write from filesystem or network directly, but relies on callbacks for all
90
- * external IO.
91
- */
92
- export declare class KmnCompiler implements KeymanCompiler, UnicodeSetParser {
93
- private readonly callbackID;
94
- private callbacks;
95
- private wasmExports;
96
- private options;
97
- constructor();
98
- /**
99
- * Initialize the compiler, including loading the WASM host for kmcmplib.
100
- * Copies options.
101
- * @param callbacks - Callbacks for external interfaces, including message
102
- * reporting and file io
103
- * @param options - Compiler options
104
- * @returns false if initialization fails
105
- */
106
- init(callbacks: CompilerCallbacks, options: KmnCompilerOptions): Promise<boolean>;
107
- /**
108
- * Verify that wasm is spun up OK.
109
- * @returns true if OK
110
- */
111
- verifyInitialized(): boolean;
112
- /**
113
- * Write artifacts from a successful compile to disk, via callbacks methods.
114
- * The artifacts written may include:
115
- *
116
- * - .kmx file - binary keyboard used by Keyman on desktop platforms
117
- * - .kvk file - binary on screen keyboard used by Keyman on desktop platforms
118
- * - .js file - Javascript keyboard for web and touch platforms
119
- *
120
- * @param artifacts - object containing artifact binary data to write out
121
- * @returns true on success
122
- */
123
- write(artifacts: KmnCompilerArtifacts): Promise<boolean>;
124
- private compilerMessageCallback;
125
- private cachedFile;
126
- private loadFileCallback;
127
- private copyWasmResult;
128
- /**
129
- * By default, when a `Uint8Array` is created from an `ArrayBuffer` (e.g.
130
- * `Module.HEAP8.buffer`), it is a dynamic view into that buffer. This module
131
- * buffer can be dynamically reallocated at any time, which can happen when
132
- * allocating memory in WASM code (so the change will look _really_ weird in
133
- * a stack trace). Thus, to ensure we don't trip over ourselves, we need to
134
- * copy the buffer. Fortunately, creating a `Uint8Array` from a `Uint8Array`
135
- * copies the data, and is pretty quick.
136
- * @param offset - Offset into the WASM memory space, in bytes.
137
- * @param size - Size of the buffer to copy, in bytes.
138
- * @returns A _copy_ of the data in a new Uint8Array.
139
- */
140
- private copyWasmBuffer;
141
- /**
142
- * Compiles a .kmn file to .kmx, .kvk, and/or .js files. Returns an object
143
- * containing binary artifacts on success. The files are passed in by name,
144
- * and the compiler will use callbacks as passed to the
145
- * {@link KmnCompiler.init} function to read any input files by disk.
146
- * @param infile - Path to source file. Path will be parsed to find relative
147
- * references in the .kmn file, such as icon or On Screen
148
- * Keyboard file
149
- * @param outfile - Path to output file. The file will not be written to, but
150
- * will be included in the result for use by
151
- * {@link KmnCompiler.write}.
152
- * @returns Binary artifacts on success, null on failure.
153
- */
154
- run(infile: string, outfile: string): Promise<KmnCompilerResult>;
155
- private runWebCompiler;
156
- private keyboardIdFromKmnFilename;
157
- private runKvkCompiler;
158
- private loadDisplayMapping;
159
- /**
160
- * @internal
161
- * Generates an exception in kmcmplib to verify that Sentry error capture is
162
- * working correctly
163
- */
164
- testSentry(): any;
165
- /**
166
- * @internal
167
- * convert `\u{1234}` to `\u1234` etc
168
- */
169
- static fixNewPattern(pattern: string): string;
170
- /**
171
- * @internal
172
- * @param pattern - UnicodeSet pattern such as `[a-z]`
173
- * @param rangeCount - number of ranges to allocate
174
- * @returns UnicodeSet accessor object, or null on failure
175
- */
176
- parseUnicodeSet(pattern: string, rangeCount: number): UnicodeSet | null;
177
- /**
178
- * @internal
179
- */
180
- sizeUnicodeSet(pattern: string): number;
181
- }
1
+ import { UnicodeSetParser, UnicodeSet, KeymanCompiler, KeymanCompilerArtifacts, KeymanCompilerArtifactOptional, KeymanCompilerResult } from '@keymanapp/common-types';
2
+ import { CompilerCallbacks, CompilerOptions } from '@keymanapp/common-types';
3
+ import * as Osk from './osk.js';
4
+ export declare const STORETYPE_STORE = 1;
5
+ export declare const STORETYPE_RESERVED = 2;
6
+ export declare const STORETYPE_OPTION = 4;
7
+ export declare const STORETYPE_DEBUG = 8;
8
+ export declare const STORETYPE_CALL = 16;
9
+ export declare const STORETYPE__MASK = 31;
10
+ /** @internal */
11
+ export interface CompilerResultExtraStore {
12
+ storeType: number;
13
+ name: string;
14
+ line: number;
15
+ }
16
+ /** @internal */
17
+ export interface CompilerResultExtraGroup {
18
+ isReadOnly: boolean;
19
+ name: string;
20
+ }
21
+ export declare const COMPILETARGETS_KMX = 1;
22
+ export declare const COMPILETARGETS_JS = 2;
23
+ export declare const COMPILETARGETS__MASK = 3;
24
+ /**
25
+ * @internal
26
+ * Data in CompilerResultExtra comes from kmcmplib. This is used by other
27
+ * compilers such as KmwCompiler and is not intended for external use.
28
+ */
29
+ export interface KmnCompilerResultExtra {
30
+ /**
31
+ * A bitmask, consisting of COMPILETARGETS_KMX and/or COMPILETARGETS_JS
32
+ */
33
+ targets: number;
34
+ kvksFilename?: string;
35
+ displayMapFilename?: string;
36
+ stores: CompilerResultExtraStore[];
37
+ groups: CompilerResultExtraGroup[];
38
+ }
39
+ /**
40
+ * @public
41
+ * Internal in-memory build artifacts from a successful compilation
42
+ */
43
+ export interface KmnCompilerArtifacts extends KeymanCompilerArtifacts {
44
+ /**
45
+ * Binary keyboard filedata and filename - installable into Keyman desktop
46
+ * projects
47
+ */
48
+ kmx?: KeymanCompilerArtifactOptional;
49
+ /**
50
+ * Binary on screen keyboard filedata and filename - installable into Keyman
51
+ * desktop projects alongside .kmx
52
+ */
53
+ kvk?: KeymanCompilerArtifactOptional;
54
+ /**
55
+ * Javascript keyboard filedata and filename - installable into KeymanWeb,
56
+ * Keyman mobile products
57
+ */
58
+ js?: KeymanCompilerArtifactOptional;
59
+ }
60
+ /**
61
+ * @public
62
+ * Build artifacts from the .kmn compiler
63
+ */
64
+ export interface KmnCompilerResult extends KeymanCompilerResult {
65
+ /**
66
+ * Internal in-memory build artifacts from a successful compilation. Caller
67
+ * can write these to disk with {@link KmnCompiler.write}
68
+ */
69
+ artifacts: KmnCompilerArtifacts;
70
+ /**
71
+ * Internal additional metadata used by secondary compile phases such as
72
+ * KmwCompiler, not intended for external use
73
+ */
74
+ extra: KmnCompilerResultExtra;
75
+ /**
76
+ * Mapping data for `&displayMap`, intended for use by kmc-analyze
77
+ */
78
+ displayMap?: Osk.PuaMap;
79
+ }
80
+ /**
81
+ * @public
82
+ * Options for the .kmn compiler
83
+ */
84
+ export interface KmnCompilerOptions extends CompilerOptions {
85
+ }
86
+ /**
87
+ * @public
88
+ * Compiles a .kmn file to a .kmx, .kvk, and/or .js. The compiler does not read
89
+ * or write from filesystem or network directly, but relies on callbacks for all
90
+ * external IO.
91
+ */
92
+ export declare class KmnCompiler implements KeymanCompiler, UnicodeSetParser {
93
+ private readonly callbackID;
94
+ private callbacks;
95
+ private wasmExports;
96
+ private options;
97
+ constructor();
98
+ /**
99
+ * Initialize the compiler, including loading the WASM host for kmcmplib.
100
+ * Copies options.
101
+ * @param callbacks - Callbacks for external interfaces, including message
102
+ * reporting and file io
103
+ * @param options - Compiler options
104
+ * @returns false if initialization fails
105
+ */
106
+ init(callbacks: CompilerCallbacks, options: KmnCompilerOptions): Promise<boolean>;
107
+ /**
108
+ * Verify that wasm is spun up OK.
109
+ * @returns true if OK
110
+ */
111
+ verifyInitialized(): boolean;
112
+ /**
113
+ * Write artifacts from a successful compile to disk, via callbacks methods.
114
+ * The artifacts written may include:
115
+ *
116
+ * - .kmx file - binary keyboard used by Keyman on desktop platforms
117
+ * - .kvk file - binary on screen keyboard used by Keyman on desktop platforms
118
+ * - .js file - Javascript keyboard for web and touch platforms
119
+ *
120
+ * @param artifacts - object containing artifact binary data to write out
121
+ * @returns true on success
122
+ */
123
+ write(artifacts: KmnCompilerArtifacts): Promise<boolean>;
124
+ private compilerMessageCallback;
125
+ private cachedFile;
126
+ private loadFileCallback;
127
+ private copyWasmResult;
128
+ /**
129
+ * By default, when a `Uint8Array` is created from an `ArrayBuffer` (e.g.
130
+ * `Module.HEAP8.buffer`), it is a dynamic view into that buffer. This module
131
+ * buffer can be dynamically reallocated at any time, which can happen when
132
+ * allocating memory in WASM code (so the change will look _really_ weird in
133
+ * a stack trace). Thus, to ensure we don't trip over ourselves, we need to
134
+ * copy the buffer. Fortunately, creating a `Uint8Array` from a `Uint8Array`
135
+ * copies the data, and is pretty quick.
136
+ * @param offset - Offset into the WASM memory space, in bytes.
137
+ * @param size - Size of the buffer to copy, in bytes.
138
+ * @returns A _copy_ of the data in a new Uint8Array.
139
+ */
140
+ private copyWasmBuffer;
141
+ /**
142
+ * Compiles a .kmn file to .kmx, .kvk, and/or .js files. Returns an object
143
+ * containing binary artifacts on success. The files are passed in by name,
144
+ * and the compiler will use callbacks as passed to the
145
+ * {@link KmnCompiler.init} function to read any input files by disk.
146
+ * @param infile - Path to source file. Path will be parsed to find relative
147
+ * references in the .kmn file, such as icon or On Screen
148
+ * Keyboard file
149
+ * @param outfile - Path to output file. The file will not be written to, but
150
+ * will be included in the result for use by
151
+ * {@link KmnCompiler.write}.
152
+ * @returns Binary artifacts on success, null on failure.
153
+ */
154
+ run(infile: string, outfile: string): Promise<KmnCompilerResult>;
155
+ private runWebCompiler;
156
+ private keyboardIdFromKmnFilename;
157
+ private runKvkCompiler;
158
+ private loadDisplayMapping;
159
+ /**
160
+ * @internal
161
+ * Generates an exception in kmcmplib to verify that Sentry error capture is
162
+ * working correctly
163
+ */
164
+ testSentry(): any;
165
+ /**
166
+ * @internal
167
+ * convert `\u{1234}` to `\u1234` etc
168
+ */
169
+ static fixNewPattern(pattern: string): string;
170
+ /**
171
+ * @internal
172
+ * @param pattern - UnicodeSet pattern such as `[a-z]`
173
+ * @param rangeCount - number of ranges to allocate
174
+ * @returns UnicodeSet accessor object, or null on failure
175
+ */
176
+ parseUnicodeSet(pattern: string, rangeCount: number): UnicodeSet | null;
177
+ /**
178
+ * @internal
179
+ */
180
+ sizeUnicodeSet(pattern: string): number;
181
+ }
182
182
  //# sourceMappingURL=compiler.d.ts.map