@keymanapp/kmc 17.0.83-alpha → 17.0.84-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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildKmnKeyboard.d.ts","sourceRoot":"","sources":["../../../src/activities/buildKmnKeyboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildKmnKeyboard.d.ts","sourceRoot":"","sources":["../../../src/activities/buildKmnKeyboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBrG"}
|
|
@@ -1,45 +1,35 @@
|
|
|
1
|
-
import { spawnSync } from 'child_process';
|
|
2
1
|
import * as path from 'path';
|
|
3
|
-
import {
|
|
2
|
+
import { Compiler } from '@keymanapp/kmc-kmn';
|
|
3
|
+
import { platform } from 'os';
|
|
4
4
|
export async function buildKmnKeyboard(infile, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// generate a .kmx if the output target defined in the .kmn is mobile/web
|
|
8
|
-
// only. kmcomp.exe will also build the .kvk file.
|
|
9
|
-
const binRoot = getDeveloperBinPath();
|
|
10
|
-
if (binRoot == null) {
|
|
11
|
-
console.error('Could not locate Keyman Developer bin path');
|
|
5
|
+
let compiler = new Compiler();
|
|
6
|
+
if (!await compiler.init()) {
|
|
12
7
|
return false;
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// + kmc-kmw (KMX->KMW transpiler in TypeScript) + kmc-kvk (KVK compiler in
|
|
24
|
-
// TypeScript).
|
|
25
|
-
let outfile = (options.outFile ?? infile).replace(/\\/g, '/');
|
|
26
|
-
// For now, we normalize to posix, and then renormalize to win32 for launching
|
|
27
|
-
// kmcomp, until we have a cross-platform alternative to use
|
|
28
|
-
outfile = path.win32.normalize(options.outFile).replace(/\.km.$/i, '.*');
|
|
29
|
-
args.push(outfile);
|
|
30
|
-
const kmcomp = path.join(binRoot, 'kmcomp.exe');
|
|
31
|
-
// We won't attempt to make this call cross-platform, yet.
|
|
32
|
-
let child = spawnSync(kmcomp, args, {
|
|
33
|
-
encoding: 'utf8'
|
|
9
|
+
// We need to resolve paths to absolute paths before calling kmc-kmn
|
|
10
|
+
let outfile = (options.outFile ?? infile).replace(/\.km.$/i, '.kmx');
|
|
11
|
+
infile = getPosixAbsolutePath(infile);
|
|
12
|
+
outfile = getPosixAbsolutePath(outfile);
|
|
13
|
+
// TODO: Currently this only builds .kmn->.kmx, and targeting .js is as-yet unsupported
|
|
14
|
+
// TODO: Support additional options compilerWarningsAsErrors, warnDeprecatedCode
|
|
15
|
+
return compiler.run(infile, outfile, {
|
|
16
|
+
saveDebug: options.debug,
|
|
17
|
+
shouldAddCompilerVersion: options.compilerVersion,
|
|
34
18
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
}
|
|
20
|
+
function getPosixAbsolutePath(filename) {
|
|
21
|
+
if (platform() == 'win32') {
|
|
22
|
+
// On Win32, we need to use backslashes for path.resolve to work
|
|
23
|
+
filename = filename.replace(/\//g, '\\');
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
// Resolve to a fully qualified absolute path
|
|
26
|
+
filename = path.resolve(filename);
|
|
27
|
+
if (platform() == 'win32') {
|
|
28
|
+
// Ensure that we convert the result back to posix-style paths which is what
|
|
29
|
+
// kmc-kmn expects. On posix platforms, we assume paths have forward slashes
|
|
30
|
+
// already
|
|
31
|
+
filename = filename.replace(/\\/g, '/');
|
|
42
32
|
}
|
|
43
|
-
return
|
|
33
|
+
return filename;
|
|
44
34
|
}
|
|
45
35
|
//# sourceMappingURL=buildKmnKeyboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildKmnKeyboard.js","sourceRoot":"","sources":["../../../src/activities/buildKmnKeyboard.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"buildKmnKeyboard.js","sourceRoot":"","sources":["../../../src/activities/buildKmnKeyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAA4B;IAEjF,IAAI,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC9B,IAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IAED,oEAAoE;IACpE,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAErE,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAExC,uFAAuF;IACvF,gFAAgF;IAChF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE;QACnC,SAAS,EAAE,OAAO,CAAC,KAAK;QACxB,wBAAwB,EAAE,OAAO,CAAC,eAAe;KAClD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,IAAG,QAAQ,EAAE,IAAI,OAAO,EAAE;QACxB,gEAAgE;QAChE,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC1C;IAED,6CAA6C;IAC7C,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElC,IAAG,QAAQ,EAAE,IAAI,OAAO,EAAE;QACxB,4EAA4E;QAC5E,4EAA4E;QAC5E,UAAU;QACV,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KACzC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED