@keymanapp/kmc 18.0.41-alpha → 18.0.46-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 (86) hide show
  1. package/build/src/commands/analyze.d.ts +22 -22
  2. package/build/src/commands/analyze.js +105 -105
  3. package/build/src/commands/analyze.js.map +1 -1
  4. package/build/src/commands/build.d.ts +12 -12
  5. package/build/src/commands/build.js +154 -154
  6. package/build/src/commands/build.js.map +1 -1
  7. package/build/src/commands/buildClasses/BuildActivity.d.ts +10 -10
  8. package/build/src/commands/buildClasses/BuildActivity.js +30 -30
  9. package/build/src/commands/buildClasses/BuildActivity.js.map +1 -1
  10. package/build/src/commands/buildClasses/BuildKeyboardInfo.d.ts +10 -10
  11. package/build/src/commands/buildClasses/BuildKeyboardInfo.js +46 -46
  12. package/build/src/commands/buildClasses/BuildKeyboardInfo.js.map +1 -1
  13. package/build/src/commands/buildClasses/BuildKmnKeyboard.d.ts +9 -9
  14. package/build/src/commands/buildClasses/BuildKmnKeyboard.js +34 -34
  15. package/build/src/commands/buildClasses/BuildKmnKeyboard.js.map +1 -1
  16. package/build/src/commands/buildClasses/BuildLdmlKeyboard.d.ts +9 -9
  17. package/build/src/commands/buildClasses/BuildLdmlKeyboard.js +18 -18
  18. package/build/src/commands/buildClasses/BuildModel.d.ts +9 -9
  19. package/build/src/commands/buildClasses/BuildModel.js +12 -12
  20. package/build/src/commands/buildClasses/BuildModelInfo.d.ts +20 -20
  21. package/build/src/commands/buildClasses/BuildModelInfo.js +72 -72
  22. package/build/src/commands/buildClasses/BuildModelInfo.js.map +1 -1
  23. package/build/src/commands/buildClasses/BuildPackage.d.ts +9 -9
  24. package/build/src/commands/buildClasses/BuildPackage.js +12 -12
  25. package/build/src/commands/buildClasses/BuildProject.d.ts +10 -10
  26. package/build/src/commands/buildClasses/BuildProject.js +115 -115
  27. package/build/src/commands/buildClasses/BuildProject.js.map +1 -1
  28. package/build/src/commands/buildClasses/buildActivities.d.ts +6 -6
  29. package/build/src/commands/buildClasses/buildActivities.js +20 -20
  30. package/build/src/commands/buildTestData/index.d.ts +1 -1
  31. package/build/src/commands/buildTestData/index.js +38 -38
  32. package/build/src/commands/buildTestData/index.js.map +1 -1
  33. package/build/src/commands/buildWindowsPackageInstaller/index.d.ts +1 -1
  34. package/build/src/commands/buildWindowsPackageInstaller/index.js +42 -42
  35. package/build/src/commands/buildWindowsPackageInstaller/index.js.map +1 -1
  36. package/build/src/commands/messageCommand.d.ts +2 -2
  37. package/build/src/commands/messageCommand.js +208 -208
  38. package/build/src/commands/messageCommand.js.map +1 -1
  39. package/build/src/kmc.d.ts +5 -5
  40. package/build/src/kmc.js +56 -56
  41. package/build/src/kmc.js.map +1 -1
  42. package/build/src/kmlmc.d.ts +5 -5
  43. package/build/src/kmlmc.js +56 -56
  44. package/build/src/kmlmc.js.map +1 -1
  45. package/build/src/kmlmp.d.ts +5 -5
  46. package/build/src/kmlmp.js +45 -45
  47. package/build/src/kmlmp.js.map +1 -1
  48. package/build/src/messages/infrastructureMessages.d.ts +151 -151
  49. package/build/src/messages/infrastructureMessages.js +74 -74
  50. package/build/src/messages/messageNamespaces.d.ts +7 -7
  51. package/build/src/messages/messageNamespaces.js +38 -38
  52. package/build/src/util/NodeCompilerCallbacks.d.ts +43 -43
  53. package/build/src/util/NodeCompilerCallbacks.js +220 -220
  54. package/build/src/util/NodeCompilerCallbacks.js.map +1 -1
  55. package/build/src/util/TestKeymanSentry.d.ts +6 -6
  56. package/build/src/util/TestKeymanSentry.js +50 -50
  57. package/build/src/util/TestKeymanSentry.js.map +1 -1
  58. package/build/src/util/baseOptions.d.ts +20 -20
  59. package/build/src/util/baseOptions.js +23 -23
  60. package/build/src/util/calculateSourcePath.d.ts +10 -10
  61. package/build/src/util/calculateSourcePath.js +17 -17
  62. package/build/src/util/calculateSourcePath.js.map +1 -1
  63. package/build/src/util/extendedCompilerOptions.d.ts +56 -56
  64. package/build/src/util/extendedCompilerOptions.js +122 -122
  65. package/build/src/util/extendedCompilerOptions.js.map +1 -1
  66. package/build/src/util/fileLists.d.ts +15 -15
  67. package/build/src/util/fileLists.js +45 -45
  68. package/build/src/util/fileLists.js.map +1 -1
  69. package/build/src/util/getDeveloperBinPath.d.ts +8 -8
  70. package/build/src/util/getDeveloperBinPath.js +35 -35
  71. package/build/src/util/getDeveloperBinPath.js.map +1 -1
  72. package/build/src/util/getLastGitCommitDate.d.ts +7 -7
  73. package/build/src/util/getLastGitCommitDate.js +43 -43
  74. package/build/src/util/getLastGitCommitDate.js.map +1 -1
  75. package/build/src/util/kmcSentryOptions.d.ts +7 -7
  76. package/build/src/util/kmcSentryOptions.js +19 -19
  77. package/build/src/util/kmcSentryOptions.js.map +1 -1
  78. package/build/src/util/projectLoader.d.ts +3 -3
  79. package/build/src/util/projectLoader.js +50 -50
  80. package/build/src/util/projectLoader.js.map +1 -1
  81. package/build/src/util/projectRunner.d.ts +2 -2
  82. package/build/src/util/projectRunner.js +26 -26
  83. package/build/src/util/projectRunner.js.map +1 -1
  84. package/build/src/util/sysexits.d.ts +9 -9
  85. package/build/src/util/sysexits.js +6 -6
  86. package/package.json +12 -12
@@ -1,51 +1,51 @@
1
- import { KmnCompiler } from "@keymanapp/kmc-kmn";
2
- import { NodeCompilerCallbacks } from "./NodeCompilerCallbacks.js";
3
- import { KeymanSentry } from '@keymanapp/developer-utils';
4
- const cli = process.argv.join(' ');
5
- export class TestKeymanSentry {
6
- static isTestCL() {
7
- // Note single hyphen match which matches other Developer console app
8
- // implementations, but this will also work with
9
- // --sentry-client-test-exception, so we get the best of both worlds.
10
- // This parameter is undocumented by design
11
- return cli.includes('-sentry-client-test-exception');
12
- }
13
- static async runTestIfCLRequested(options) {
14
- if (TestKeymanSentry.isTestCL()) {
15
- await TestKeymanSentry.test(options);
16
- console.error('Unexpected return from KeymanSentry.test');
17
- process.exit(1);
18
- }
19
- }
20
- static async test(options) {
21
- KeymanSentry.init(options);
22
- if (cli.includes('kmcmplib')) {
23
- const compiler = new KmnCompiler();
24
- const callbacks = new NodeCompilerCallbacks({});
25
- if (!await compiler.init(callbacks, null)) {
26
- throw new Error('Failed to instantiate WASM compiler');
27
- }
28
- try {
29
- compiler.testSentry();
30
- }
31
- catch (e) {
32
- await KeymanSentry.captureException(e);
33
- }
34
- }
35
- else if (cli.includes('event')) {
36
- const eventId = KeymanSentry.captureMessage('Test message from -sentry-client-test-exception event');
37
- await KeymanSentry.close();
38
- console.log(`Captured test message with id ${eventId}`);
39
- process.exit(0);
40
- }
41
- else {
42
- try {
43
- throw new Error('Test error from -sentry-client-test-exception event');
44
- }
45
- catch (e) {
46
- await KeymanSentry.captureException(e);
47
- }
48
- }
49
- }
50
- }
1
+ import { KmnCompiler } from "@keymanapp/kmc-kmn";
2
+ import { NodeCompilerCallbacks } from "./NodeCompilerCallbacks.js";
3
+ import { KeymanSentry } from '@keymanapp/developer-utils';
4
+ const cli = process.argv.join(' ');
5
+ export class TestKeymanSentry {
6
+ static isTestCL() {
7
+ // Note single hyphen match which matches other Developer console app
8
+ // implementations, but this will also work with
9
+ // --sentry-client-test-exception, so we get the best of both worlds.
10
+ // This parameter is undocumented by design
11
+ return cli.includes('-sentry-client-test-exception');
12
+ }
13
+ static async runTestIfCLRequested(options) {
14
+ if (TestKeymanSentry.isTestCL()) {
15
+ await TestKeymanSentry.test(options);
16
+ console.error('Unexpected return from KeymanSentry.test');
17
+ process.exit(1);
18
+ }
19
+ }
20
+ static async test(options) {
21
+ KeymanSentry.init(options);
22
+ if (cli.includes('kmcmplib')) {
23
+ const compiler = new KmnCompiler();
24
+ const callbacks = new NodeCompilerCallbacks({});
25
+ if (!await compiler.init(callbacks, null)) {
26
+ throw new Error('Failed to instantiate WASM compiler');
27
+ }
28
+ try {
29
+ compiler.testSentry();
30
+ }
31
+ catch (e) {
32
+ await KeymanSentry.captureException(e);
33
+ }
34
+ }
35
+ else if (cli.includes('event')) {
36
+ const eventId = KeymanSentry.captureMessage('Test message from -sentry-client-test-exception event');
37
+ await KeymanSentry.close();
38
+ console.log(`Captured test message with id ${eventId}`);
39
+ process.exit(0);
40
+ }
41
+ else {
42
+ try {
43
+ throw new Error('Test error from -sentry-client-test-exception event');
44
+ }
45
+ catch (e) {
46
+ await KeymanSentry.captureException(e);
47
+ }
48
+ }
49
+ }
50
+ }
51
51
  //# sourceMappingURL=TestKeymanSentry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestKeymanSentry.js","sourceRoot":"","sources":["../../../src/util/TestKeymanSentry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAqB,MAAM,4BAA4B,CAAC;AAE7E,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnC,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAC,QAAQ;QACb,qEAAqE;QACrE,gDAAgD;QAChD,qEAAqE;QACrE,2CAA2C;QAC3C,OAAO,GAAG,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAA2B;QAC3D,IAAG,gBAAgB,CAAC,QAAQ,EAAE,EAAE;YAC9B,MAAM,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAA2B;QAC3C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;YACnC,MA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AC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC;gBACH,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAAC,OAAM,CAAM,EAAE,CAAC;gBACf,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;CAEF"}
@@ -1,21 +1,21 @@
1
- import { CompilerLogFormat, CompilerLogLevel } from "@keymanapp/common-types";
2
- import { Command } from "commander";
3
- /**
4
- * Abstract interface for compiler options
5
- */
6
- export interface CommandLineBaseOptions {
7
- logLevel?: CompilerLogLevel;
8
- logFormat?: CompilerLogFormat;
9
- color?: boolean;
10
- outFile?: string;
11
- }
12
- /**
13
- * These options map to CompilerBaseOptions
14
- */
15
- export declare class BaseOptions {
16
- static addLogLevel(program: Command): Command;
17
- static addLogFormat(program: Command): Command;
18
- static addOutFile(program: Command): Command;
19
- static addAll(program: Command): Command;
20
- }
1
+ import { CompilerLogFormat, CompilerLogLevel } from "@keymanapp/common-types";
2
+ import { Command } from "commander";
3
+ /**
4
+ * Abstract interface for compiler options
5
+ */
6
+ export interface CommandLineBaseOptions {
7
+ logLevel?: CompilerLogLevel;
8
+ logFormat?: CompilerLogFormat;
9
+ color?: boolean;
10
+ outFile?: string;
11
+ }
12
+ /**
13
+ * These options map to CompilerBaseOptions
14
+ */
15
+ export declare class BaseOptions {
16
+ static addLogLevel(program: Command): Command;
17
+ static addLogFormat(program: Command): Command;
18
+ static addOutFile(program: Command): Command;
19
+ static addAll(program: Command): Command;
20
+ }
21
21
  //# sourceMappingURL=baseOptions.d.ts.map
@@ -1,24 +1,24 @@
1
- import { ALL_COMPILER_LOG_FORMATS, ALL_COMPILER_LOG_LEVELS } from "@keymanapp/common-types";
2
- import { Option } from "commander";
3
- /**
4
- * These options map to CompilerBaseOptions
5
- */
6
- export class BaseOptions {
7
- static addLogLevel(program) {
8
- return program.addOption(new Option('-l, --log-level <logLevel>', 'Log level').choices(ALL_COMPILER_LOG_LEVELS).default('info'));
9
- }
10
- static addLogFormat(program) {
11
- return program.addOption(new Option('--log-format <logFormat>', 'Log format').choices(ALL_COMPILER_LOG_FORMATS).default('formatted'));
12
- }
13
- static addOutFile(program) {
14
- return program.option('-o, --out-file <filename>', 'Override the default path and filename for the output file');
15
- }
16
- static addAll(program) {
17
- return [
18
- this.addLogLevel,
19
- this.addLogFormat,
20
- this.addOutFile,
21
- ].reduce((p, f) => f(p), program);
22
- }
23
- }
1
+ import { ALL_COMPILER_LOG_FORMATS, ALL_COMPILER_LOG_LEVELS } from "@keymanapp/common-types";
2
+ import { Option } from "commander";
3
+ /**
4
+ * These options map to CompilerBaseOptions
5
+ */
6
+ export class BaseOptions {
7
+ static addLogLevel(program) {
8
+ return program.addOption(new Option('-l, --log-level <logLevel>', 'Log level').choices(ALL_COMPILER_LOG_LEVELS).default('info'));
9
+ }
10
+ static addLogFormat(program) {
11
+ return program.addOption(new Option('--log-format <logFormat>', 'Log format').choices(ALL_COMPILER_LOG_FORMATS).default('formatted'));
12
+ }
13
+ static addOutFile(program) {
14
+ return program.option('-o, --out-file <filename>', 'Override the default path and filename for the output file');
15
+ }
16
+ static addAll(program) {
17
+ return [
18
+ this.addLogLevel,
19
+ this.addLogFormat,
20
+ this.addOutFile,
21
+ ].reduce((p, f) => f(p), program);
22
+ }
23
+ }
24
24
  //# sourceMappingURL=baseOptions.js.map
@@ -1,11 +1,11 @@
1
- /**
2
- * This is a helper function to derive the relative path within the
3
- * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
4
- * project filename. Handles \ vs /. Must be a project filename, not a project
5
- * folder.
6
- *
7
- * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
8
- * want "release/k/keyboard".
9
- */
10
- export declare function calculateSourcePath(projectFilename: string): string;
1
+ /**
2
+ * This is a helper function to derive the relative path within the
3
+ * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
4
+ * project filename. Handles \ vs /. Must be a project filename, not a project
5
+ * folder.
6
+ *
7
+ * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
8
+ * want "release/k/keyboard".
9
+ */
10
+ export declare function calculateSourcePath(projectFilename: string): string;
11
11
  //# sourceMappingURL=calculateSourcePath.d.ts.map
@@ -1,18 +1,18 @@
1
- /**
2
- * This is a helper function to derive the relative path within the
3
- * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
4
- * project filename. Handles \ vs /. Must be a project filename, not a project
5
- * folder.
6
- *
7
- * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
8
- * want "release/k/keyboard".
9
- */
10
- export function calculateSourcePath(projectFilename) {
11
- projectFilename = projectFilename.replace(/\\/g, '/');
12
- const result = /(release|legacy|experimental)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.kpj$/.exec(projectFilename);
13
- if (!result) {
14
- return undefined;
15
- }
16
- return `${result[1]}/${result[2]}/${result[3]}`;
17
- }
1
+ /**
2
+ * This is a helper function to derive the relative path within the
3
+ * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
4
+ * project filename. Handles \ vs /. Must be a project filename, not a project
5
+ * folder.
6
+ *
7
+ * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
8
+ * want "release/k/keyboard".
9
+ */
10
+ export function calculateSourcePath(projectFilename) {
11
+ projectFilename = projectFilename.replace(/\\/g, '/');
12
+ const result = /(release|legacy|experimental)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.kpj$/.exec(projectFilename);
13
+ if (!result) {
14
+ return undefined;
15
+ }
16
+ return `${result[1]}/${result[2]}/${result[3]}`;
17
+ }
18
18
  //# sourceMappingURL=calculateSourcePath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculateSourcePath.js","sourceRoot":"","sources":["../../../src/util/calculateSourcePath.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAuB;IACzD,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,mEAAmE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACzG,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"calculateSourcePath.js","sourceRoot":"","sources":["../../../src/util/calculateSourcePath.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAuB;IACzD,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,mEAAmE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACzG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAClD,CAAC"}
@@ -1,57 +1,57 @@
1
- import { CompilerCallbacks, CompilerMessageOverride, CompilerMessageOverrideMap, CompilerOptions } from '@keymanapp/common-types';
2
- export interface ExtendedCompilerOptions extends CompilerOptions {
3
- /**
4
- * Verify that the project meets the requirements of the keymanapp/keyboards
5
- * or keymanapp/lexical-models repository, e.g. verify that project license is
6
- * MIT
7
- */
8
- forPublishing?: boolean;
9
- /**
10
- * Overrides for message reporting
11
- */
12
- messageOverrides?: CompilerMessageOverrideMap;
13
- }
14
- /**
15
- * converts an --message command line parameter `<id>[:level]` and verifies that
16
- * it is a valid message, returning `null` if it is not a valid id or level. If
17
- * level is omitted, the message is disabled. Valid levels are Disable, Info,
18
- * Hint, Warn or Error (can shorten or first character of each).
19
- *
20
- * Will report details of any errors to callbacks.reportMessage
21
- * @param message command line parameter in format '["KM"]<id>[":"level]'
22
- * @param callbacks
23
- * @returns CompilerMessageOverride map with the new severity level for the
24
- * message; or `null` if parameter is invalid.
25
- */
26
- declare function commandOptionsMessageToCompilerOptionsMessage(message: string, callbacks: CompilerCallbacks): CompilerMessageOverride;
27
- export interface CompilerMessageDetail {
28
- code: number;
29
- id: any;
30
- module: string;
31
- class: any;
32
- }
33
- export declare function findMessageDetails(code: number, callbacks: CompilerCallbacks): CompilerMessageDetail;
34
- /**
35
- * Verifies that a given message is valid and that the severity is allowed to be
36
- * modified (Info, Hint and Warn only -- Error and Fatal cannot be modified)
37
- * @param override
38
- * @param callbacks
39
- * @returns true if the message can be overridden
40
- */
41
- declare function checkMessageOverride(override: CompilerMessageOverride, callbacks: CompilerCallbacks): boolean;
42
- /**
43
- * Maps command line compiler options to the compiler API options.
44
- * @param options
45
- * @param callbacks
46
- * @returns
47
- */
48
- export declare function commandOptionsToCompilerOptions(options: any, callbacks: CompilerCallbacks): ExtendedCompilerOptions;
49
- /**
50
- * these are exported only for unit tests, do not use
51
- */
52
- export declare const unitTestEndpoints: {
53
- checkMessageOverride: typeof checkMessageOverride;
54
- commandOptionsMessageToCompilerOptionsMessage: typeof commandOptionsMessageToCompilerOptionsMessage;
55
- };
56
- export {};
1
+ import { CompilerCallbacks, CompilerMessageOverride, CompilerMessageOverrideMap, CompilerOptions } from '@keymanapp/common-types';
2
+ export interface ExtendedCompilerOptions extends CompilerOptions {
3
+ /**
4
+ * Verify that the project meets the requirements of the keymanapp/keyboards
5
+ * or keymanapp/lexical-models repository, e.g. verify that project license is
6
+ * MIT
7
+ */
8
+ forPublishing?: boolean;
9
+ /**
10
+ * Overrides for message reporting
11
+ */
12
+ messageOverrides?: CompilerMessageOverrideMap;
13
+ }
14
+ /**
15
+ * converts an --message command line parameter `<id>[:level]` and verifies that
16
+ * it is a valid message, returning `null` if it is not a valid id or level. If
17
+ * level is omitted, the message is disabled. Valid levels are Disable, Info,
18
+ * Hint, Warn or Error (can shorten or first character of each).
19
+ *
20
+ * Will report details of any errors to callbacks.reportMessage
21
+ * @param message command line parameter in format '["KM"]<id>[":"level]'
22
+ * @param callbacks
23
+ * @returns CompilerMessageOverride map with the new severity level for the
24
+ * message; or `null` if parameter is invalid.
25
+ */
26
+ declare function commandOptionsMessageToCompilerOptionsMessage(message: string, callbacks: CompilerCallbacks): CompilerMessageOverride;
27
+ export interface CompilerMessageDetail {
28
+ code: number;
29
+ id: any;
30
+ module: string;
31
+ class: any;
32
+ }
33
+ export declare function findMessageDetails(code: number, callbacks: CompilerCallbacks): CompilerMessageDetail;
34
+ /**
35
+ * Verifies that a given message is valid and that the severity is allowed to be
36
+ * modified (Info, Hint and Warn only -- Error and Fatal cannot be modified)
37
+ * @param override
38
+ * @param callbacks
39
+ * @returns true if the message can be overridden
40
+ */
41
+ declare function checkMessageOverride(override: CompilerMessageOverride, callbacks: CompilerCallbacks): boolean;
42
+ /**
43
+ * Maps command line compiler options to the compiler API options.
44
+ * @param options
45
+ * @param callbacks
46
+ * @returns
47
+ */
48
+ export declare function commandOptionsToCompilerOptions(options: any, callbacks: CompilerCallbacks): ExtendedCompilerOptions;
49
+ /**
50
+ * these are exported only for unit tests, do not use
51
+ */
52
+ export declare const unitTestEndpoints: {
53
+ checkMessageOverride: typeof checkMessageOverride;
54
+ commandOptionsMessageToCompilerOptionsMessage: typeof commandOptionsMessageToCompilerOptionsMessage;
55
+ };
56
+ export {};
57
57
  //# sourceMappingURL=extendedCompilerOptions.d.ts.map
@@ -1,123 +1,123 @@
1
- import { CompilerError, CompilerErrorSeverity } from '@keymanapp/common-types';
2
- import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
3
- import { messageNamespaceKeys, messageSources } from '../messages/messageNamespaces.js';
4
- ;
5
- /**
6
- * converts an --message command line parameter `<id>[:level]` and verifies that
7
- * it is a valid message, returning `null` if it is not a valid id or level. If
8
- * level is omitted, the message is disabled. Valid levels are Disable, Info,
9
- * Hint, Warn or Error (can shorten or first character of each).
10
- *
11
- * Will report details of any errors to callbacks.reportMessage
12
- * @param message command line parameter in format '["KM"]<id>[":"level]'
13
- * @param callbacks
14
- * @returns CompilerMessageOverride map with the new severity level for the
15
- * message; or `null` if parameter is invalid.
16
- */
17
- function commandOptionsMessageToCompilerOptionsMessage(message, callbacks) {
18
- const pattern = /^(KM)?([0-9a-f]+)(:(D|Disable|I|Info|H|Hint|W|Warn|E|Error))?$/i;
19
- const result = message.match(pattern);
20
- if (!result) {
21
- callbacks.reportMessage(InfrastructureMessages.Error_InvalidMessageFormat({ message }));
22
- return null;
23
- }
24
- const code = Number.parseInt(result[2], 16);
25
- const inputLevel = (result[4] ?? '').toLowerCase();
26
- const level = (inputLevel == '' || 'disable'.startsWith(inputLevel)) ? 'disable' :
27
- CompilerError.severityNameToValue(inputLevel);
28
- const override = { code, level };
29
- if (!checkMessageOverride(override, callbacks)) {
30
- return null;
31
- }
32
- return override;
33
- }
34
- function commandOptionsMessagesToCompilerOptionsMessages(messages, callbacks) {
35
- if (!messages || !Array.isArray(messages)) {
36
- return {};
37
- }
38
- const result = {};
39
- for (let message of messages) {
40
- const override = commandOptionsMessageToCompilerOptionsMessage(message, callbacks);
41
- if (!override) {
42
- return null;
43
- }
44
- result[override.code] = override.level;
45
- }
46
- return result;
47
- }
48
- export function findMessageDetails(code, callbacks) {
49
- const namespace = CompilerError.namespace(code);
50
- if (!messageNamespaceKeys.includes(namespace)) {
51
- callbacks.reportMessage(InfrastructureMessages.Error_MessageNamespaceNotFound({ code }));
52
- return null;
53
- }
54
- const source = messageSources[namespace];
55
- if (!source) {
56
- throw new Error(`Unexpected missing namespace for code ${code.toString(16)}`);
57
- }
58
- // For the given namespace object, iterate through the members to find the matching value
59
- const keys = Object.keys(source.class);
60
- const m = source.class;
61
- const id = keys.find(key => typeof m[key] == 'number' && CompilerError.error(m[key]) === code);
62
- if (!id) {
63
- callbacks.reportMessage(InfrastructureMessages.Error_MessageCodeNotFound({ code }));
64
- return null;
65
- }
66
- return { code: m[id], id, module: source.module, class: source.class };
67
- }
68
- /**
69
- * Verifies that a given message is valid and that the severity is allowed to be
70
- * modified (Info, Hint and Warn only -- Error and Fatal cannot be modified)
71
- * @param override
72
- * @param callbacks
73
- * @returns true if the message can be overridden
74
- */
75
- function checkMessageOverride(override, callbacks) {
76
- const details = findMessageDetails(override.code, callbacks);
77
- if (!details) {
78
- return false;
79
- }
80
- const validSeverityMasks = [CompilerErrorSeverity.Info, CompilerErrorSeverity.Hint, CompilerErrorSeverity.Warn];
81
- if (!validSeverityMasks.includes(CompilerError.severity(details.code))) {
82
- callbacks.reportMessage(InfrastructureMessages.Error_MessageCannotBeCoerced({ code: override.code }));
83
- return false;
84
- }
85
- return true;
86
- }
87
- /**
88
- * Maps command line compiler options to the compiler API options.
89
- * @param options
90
- * @param callbacks
91
- * @returns
92
- */
93
- export function commandOptionsToCompilerOptions(options, callbacks) {
94
- const overrides = commandOptionsMessagesToCompilerOptionsMessages(options.message, callbacks);
95
- if (!overrides) {
96
- return null;
97
- }
98
- // We don't want to rename command line options to match the precise
99
- // properties that we have in CompilerOptions, but nor do we want to rename
100
- // CompilerOptions properties...
101
- return {
102
- // CompilerBaseOptions
103
- logLevel: options.logLevel,
104
- logFormat: options.logFormat,
105
- color: options.color,
106
- // CompilerOptions
107
- shouldAddCompilerVersion: options.compilerVersion,
108
- saveDebug: options.debug,
109
- compilerWarningsAsErrors: options.compilerWarningsAsErrors,
110
- warnDeprecatedCode: options.warnDeprecatedCode,
111
- // ExtendedOptions
112
- forPublishing: options.forPublishing,
113
- messageOverrides: overrides,
114
- };
115
- }
116
- /**
117
- * these are exported only for unit tests, do not use
118
- */
119
- export const unitTestEndpoints = {
120
- checkMessageOverride,
121
- commandOptionsMessageToCompilerOptionsMessage
122
- };
1
+ import { CompilerError, CompilerErrorSeverity } from '@keymanapp/common-types';
2
+ import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
3
+ import { messageNamespaceKeys, messageSources } from '../messages/messageNamespaces.js';
4
+ ;
5
+ /**
6
+ * converts an --message command line parameter `<id>[:level]` and verifies that
7
+ * it is a valid message, returning `null` if it is not a valid id or level. If
8
+ * level is omitted, the message is disabled. Valid levels are Disable, Info,
9
+ * Hint, Warn or Error (can shorten or first character of each).
10
+ *
11
+ * Will report details of any errors to callbacks.reportMessage
12
+ * @param message command line parameter in format '["KM"]<id>[":"level]'
13
+ * @param callbacks
14
+ * @returns CompilerMessageOverride map with the new severity level for the
15
+ * message; or `null` if parameter is invalid.
16
+ */
17
+ function commandOptionsMessageToCompilerOptionsMessage(message, callbacks) {
18
+ const pattern = /^(KM)?([0-9a-f]+)(:(D|Disable|I|Info|H|Hint|W|Warn|E|Error))?$/i;
19
+ const result = message.match(pattern);
20
+ if (!result) {
21
+ callbacks.reportMessage(InfrastructureMessages.Error_InvalidMessageFormat({ message }));
22
+ return null;
23
+ }
24
+ const code = Number.parseInt(result[2], 16);
25
+ const inputLevel = (result[4] ?? '').toLowerCase();
26
+ const level = (inputLevel == '' || 'disable'.startsWith(inputLevel)) ? 'disable' :
27
+ CompilerError.severityNameToValue(inputLevel);
28
+ const override = { code, level };
29
+ if (!checkMessageOverride(override, callbacks)) {
30
+ return null;
31
+ }
32
+ return override;
33
+ }
34
+ function commandOptionsMessagesToCompilerOptionsMessages(messages, callbacks) {
35
+ if (!messages || !Array.isArray(messages)) {
36
+ return {};
37
+ }
38
+ const result = {};
39
+ for (let message of messages) {
40
+ const override = commandOptionsMessageToCompilerOptionsMessage(message, callbacks);
41
+ if (!override) {
42
+ return null;
43
+ }
44
+ result[override.code] = override.level;
45
+ }
46
+ return result;
47
+ }
48
+ export function findMessageDetails(code, callbacks) {
49
+ const namespace = CompilerError.namespace(code);
50
+ if (!messageNamespaceKeys.includes(namespace)) {
51
+ callbacks.reportMessage(InfrastructureMessages.Error_MessageNamespaceNotFound({ code }));
52
+ return null;
53
+ }
54
+ const source = messageSources[namespace];
55
+ if (!source) {
56
+ throw new Error(`Unexpected missing namespace for code ${code.toString(16)}`);
57
+ }
58
+ // For the given namespace object, iterate through the members to find the matching value
59
+ const keys = Object.keys(source.class);
60
+ const m = source.class;
61
+ const id = keys.find(key => typeof m[key] == 'number' && CompilerError.error(m[key]) === code);
62
+ if (!id) {
63
+ callbacks.reportMessage(InfrastructureMessages.Error_MessageCodeNotFound({ code }));
64
+ return null;
65
+ }
66
+ return { code: m[id], id, module: source.module, class: source.class };
67
+ }
68
+ /**
69
+ * Verifies that a given message is valid and that the severity is allowed to be
70
+ * modified (Info, Hint and Warn only -- Error and Fatal cannot be modified)
71
+ * @param override
72
+ * @param callbacks
73
+ * @returns true if the message can be overridden
74
+ */
75
+ function checkMessageOverride(override, callbacks) {
76
+ const details = findMessageDetails(override.code, callbacks);
77
+ if (!details) {
78
+ return false;
79
+ }
80
+ const validSeverityMasks = [CompilerErrorSeverity.Info, CompilerErrorSeverity.Hint, CompilerErrorSeverity.Warn];
81
+ if (!validSeverityMasks.includes(CompilerError.severity(details.code))) {
82
+ callbacks.reportMessage(InfrastructureMessages.Error_MessageCannotBeCoerced({ code: override.code }));
83
+ return false;
84
+ }
85
+ return true;
86
+ }
87
+ /**
88
+ * Maps command line compiler options to the compiler API options.
89
+ * @param options
90
+ * @param callbacks
91
+ * @returns
92
+ */
93
+ export function commandOptionsToCompilerOptions(options, callbacks) {
94
+ const overrides = commandOptionsMessagesToCompilerOptionsMessages(options.message, callbacks);
95
+ if (!overrides) {
96
+ return null;
97
+ }
98
+ // We don't want to rename command line options to match the precise
99
+ // properties that we have in CompilerOptions, but nor do we want to rename
100
+ // CompilerOptions properties...
101
+ return {
102
+ // CompilerBaseOptions
103
+ logLevel: options.logLevel,
104
+ logFormat: options.logFormat,
105
+ color: options.color,
106
+ // CompilerOptions
107
+ shouldAddCompilerVersion: options.compilerVersion,
108
+ saveDebug: options.debug,
109
+ compilerWarningsAsErrors: options.compilerWarningsAsErrors,
110
+ warnDeprecatedCode: options.warnDeprecatedCode,
111
+ // ExtendedOptions
112
+ forPublishing: options.forPublishing,
113
+ messageOverrides: overrides,
114
+ };
115
+ }
116
+ /**
117
+ * these are exported only for unit tests, do not use
118
+ */
119
+ export const unitTestEndpoints = {
120
+ checkMessageOverride,
121
+ commandOptionsMessageToCompilerOptionsMessage
122
+ };
123
123
  //# sourceMappingURL=extendedCompilerOptions.js.map