@keymanapp/kmc 17.0.155-alpha → 17.0.157-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 (148) hide show
  1. package/build/src/commands/analyze.d.ts +5 -0
  2. package/build/src/commands/analyze.d.ts.map +1 -0
  3. package/build/src/commands/analyze.js +101 -0
  4. package/build/src/commands/analyze.js.map +1 -0
  5. package/build/src/commands/build.d.ts +5 -3
  6. package/build/src/commands/build.d.ts.map +1 -1
  7. package/build/src/commands/build.js +126 -69
  8. package/build/src/commands/build.js.map +1 -1
  9. package/build/src/commands/buildClasses/BuildActivity.d.ts +12 -0
  10. package/build/src/commands/buildClasses/BuildActivity.d.ts.map +1 -0
  11. package/build/src/commands/buildClasses/BuildActivity.js +12 -0
  12. package/build/src/commands/buildClasses/BuildActivity.js.map +1 -0
  13. package/build/src/commands/buildClasses/BuildKeyboardInfo.d.ts +12 -0
  14. package/build/src/commands/buildClasses/BuildKeyboardInfo.d.ts.map +1 -0
  15. package/build/src/commands/buildClasses/BuildKeyboardInfo.js +77 -0
  16. package/build/src/commands/buildClasses/BuildKeyboardInfo.js.map +1 -0
  17. package/build/src/commands/buildClasses/BuildKmnKeyboard.d.ts +12 -0
  18. package/build/src/commands/buildClasses/BuildKmnKeyboard.d.ts.map +1 -0
  19. package/build/src/commands/{build → buildClasses}/BuildKmnKeyboard.js +41 -44
  20. package/build/src/commands/buildClasses/BuildKmnKeyboard.js.map +1 -0
  21. package/build/src/commands/buildClasses/BuildLdmlKeyboard.d.ts +12 -0
  22. package/build/src/commands/buildClasses/BuildLdmlKeyboard.d.ts.map +1 -0
  23. package/build/src/commands/{build → buildClasses}/BuildLdmlKeyboard.js +80 -80
  24. package/build/src/commands/buildClasses/BuildLdmlKeyboard.js.map +1 -0
  25. package/build/src/commands/buildClasses/BuildModel.d.ts +12 -0
  26. package/build/src/commands/buildClasses/BuildModel.d.ts.map +1 -0
  27. package/build/src/commands/{build → buildClasses}/BuildModel.js +31 -29
  28. package/build/src/commands/buildClasses/BuildModel.js.map +1 -0
  29. package/build/src/commands/buildClasses/BuildModelInfo.d.ts +22 -0
  30. package/build/src/commands/buildClasses/BuildModelInfo.d.ts.map +1 -0
  31. package/build/src/commands/buildClasses/BuildModelInfo.js +73 -0
  32. package/build/src/commands/buildClasses/BuildModelInfo.js.map +1 -0
  33. package/build/src/commands/buildClasses/BuildPackage.d.ts +12 -0
  34. package/build/src/commands/buildClasses/BuildPackage.d.ts.map +1 -0
  35. package/build/src/commands/{build → buildClasses}/BuildPackage.js +39 -37
  36. package/build/src/commands/buildClasses/BuildPackage.js.map +1 -0
  37. package/build/src/commands/buildClasses/BuildProject.d.ts +12 -0
  38. package/build/src/commands/buildClasses/BuildProject.d.ts.map +1 -0
  39. package/build/src/commands/buildClasses/BuildProject.js +84 -0
  40. package/build/src/commands/buildClasses/BuildProject.js.map +1 -0
  41. package/build/src/commands/buildClasses/buildActivities.d.ts +5 -0
  42. package/build/src/commands/buildClasses/buildActivities.d.ts.map +1 -0
  43. package/build/src/commands/{build → buildClasses}/buildActivities.js +22 -16
  44. package/build/src/commands/buildClasses/buildActivities.js.map +1 -0
  45. package/build/src/commands/buildTestData/index.d.ts +5 -5
  46. package/build/src/commands/buildTestData/index.d.ts.map +1 -1
  47. package/build/src/commands/buildTestData/index.js +39 -36
  48. package/build/src/commands/buildTestData/index.js.map +1 -1
  49. package/build/src/commands/buildTestData.d.ts +5 -3
  50. package/build/src/commands/buildTestData.d.ts.map +1 -1
  51. package/build/src/commands/buildTestData.js +11 -9
  52. package/build/src/commands/buildTestData.js.map +1 -1
  53. package/build/src/kmc.d.ts +8 -6
  54. package/build/src/kmc.d.ts.map +1 -1
  55. package/build/src/kmc.js +43 -39
  56. package/build/src/kmc.js.map +1 -1
  57. package/build/src/kmlmc.d.ts +8 -6
  58. package/build/src/kmlmc.d.ts.map +1 -1
  59. package/build/src/kmlmc.js +52 -50
  60. package/build/src/kmlmc.js.map +1 -1
  61. package/build/src/kmlmi.d.ts +8 -6
  62. package/build/src/kmlmi.d.ts.map +1 -1
  63. package/build/src/kmlmi.js +74 -73
  64. package/build/src/kmlmi.js.map +1 -1
  65. package/build/src/kmlmp.d.ts +8 -6
  66. package/build/src/kmlmp.d.ts.map +1 -1
  67. package/build/src/kmlmp.js +59 -57
  68. package/build/src/kmlmp.js.map +1 -1
  69. package/build/src/messages/messages.d.ts +90 -39
  70. package/build/src/messages/messages.d.ts.map +1 -1
  71. package/build/src/messages/messages.js +47 -28
  72. package/build/src/messages/messages.js.map +1 -1
  73. package/build/src/util/KeymanSentry.d.ts +11 -0
  74. package/build/src/util/KeymanSentry.d.ts.map +1 -0
  75. package/build/src/util/KeymanSentry.js +114 -0
  76. package/build/src/util/KeymanSentry.js.map +1 -0
  77. package/build/src/util/NodeCompilerCallbacks.d.ts +43 -0
  78. package/build/src/util/NodeCompilerCallbacks.d.ts.map +1 -0
  79. package/build/src/util/NodeCompilerCallbacks.js +184 -0
  80. package/build/src/util/NodeCompilerCallbacks.js.map +1 -0
  81. package/build/src/util/baseOptions.d.ts +11 -0
  82. package/build/src/util/baseOptions.d.ts.map +1 -0
  83. package/build/src/util/baseOptions.js +34 -0
  84. package/build/src/util/baseOptions.js.map +1 -0
  85. package/build/src/util/calculateSourcePath.d.ts +13 -0
  86. package/build/src/util/calculateSourcePath.d.ts.map +1 -0
  87. package/build/src/util/calculateSourcePath.js +20 -0
  88. package/build/src/util/calculateSourcePath.js.map +1 -0
  89. package/build/src/util/escapeRegExp.d.ts +4 -2
  90. package/build/src/util/escapeRegExp.d.ts.map +1 -1
  91. package/build/src/util/escapeRegExp.js +8 -6
  92. package/build/src/util/escapeRegExp.js.map +1 -1
  93. package/build/src/util/fileLists.d.ts +18 -0
  94. package/build/src/util/fileLists.d.ts.map +1 -0
  95. package/build/src/util/fileLists.js +48 -0
  96. package/build/src/util/fileLists.js.map +1 -0
  97. package/build/src/util/getDeveloperBinPath.d.ts +11 -9
  98. package/build/src/util/getDeveloperBinPath.d.ts.map +1 -1
  99. package/build/src/util/getDeveloperBinPath.js +38 -36
  100. package/build/src/util/getDeveloperBinPath.js.map +1 -1
  101. package/build/src/util/projectLoader.d.ts +6 -0
  102. package/build/src/util/projectLoader.d.ts.map +1 -0
  103. package/build/src/util/projectLoader.js +48 -0
  104. package/build/src/util/projectLoader.js.map +1 -0
  105. package/build/src/util/projectRunner.d.ts +5 -0
  106. package/build/src/util/projectRunner.d.ts.map +1 -0
  107. package/build/src/util/projectRunner.js +29 -0
  108. package/build/src/util/projectRunner.js.map +1 -0
  109. package/build/src/util/spawnAwait.d.ts +4 -0
  110. package/build/src/util/spawnAwait.d.ts.map +1 -0
  111. package/build/src/util/spawnAwait.js +22 -0
  112. package/build/src/util/spawnAwait.js.map +1 -0
  113. package/build/src/util/sysexits.d.ts +11 -9
  114. package/build/src/util/sysexits.d.ts.map +1 -1
  115. package/build/src/util/sysexits.js +5 -3
  116. package/build/src/util/sysexits.js.map +1 -1
  117. package/package.json +17 -12
  118. package/build/src/commands/build/BuildActivity.d.ts +0 -17
  119. package/build/src/commands/build/BuildActivity.d.ts.map +0 -1
  120. package/build/src/commands/build/BuildActivity.js +0 -11
  121. package/build/src/commands/build/BuildActivity.js.map +0 -1
  122. package/build/src/commands/build/BuildKmnKeyboard.d.ts +0 -10
  123. package/build/src/commands/build/BuildKmnKeyboard.d.ts.map +0 -1
  124. package/build/src/commands/build/BuildKmnKeyboard.js.map +0 -1
  125. package/build/src/commands/build/BuildLdmlKeyboard.d.ts +0 -10
  126. package/build/src/commands/build/BuildLdmlKeyboard.d.ts.map +0 -1
  127. package/build/src/commands/build/BuildLdmlKeyboard.js.map +0 -1
  128. package/build/src/commands/build/BuildModel.d.ts +0 -10
  129. package/build/src/commands/build/BuildModel.d.ts.map +0 -1
  130. package/build/src/commands/build/BuildModel.js.map +0 -1
  131. package/build/src/commands/build/BuildPackage.d.ts +0 -10
  132. package/build/src/commands/build/BuildPackage.d.ts.map +0 -1
  133. package/build/src/commands/build/BuildPackage.js.map +0 -1
  134. package/build/src/commands/build/BuildProject.d.ts +0 -11
  135. package/build/src/commands/build/BuildProject.d.ts.map +0 -1
  136. package/build/src/commands/build/BuildProject.js +0 -111
  137. package/build/src/commands/build/BuildProject.js.map +0 -1
  138. package/build/src/commands/build/buildActivities.d.ts +0 -3
  139. package/build/src/commands/build/buildActivities.d.ts.map +0 -1
  140. package/build/src/commands/build/buildActivities.js.map +0 -1
  141. package/build/src/messages/NodeCompilerCallbacks.d.ts +0 -21
  142. package/build/src/messages/NodeCompilerCallbacks.d.ts.map +0 -1
  143. package/build/src/messages/NodeCompilerCallbacks.js +0 -100
  144. package/build/src/messages/NodeCompilerCallbacks.js.map +0 -1
  145. package/build/src/util/kpj.schema.json +0 -127
  146. package/build/src/util/kvks.schema.json +0 -182
  147. package/build/src/util/ldml-keyboard.schema.json +0 -702
  148. package/build/src/util/ldml-keyboardtest.schema.json +0 -221
@@ -0,0 +1,114 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d7ff62d3-a542-552d-9afd-1d155bd0fd1b")}catch(e){}}();
2
+ import { KmnCompiler } from "@keymanapp/kmc-kmn";
3
+ import { NodeCompilerCallbacks } from "./NodeCompilerCallbacks.js";
4
+ import Sentry from "@sentry/node";
5
+ import KEYMAN_VERSION from "@keymanapp/keyman-version";
6
+ import { spawnChild } from "./spawnAwait.js";
7
+ const cli = process.argv.join(' ');
8
+ let isInit = false;
9
+ export class KeymanSentry {
10
+ static isTestCL() {
11
+ // Note single hyphen match which matches other Developer console app
12
+ // implementations, but this will also work with
13
+ // --sentry-client-test-exception, so we get the best of both worlds.
14
+ // This parameter is undocumented by design
15
+ return cli.includes('-sentry-client-test-exception');
16
+ }
17
+ static async runTestIfCLRequested() {
18
+ if (KeymanSentry.isTestCL()) {
19
+ await KeymanSentry.test();
20
+ console.error('Unexpected return from KeymanSentry.test');
21
+ process.exit(1);
22
+ }
23
+ }
24
+ static async test() {
25
+ KeymanSentry.init();
26
+ if (cli.includes('kmcmplib')) {
27
+ const compiler = new KmnCompiler();
28
+ const callbacks = new NodeCompilerCallbacks({});
29
+ if (!await compiler.init(callbacks)) {
30
+ throw new Error('Failed to instantiate WASM compiler');
31
+ }
32
+ try {
33
+ compiler.testSentry();
34
+ }
35
+ catch (e) {
36
+ await KeymanSentry.captureException(e);
37
+ }
38
+ }
39
+ else if (cli.includes('event')) {
40
+ const eventId = Sentry.captureMessage('Test message from -sentry-client-test-exception event');
41
+ await Sentry.close(2000);
42
+ console.log(`Captured test message with id ${eventId}`);
43
+ process.exit(0);
44
+ }
45
+ else {
46
+ try {
47
+ throw new Error('Test error from -sentry-client-test-exception event');
48
+ }
49
+ catch (e) {
50
+ await KeymanSentry.captureException(e);
51
+ }
52
+ }
53
+ }
54
+ static async isEnabled() {
55
+ if (process.argv.includes('--no-error-reporting')) {
56
+ return false;
57
+ }
58
+ if (process.argv.includes('--error-reporting')) {
59
+ return true;
60
+ }
61
+ if (process.platform == 'win32') {
62
+ // TODO: move to a .keymandeveloperrc or .kmcrc file in the future?
63
+ // On Win32, check HKCU\SOFTWARE\Keyman\Keyman Developer\IDE\Options, automatically report errors [REG_DWORD] == 0x1
64
+ try {
65
+ const data = (await spawnChild('reg.exe', [
66
+ 'query',
67
+ 'HKEY_CURRENT_USER\\SOFTWARE\\Keyman\\Keyman Developer\\IDE\\Options',
68
+ '/v',
69
+ 'automatically report errors'
70
+ ])).split(' ').pop().trim();
71
+ return data == '0x1';
72
+ }
73
+ catch (e) {
74
+ // the registry entry doesn't exist, assume 'yes'
75
+ return true;
76
+ }
77
+ }
78
+ // Default if no user setting is found, is true
79
+ return true;
80
+ }
81
+ static init() {
82
+ Sentry.init({
83
+ dsn: 'https://39b25a09410349a58fe12aaf721565af@o1005580.ingest.sentry.io/5983519',
84
+ environment: KEYMAN_VERSION.VERSION_ENVIRONMENT,
85
+ release: KEYMAN_VERSION.VERSION_GIT_TAG,
86
+ });
87
+ isInit = true;
88
+ }
89
+ static async captureException(e) {
90
+ if (isInit) {
91
+ const eventId = Sentry.captureException(e);
92
+ process.stderr.write(`
93
+ Fatal error: ${(e ?? '').toString()}
94
+
95
+ This error has been automatically reported to the Keyman team.
96
+ Identifier: ${eventId}
97
+ Application: Keyman Developer
98
+ Reported at: https://sentry.io/organizations/keyman/projects/keyman-developer/events/${eventId}/
99
+ `);
100
+ await Sentry.close(2000);
101
+ // For local development, we don't want to bury the trace; we need the cast to avoid
102
+ // TS2367 (comparison appears to be unintentional)
103
+ if (KEYMAN_VERSION.VERSION_ENVIRONMENT == 'local') {
104
+ throw e;
105
+ }
106
+ process.exit(1);
107
+ }
108
+ else {
109
+ throw e;
110
+ }
111
+ }
112
+ }
113
+ //# debugId=d7ff62d3-a542-552d-9afd-1d155bd0fd1b
114
+ //# sourceMappingURL=KeymanSentry.js.map
@@ -0,0 +1 @@
1
+ {"debug_id":"d7ff62d3-a542-552d-9afd-1d155bd0fd1b","file":"KeymanSentry.js","mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,YAAY;IACvB,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,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AEzB,oFAAoF;YACpF,kDAAkD;YAClD,IAAI,cAAc,CAAC,mBAA8B,IAAI,OAAO,EAAE;gBAC5D,MAAM,CAAC,CAAC;aACT;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;aAAM;YACL,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF","names":[],"sourceRoot":"","sources":["../../../src/util/KeymanSentry.ts"],"version":3}
@@ -0,0 +1,43 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="17c815ba-b4da-5e7a-9459-6e115717b735")}catch(e){}}();
2
+ import { CompilerCallbacks, CompilerEvent, CompilerPathCallbacks, CompilerFileSystemCallbacks, CompilerCallbackOptions } from '@keymanapp/common-types';
3
+ import chalk from 'chalk';
4
+ /**
5
+ * Concrete implementation for CLI use
6
+ */
7
+ export declare class NodeCompilerCallbacks implements CompilerCallbacks {
8
+ private options;
9
+ messages: CompilerEvent[];
10
+ messageCount: number;
11
+ messageFilename: string;
12
+ constructor(options: CompilerCallbackOptions);
13
+ clear(): void;
14
+ /**
15
+ * Returns true if any message in the log is a Fatal, Error, or if we are
16
+ * treating warnings as errors, a Warning. The warning option will be taken
17
+ * from the CompilerOptions passed to the constructor, or the parameter, to
18
+ * allow for per-file overrides (as seen with projects, for example).
19
+ * @param compilerWarningsAsErrors
20
+ * @returns
21
+ */
22
+ hasFailureMessage(compilerWarningsAsErrors?: boolean): boolean;
23
+ hasMessage(code: number): boolean;
24
+ private verifyFilenameConsistency;
25
+ loadFile(filename: string): Uint8Array;
26
+ fileSize(filename: string): number;
27
+ get path(): CompilerPathCallbacks;
28
+ get fs(): CompilerFileSystemCallbacks;
29
+ reportMessage(event: CompilerEvent): void;
30
+ /**
31
+ * We treat a few certain infrastructure messages with special colours
32
+ * @param event
33
+ * @returns
34
+ */
35
+ messageSpecialColor(event: CompilerEvent): chalk.Chalk & {
36
+ supportsColor: chalk.ColorSupport;
37
+ };
38
+ debug(msg: string): void;
39
+ fileExists(filename: string): boolean;
40
+ resolveFilename(baseFilename: string, filename: string): string;
41
+ }
42
+ //# debugId=17c815ba-b4da-5e7a-9459-6e115717b735
43
+ //# sourceMappingURL=NodeCompilerCallbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"debug_id":"17c815ba-b4da-5e7a-9459-6e115717b735","file":"NodeCompilerCallbacks.d.ts","mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAChC,qBAAqB,EAAE,2BAA2B,EAGlD,uBAAuB,EACD,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAOjD,OAAO,CAAC,OAAO;IAJ3B,QAAQ,EAAE,aAAa,EAAE,CAAM;IAC/B,YAAY,SAAK;IACjB,eAAe,EAAE,MAAM,CAAM;gBAET,OAAO,EAAE,uBAAuB;IAIpD,KAAK;IAML;;;;;;;OAOG;IACH,iBAAiB,CAAC,wBAAwB,CAAC,EAAE,OAAO,GAAG,OAAO;IAQ9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,OAAO,CAAC,yBAAyB;IAkBjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAatC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIlC,IAAI,IAAI,IAAI,qBAAqB,CAEhC;IAED,IAAI,EAAE,IAAI,2BAA2B,CAEpC;IAED,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IA0DzC;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,aAAa;;;IAcxC,KAAK,CAAC,GAAG,EAAE,MAAM;IAMjB,UAAU,CAAC,QAAQ,EAAE,MAAM;IAI3B,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAmBvD","names":[],"sourceRoot":"","sources":["../../../src/util/NodeCompilerCallbacks.ts"],"version":3}
@@ -0,0 +1,184 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="57b5e165-9b95-540f-a2bd-3fb364aec3ae")}catch(e){}}();
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+ import { compilerLogLevelToSeverity, CompilerErrorSeverity, CompilerError, CompilerFileCallbacks } from '@keymanapp/common-types';
5
+ import { InfrastructureMessages } from '../messages/messages.js';
6
+ import chalk from 'chalk';
7
+ import supportsColor from 'supports-color';
8
+ const color = chalk.default;
9
+ const severityColors = {
10
+ [CompilerErrorSeverity.Info]: color.reset,
11
+ [CompilerErrorSeverity.Hint]: color.blueBright,
12
+ [CompilerErrorSeverity.Warn]: color.hex('FFA500'),
13
+ [CompilerErrorSeverity.Error]: color.redBright,
14
+ [CompilerErrorSeverity.Fatal]: color.redBright,
15
+ };
16
+ /**
17
+ * Maximum messages that will be emitted before suppressing further messages.
18
+ * We may in the future make this user configurable?
19
+ */
20
+ const MaxMessagesDefault = 100;
21
+ /**
22
+ * Concrete implementation for CLI use
23
+ */
24
+ export class NodeCompilerCallbacks {
25
+ options;
26
+ /* NodeCompilerCallbacks */
27
+ messages = [];
28
+ messageCount = 0;
29
+ messageFilename = '';
30
+ constructor(options) {
31
+ this.options = options;
32
+ color.enabled = this.options.color ?? (supportsColor.stdout ? supportsColor.stdout.hasBasic : false);
33
+ }
34
+ clear() {
35
+ this.messages = [];
36
+ this.messageCount = 0;
37
+ this.messageFilename = '';
38
+ }
39
+ /**
40
+ * Returns true if any message in the log is a Fatal, Error, or if we are
41
+ * treating warnings as errors, a Warning. The warning option will be taken
42
+ * from the CompilerOptions passed to the constructor, or the parameter, to
43
+ * allow for per-file overrides (as seen with projects, for example).
44
+ * @param compilerWarningsAsErrors
45
+ * @returns
46
+ */
47
+ hasFailureMessage(compilerWarningsAsErrors) {
48
+ return CompilerFileCallbacks.hasFailureMessage(this.messages,
49
+ // parameter overrides global option
50
+ compilerWarningsAsErrors ?? this.options.compilerWarningsAsErrors);
51
+ }
52
+ hasMessage(code) {
53
+ return this.messages.find((item) => item.code == code) === undefined ? false : true;
54
+ }
55
+ verifyFilenameConsistency(originalFilename) {
56
+ if (fs.existsSync(originalFilename)) {
57
+ // Note, we only check this if the file exists, because
58
+ // if it is not found, that will be returned as an error
59
+ // from loadFile anyway.
60
+ const filename = fs.realpathSync(originalFilename);
61
+ const nativeFilename = fs.realpathSync.native(filename);
62
+ if (filename != nativeFilename) {
63
+ this.reportMessage(InfrastructureMessages.Hint_FilenameHasDifferingCase({
64
+ reference: path.basename(originalFilename),
65
+ filename: path.basename(nativeFilename)
66
+ }));
67
+ }
68
+ }
69
+ }
70
+ /* CompilerCallbacks */
71
+ loadFile(filename) {
72
+ this.verifyFilenameConsistency(filename);
73
+ try {
74
+ return fs.readFileSync(filename);
75
+ }
76
+ catch (e) {
77
+ if (e.code === 'ENOENT') {
78
+ return null;
79
+ }
80
+ else {
81
+ throw e;
82
+ }
83
+ }
84
+ }
85
+ fileSize(filename) {
86
+ return fs.statSync(filename)?.size;
87
+ }
88
+ get path() {
89
+ return path;
90
+ }
91
+ get fs() {
92
+ return fs;
93
+ }
94
+ reportMessage(event) {
95
+ if (!event.filename) {
96
+ event.filename = this.messageFilename;
97
+ }
98
+ if (this.messageFilename != event.filename) {
99
+ // Reset max message limit when a new file is being processed
100
+ this.messageFilename = event.filename;
101
+ this.messageCount = 0;
102
+ }
103
+ this.messages.push({ ...event });
104
+ if (CompilerError.severity(event.code) < compilerLogLevelToSeverity[this.options.logLevel]) {
105
+ // collect messages but don't print to console
106
+ return;
107
+ }
108
+ // We don't use this.messages.length because we only want to count visible
109
+ // messages, and there's no point in recalculating the total for every
110
+ // message emitted.
111
+ this.messageCount++;
112
+ if (this.messageCount > MaxMessagesDefault) {
113
+ return;
114
+ }
115
+ if (this.messageCount == MaxMessagesDefault) {
116
+ // We've hit our event limit so we'll suppress further messages, and emit
117
+ // our little informational message so users know what's going on. Note
118
+ // that this message will not be included in the this.messages array, and
119
+ // that will continue to collect all messages; this only affects the
120
+ // console emission of messages.
121
+ event = InfrastructureMessages.Info_TooManyMessages({ count: MaxMessagesDefault });
122
+ event.filename = this.messageFilename;
123
+ }
124
+ const severityColor = severityColors[CompilerError.severity(event.code)] ?? color.reset;
125
+ const messageColor = this.messageSpecialColor(event) ?? color.reset;
126
+ process.stdout.write((event.filename
127
+ ? color.cyan(CompilerError.formatFilename(event.filename)) +
128
+ (event.line ? ':' + color.yellowBright(CompilerError.formatLine(event.line)) : '') + ' - '
129
+ : '') +
130
+ severityColor(CompilerError.formatSeverity(event.code)) + ' ' +
131
+ color.grey(CompilerError.formatCode(event.code)) + ': ' +
132
+ messageColor(CompilerError.formatMessage(event.message)) + '\n');
133
+ if (event.code == InfrastructureMessages.INFO_ProjectBuiltSuccessfully) {
134
+ // Special case: we'll add a blank line after project builds
135
+ process.stdout.write('\n');
136
+ }
137
+ }
138
+ /**
139
+ * We treat a few certain infrastructure messages with special colours
140
+ * @param event
141
+ * @returns
142
+ */
143
+ messageSpecialColor(event) {
144
+ switch (event.code) {
145
+ case InfrastructureMessages.INFO_BuildingFile:
146
+ return color.whiteBright;
147
+ case InfrastructureMessages.INFO_FileNotBuiltSuccessfully:
148
+ case InfrastructureMessages.INFO_ProjectNotBuiltSuccessfully:
149
+ return color.red;
150
+ case InfrastructureMessages.INFO_FileBuiltSuccessfully:
151
+ case InfrastructureMessages.INFO_ProjectBuiltSuccessfully:
152
+ return color.green;
153
+ }
154
+ return null;
155
+ }
156
+ debug(msg) {
157
+ if (this.options.logLevel == 'debug') {
158
+ console.debug(msg);
159
+ }
160
+ }
161
+ fileExists(filename) {
162
+ return fs.existsSync(filename);
163
+ }
164
+ resolveFilename(baseFilename, filename) {
165
+ const basePath = baseFilename.endsWith('/') || baseFilename.endsWith('\\') ?
166
+ baseFilename :
167
+ path.dirname(baseFilename);
168
+ // Transform separators to platform separators -- we are agnostic
169
+ // in our use here but path prefers files may use
170
+ // either / or \, although older kps files were always \.
171
+ if (path.sep == '/') {
172
+ filename = filename.replace(/\\/g, '/');
173
+ }
174
+ else {
175
+ filename = filename.replace(/\//g, '\\');
176
+ }
177
+ if (!path.isAbsolute(filename)) {
178
+ filename = path.resolve(basePath, filename);
179
+ }
180
+ return filename;
181
+ }
182
+ }
183
+ //# debugId=57b5e165-9b95-540f-a2bd-3fb364aec3ae
184
+ //# sourceMappingURL=NodeCompilerCallbacks.js.map
@@ -0,0 +1 @@
1
+ {"debug_id":"57b5e165-9b95-540f-a2bd-3fb364aec3ae","file":"NodeCompilerCallbacks.js","mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAEE,0BAA0B,EAAE,qBAAqB,EACjD,aAAa,EAEb,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;AAC5B,MAAM,cAAc,GAAoD;IACtE,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK;IACzC,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU;IAC9C,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;IACjD,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS;IAC9C,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS;CAC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,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7B,iEAAiE;QACjE,iDAAiD;QACjD,yDAAyD;QACzD,IAAG,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE;YAClB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SACzC;aAAM;YACL,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;SAC1C;QACD,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAC7B,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;SAC7C;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CAEF","names":[],"sourceRoot":"","sources":["../../../src/util/NodeCompilerCallbacks.ts"],"version":3}
@@ -0,0 +1,11 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4fc65050-5d5f-5b50-9cf6-7091ecd505dc")}catch(e){}}();
2
+ import { Command } from "commander";
3
+ export declare class BaseOptions {
4
+ static addVersion(program: Command): Command;
5
+ static addSentry(program: Command): Command;
6
+ static addLogLevel(program: Command): Command;
7
+ static addOutFile(program: Command): Command;
8
+ static addAll(program: Command): Command;
9
+ }
10
+ //# debugId=4fc65050-5d5f-5b50-9cf6-7091ecd505dc
11
+ //# sourceMappingURL=baseOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"debug_id":"4fc65050-5d5f-5b50-9cf6-7091ecd505dc","file":"baseOptions.d.ts","mappings":";AACA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAK5C,qBAAa,WAAW;WACR,UAAU,CAAC,OAAO,EAAE,OAAO;WAI3B,SAAS,CAAC,OAAO,EAAE,OAAO;WAU1B,WAAW,CAAC,OAAO,EAAE,OAAO;WAI5B,UAAU,CAAC,OAAO,EAAE,OAAO;WAI3B,MAAM,CAAC,OAAO,EAAE,OAAO;CAOtC","names":[],"sourceRoot":"","sources":["../../../src/util/baseOptions.ts"],"version":3}
@@ -0,0 +1,34 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="85863716-1aff-5c3e-aa90-d3f06bcd75cb")}catch(e){}}();
2
+ import { ALL_COMPILER_LOG_LEVELS } from "@keymanapp/common-types";
3
+ import { Option } from "commander";
4
+ import KEYMAN_VERSION from "@keymanapp/keyman-version";
5
+ // These options map to CompilerBaseOptions
6
+ export class BaseOptions {
7
+ static addVersion(program) {
8
+ return program.version(KEYMAN_VERSION.VERSION_WITH_TAG);
9
+ }
10
+ static addSentry(program) {
11
+ // This corresponds to an option tested in KeymanSentry.ts, which is
12
+ // searched for in process.argv, in order to avoid depending on Commander to
13
+ // start Sentry, and to ensure that we capture errors as early as possible
14
+ // in launch
15
+ return program
16
+ .addOption(new Option('--no-error-reporting', 'Disable error reporting to keyman.com (overriding user settings)'))
17
+ .addOption(new Option('--error-reporting', 'Enable error reporting to keyman.com (overriding user settings)'));
18
+ }
19
+ static addLogLevel(program) {
20
+ return program.addOption(new Option('-l, --log-level <logLevel>', 'Log level').choices(ALL_COMPILER_LOG_LEVELS).default('info'));
21
+ }
22
+ static addOutFile(program) {
23
+ return program.option('-o, --out-file <filename>', 'Override the default path and filename for the output file');
24
+ }
25
+ static addAll(program) {
26
+ return [
27
+ this.addVersion,
28
+ this.addLogLevel,
29
+ this.addOutFile,
30
+ ].reduce((p, f) => f(p), program);
31
+ }
32
+ }
33
+ //# debugId=85863716-1aff-5c3e-aa90-d3f06bcd75cb
34
+ //# sourceMappingURL=baseOptions.js.map
@@ -0,0 +1 @@
1
+ {"debug_id":"85863716-1aff-5c3e-aa90-d3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,0 +1,13 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="387a45ed-728c-50aa-adf2-cb36ae77f022")}catch(e){}}();
2
+ /**
3
+ * This is a helper function to derive the relative path within the
4
+ * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
5
+ * project filename. Handles \ vs /. Must be a project filename, not a project
6
+ * folder.
7
+ *
8
+ * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
9
+ * want "release/k/keyboard".
10
+ */
11
+ export declare function calculateSourcePath(projectFilename: string): string;
12
+ //# debugId=387a45ed-728c-50aa-adf2-cb36ae77f022
13
+ //# sourceMappingURL=calculateSourcePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"debug_id":"387a45ed-728c-50aa-adf2-cb36ae77f022","file":"calculateSourcePath.d.ts","mappings":";AAAA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAOnE","names":[],"sourceRoot":"","sources":["../../../src/util/calculateSourcePath.ts"],"version":3}
@@ -0,0 +1,20 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="67562a19-b44f-5af0-9b7f-cdcd36e94b8d")}catch(e){}}();
2
+ /**
3
+ * This is a helper function to derive the relative path within the
4
+ * @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
5
+ * project filename. Handles \ vs /. Must be a project filename, not a project
6
+ * folder.
7
+ *
8
+ * For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
9
+ * want "release/k/keyboard".
10
+ */
11
+ export function calculateSourcePath(projectFilename) {
12
+ projectFilename = projectFilename.replace(/\\/g, '/');
13
+ const result = /([^\/]+)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.kpj$/.exec(projectFilename);
14
+ if (!result) {
15
+ throw new Error(`Invalid path ${projectFilename}`);
16
+ }
17
+ return `${result[1]}/${result[2]}/${result[3]}`;
18
+ }
19
+ //# debugId=67562a19-b44f-5af0-9b7f-cdcd36e94b8d
20
+ //# sourceMappingURL=calculateSourcePath.js.map
@@ -0,0 +1 @@
1
+ {"debug_id":"67562a19-b44f-5af0-9b7f-cdcd36e94b8d","file":"calculateSourcePath.js","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,8CAA8C,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACpF,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,eAAe,EAAE,CAAC,CAAC;KACpD;IACD,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAClD,CAAC","names":[],"sourceRoot":"","sources":["../../../src/util/calculateSourcePath.ts"],"version":3}
@@ -1,2 +1,4 @@
1
- export declare function escapeRegExp(s: string): string;
2
- //# sourceMappingURL=escapeRegExp.d.ts.map
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4a609030-5ed1-5206-8343-4d86cf6b8f9f")}catch(e){}}();
2
+ export declare function escapeRegExp(s: string): string;
3
+ //# debugId=4a609030-5ed1-5206-8343-4d86cf6b8f9f
4
+ //# sourceMappingURL=escapeRegExp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"escapeRegExp.d.ts","sourceRoot":"","sources":["../../../src/util/escapeRegExp.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAErC"}
1
+ {"debug_id":"4a609030-5ed1-5206-8343-4d86cf6b8f9f","file":"escapeRegExp.d.ts","mappings":";AAIA,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAErC","names":[],"sourceRoot":"","sources":["../../../src/util/escapeRegExp.ts"],"version":3}
@@ -1,6 +1,8 @@
1
- const escapedRegexp = /[.*+?^${}()|[\]\\]/g;
2
- // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
3
- export function escapeRegExp(s) {
4
- return s.replace(escapedRegexp, "\\$&"); // $& means the whole matched string
5
- }
6
- //# sourceMappingURL=escapeRegExp.js.map
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0456ae7e-2a9f-552d-8dbc-cede9d54dff7")}catch(e){}}();
2
+ const escapedRegexp = /[.*+?^${}()|[\]\\]/g;
3
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
4
+ export function escapeRegExp(s) {
5
+ return s.replace(escapedRegexp, "\\$&"); // $& means the whole matched string
6
+ }
7
+ //# debugId=0456ae7e-2a9f-552d-8dbc-cede9d54dff7
8
+ //# sourceMappingURL=escapeRegExp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"escapeRegExp.js","sourceRoot":"","sources":["../../../src/util/escapeRegExp.ts"],"names":[],"mappings":"AACA,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,oCAAoC;AAC/E,CAAC"}
1
+ {"debug_id":"0456ae7e-2a9f-552d-8dbc-cede9d54dff7","file":"escapeRegExp.js","mappings":";AACA,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,oCAAoC;AAC/E,CAAC","names":[],"sourceRoot":"","sources":["../../../src/util/escapeRegExp.ts"],"version":3}
@@ -0,0 +1,18 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b6aae124-e0a0-5b57-b5ee-4d94197c0a83")}catch(e){}}();
2
+ import { CompilerCallbacks } from "@keymanapp/common-types";
3
+ /**
4
+ * Replaces each entry starting with `@` with the content of the file, with one
5
+ * line per file, filenames trimmed, and any lines that are blank or starting
6
+ * with `#` (marking a comment) removed. Note: `#` anywhere else is treated as
7
+ * part of the filename.
8
+ *
9
+ * If any filelist does not exist, reports an error and returns false.
10
+ *
11
+ * @param filenames
12
+ * @param callbacks
13
+ * @returns false on failure
14
+ */
15
+ export declare function expandFileLists(filenames: string[], callbacks: CompilerCallbacks): boolean;
16
+ export declare function expandFileList(filename: string, callbacks: CompilerCallbacks): string[];
17
+ //# debugId=b6aae124-e0a0-5b57-b5ee-4d94197c0a83
18
+ //# sourceMappingURL=fileLists.d.ts.map
@@ -0,0 +1 @@
1
+ {"debug_id":"b6aae124-e0a0-5b57-b5ee-4d94197c0a83","file":"fileLists.d.ts","mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,iBAAiB,WAehF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAcvF","names":[],"sourceRoot":"","sources":["../../../src/util/fileLists.ts"],"version":3}
@@ -0,0 +1,48 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="82346555-3b48-535b-8ada-ce01de0d56e6")}catch(e){}}();
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+ import { InfrastructureMessages } from "../messages/messages.js";
5
+ /**
6
+ * Replaces each entry starting with `@` with the content of the file, with one
7
+ * line per file, filenames trimmed, and any lines that are blank or starting
8
+ * with `#` (marking a comment) removed. Note: `#` anywhere else is treated as
9
+ * part of the filename.
10
+ *
11
+ * If any filelist does not exist, reports an error and returns false.
12
+ *
13
+ * @param filenames
14
+ * @param callbacks
15
+ * @returns false on failure
16
+ */
17
+ export function expandFileLists(filenames, callbacks) {
18
+ let i = 0;
19
+ while (i < filenames.length) {
20
+ if (filenames[i].startsWith('@')) {
21
+ const fileList = expandFileList(filenames[i].substring(1), callbacks);
22
+ if (fileList === null) {
23
+ return false;
24
+ }
25
+ filenames.splice(i, 1, ...fileList);
26
+ i += fileList.length;
27
+ }
28
+ else {
29
+ i++;
30
+ }
31
+ }
32
+ return true;
33
+ }
34
+ export function expandFileList(filename, callbacks) {
35
+ if (!fs.existsSync(filename)) {
36
+ callbacks.reportMessage(InfrastructureMessages.Error_FileDoesNotExist({ filename }));
37
+ return null;
38
+ }
39
+ const files = fs.readFileSync(filename, 'utf-8').split('\n').map(item => {
40
+ item = item.trim();
41
+ return item.startsWith('#') || item == ''
42
+ ? ''
43
+ : path.resolve(path.dirname(filename), item);
44
+ }).filter(item => item.length > 0);
45
+ return files;
46
+ }
47
+ //# debugId=82346555-3b48-535b-8ada-ce01de0d56e6
48
+ //# sourceMappingURL=fileLists.js.map
@@ -0,0 +1 @@
1
+ {"debug_id":"82346555-3b48-535b-8ada-ce01de0d56e6","file":"fileLists.js","mappings":";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,IAAI,IAAI,EAAE;YACvC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAA;IAChD,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC;AACf,CAAC","names":[],"sourceRoot":"","sources":["../../../src/util/fileLists.ts"],"version":3}
@@ -1,9 +1,11 @@
1
- /**
2
- * Locates the Keyman Developer bin folder, checking first if this is running
3
- * from the source repository (using the presence of the KEYMAN_ROOT environment
4
- * variable), and if not, checking for the presence of kmcomp.exe in each
5
- * parent folder recursively until we reach the root of the filesystem.
6
- * @returns string | null
7
- */
8
- export declare function getDeveloperBinPath(): string;
9
- //# sourceMappingURL=getDeveloperBinPath.d.ts.map
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ccf35344-383f-53f0-959f-373b924c6294")}catch(e){}}();
2
+ /**
3
+ * Locates the Keyman Developer bin folder, checking first if this is running
4
+ * from the source repository (using the presence of the KEYMAN_ROOT environment
5
+ * variable), and if not, checking for the presence of kmcomp.exe in each
6
+ * parent folder recursively until we reach the root of the filesystem.
7
+ * @returns string | null
8
+ */
9
+ export declare function getDeveloperBinPath(): string;
10
+ //# debugId=ccf35344-383f-53f0-959f-373b924c6294
11
+ //# sourceMappingURL=getDeveloperBinPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDeveloperBinPath.d.ts","sourceRoot":"","sources":["../../../src/util/getDeveloperBinPath.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CA0B5C"}
1
+ {"debug_id":"ccf35344-383f-53f0-959f-373b924c6294","file":"getDeveloperBinPath.d.ts","mappings":";AAIA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CA0B5C","names":[],"sourceRoot":"","sources":["../../../src/util/getDeveloperBinPath.ts"],"version":3}