@markw65/monkeyc-optimizer 1.1.27 → 1.1.28

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.
package/README.md CHANGED
@@ -876,3 +876,14 @@ No functional change, just fixes a typo that broke the typescript exports.
876
876
 
877
877
  - New features
878
878
  - Adds a [standalone script](https://github.com/markw65/monkeyc-optimizer/wiki/Garmin-Font-Analyzer) to analyze .cft (font) files.
879
+
880
+ ### 1.1.28
881
+
882
+ - Bug fixes
883
+
884
+ - Fixes an issue in the post build optimizer which could cause a pre-definition to be inserted just prior to an `frpush`, which could result in the wrong value of `self` being passed to a call
885
+ - Don't add personality paths to the generated jungle file if the sdk is prior to 4.2.1
886
+ - Fixes a bug in the source-to-source optimizer that could incorrectly infer that an `if` block was never entered when the if's comparison was between a primitive type, and a plain `Object`
887
+
888
+ - Improved optimizations
889
+ - Constant folding between `Char` and types other than `Number` is now handled (previously such comparisons were just left for Garmin's compiler to handle). This works around a [bug in Garmin's optimizer](https://forums.garmin.com/developer/connect-iq/i/bug-reports/the-optimizer-constant-folds-char-comparisons-incorrectly) by (correctly) resolving the comparisons before Garmin's optimizer can do the wrong thing.
package/build/api.cjs CHANGED
@@ -18,44 +18,44 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var api_exports = {};
20
20
  __export(api_exports, {
21
- checkCompilerVersion: () => import_chunk_DD4VX53Y.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_DD4VX53Y.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_DD4VX53Y.createDocumentationMap,
24
- diagnostic: () => import_chunk_DD4VX53Y.diagnostic,
25
- diagnosticHelper: () => import_chunk_DD4VX53Y.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_DD4VX53Y.findNamesInScope,
27
- findUsingForNode: () => import_chunk_DD4VX53Y.findUsingForNode,
28
- formatAst: () => import_chunk_DD4VX53Y.formatAst,
29
- formatAstLongLines: () => import_chunk_DD4VX53Y.formatAstLongLines,
30
- getApiFunctionInfo: () => import_chunk_DD4VX53Y.getApiFunctionInfo,
31
- getApiMapping: () => import_chunk_DD4VX53Y.getApiMapping,
32
- getSuperClasses: () => import_chunk_DD4VX53Y.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_ZI7CGRJC.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_ZI7CGRJC.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_ZI7CGRJC.createDocumentationMap,
24
+ diagnostic: () => import_chunk_ZI7CGRJC.diagnostic,
25
+ diagnosticHelper: () => import_chunk_ZI7CGRJC.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_ZI7CGRJC.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_ZI7CGRJC.findUsingForNode,
28
+ formatAst: () => import_chunk_ZI7CGRJC.formatAst,
29
+ formatAstLongLines: () => import_chunk_ZI7CGRJC.formatAstLongLines,
30
+ getApiFunctionInfo: () => import_chunk_ZI7CGRJC.getApiFunctionInfo,
31
+ getApiMapping: () => import_chunk_ZI7CGRJC.getApiMapping,
32
+ getSuperClasses: () => import_chunk_ZI7CGRJC.getSuperClasses,
33
33
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
34
- isClassVariable: () => import_chunk_DD4VX53Y.isClassVariable,
35
- isLocal: () => import_chunk_DD4VX53Y.isLocal,
36
- isLookupCandidate: () => import_chunk_DD4VX53Y.isLookupCandidate,
37
- isStateNode: () => import_chunk_DD4VX53Y.isStateNode,
38
- lookupByFullName: () => import_chunk_DD4VX53Y.lookupByFullName,
39
- lookupNext: () => import_chunk_DD4VX53Y.lookupNext,
40
- lookupResultContains: () => import_chunk_DD4VX53Y.lookupResultContains,
41
- lookupWithType: () => import_chunk_DD4VX53Y.lookupWithType,
42
- makeToyboxLink: () => import_chunk_DD4VX53Y.makeToyboxLink,
43
- mapVarDeclsByType: () => import_chunk_DD4VX53Y.mapVarDeclsByType,
44
- markInvokeClassMethod: () => import_chunk_DD4VX53Y.markInvokeClassMethod,
45
- parseSdkVersion: () => import_chunk_DD4VX53Y.parseSdkVersion,
46
- sameLookupResult: () => import_chunk_DD4VX53Y.sameLookupResult,
34
+ isClassVariable: () => import_chunk_ZI7CGRJC.isClassVariable,
35
+ isLocal: () => import_chunk_ZI7CGRJC.isLocal,
36
+ isLookupCandidate: () => import_chunk_ZI7CGRJC.isLookupCandidate,
37
+ isStateNode: () => import_chunk_ZI7CGRJC.isStateNode,
38
+ lookupByFullName: () => import_chunk_ZI7CGRJC.lookupByFullName,
39
+ lookupNext: () => import_chunk_ZI7CGRJC.lookupNext,
40
+ lookupResultContains: () => import_chunk_ZI7CGRJC.lookupResultContains,
41
+ lookupWithType: () => import_chunk_ZI7CGRJC.lookupWithType,
42
+ makeToyboxLink: () => import_chunk_ZI7CGRJC.makeToyboxLink,
43
+ mapVarDeclsByType: () => import_chunk_ZI7CGRJC.mapVarDeclsByType,
44
+ markInvokeClassMethod: () => import_chunk_ZI7CGRJC.markInvokeClassMethod,
45
+ parseSdkVersion: () => import_chunk_ZI7CGRJC.parseSdkVersion,
46
+ sameLookupResult: () => import_chunk_ZI7CGRJC.sameLookupResult,
47
47
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
48
- variableDeclarationName: () => import_chunk_DD4VX53Y.variableDeclarationName,
49
- visitReferences: () => import_chunk_DD4VX53Y.visitReferences,
50
- visit_resources: () => import_chunk_DD4VX53Y.visit_resources,
51
- visitorNode: () => import_chunk_DD4VX53Y.visitorNode
48
+ variableDeclarationName: () => import_chunk_ZI7CGRJC.variableDeclarationName,
49
+ visitReferences: () => import_chunk_ZI7CGRJC.visitReferences,
50
+ visit_resources: () => import_chunk_ZI7CGRJC.visit_resources,
51
+ visitorNode: () => import_chunk_ZI7CGRJC.visitorNode
52
52
  });
53
53
  module.exports = __toCommonJS(api_exports);
54
- var import_chunk_DD4VX53Y = require("./chunk-DD4VX53Y.cjs");
54
+ var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
55
55
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
56
56
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
57
57
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
58
- (0, import_chunk_DD4VX53Y.init_api)();
58
+ (0, import_chunk_ZI7CGRJC.init_api)();
59
59
  // Annotate the CommonJS export names for ESM import in node:
60
60
  0 && (module.exports = {
61
61
  checkCompilerVersion,
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_DD4VX53Y_exports = {};
30
- __export(chunk_DD4VX53Y_exports, {
29
+ var chunk_ZI7CGRJC_exports = {};
30
+ __export(chunk_ZI7CGRJC_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -122,7 +122,7 @@ __export(chunk_DD4VX53Y_exports, {
122
122
  visitorNode: () => visitorNode,
123
123
  xml_util_exports: () => xml_util_exports
124
124
  });
125
- module.exports = __toCommonJS(chunk_DD4VX53Y_exports);
125
+ module.exports = __toCommonJS(chunk_ZI7CGRJC_exports);
126
126
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
127
127
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
128
128
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -10008,13 +10008,18 @@ function restrictExactTypesByEquality(a, b) {
10008
10008
  }
10009
10009
  case 8: {
10010
10010
  let extra_bits = 0;
10011
- if (b.type & 2 && (a.value == null || a.value === 0)) {
10011
+ if (a.value == null || a.value === 0) {
10012
10012
  extra_bits |= 2;
10013
10013
  }
10014
- if (b.type & 4 && (a.value == null || a.value === 1)) {
10014
+ if (a.value == null || a.value === 1) {
10015
10015
  extra_bits |= 4;
10016
10016
  }
10017
10017
  let value_bits = b.type & (120 | 128);
10018
+ if (b.type & 32768 && !getObjectValue(b)) {
10019
+ value_bits |= 120 | 128;
10020
+ } else {
10021
+ extra_bits &= b.type;
10022
+ }
10018
10023
  if (a.value != null && value_bits & 32 && roundToFloat(Number(a.value)) !== a.value) {
10019
10024
  value_bits -= 32;
10020
10025
  }
@@ -10035,11 +10040,17 @@ function restrictExactTypesByEquality(a, b) {
10035
10040
  return fixupEnum(a, v, b);
10036
10041
  }
10037
10042
  case 16: {
10038
- let value_bits = b.type & 120;
10043
+ let value_bits = b.type & (120 | 128);
10044
+ if (b.type & 32768 && !getObjectValue(b)) {
10045
+ value_bits |= 120 | 128;
10046
+ }
10039
10047
  if (a.value != null) {
10040
10048
  if (value_bits & 8 && BigInt.asIntN(32, a.value) !== a.value) {
10041
10049
  value_bits -= 8;
10042
10050
  }
10051
+ if (value_bits & 128 && BigInt.asIntN(32, a.value) !== a.value) {
10052
+ value_bits -= 128;
10053
+ }
10043
10054
  if (value_bits & 32 && BigInt(roundToFloat(Number(a.value))) !== a.value) {
10044
10055
  value_bits -= 32;
10045
10056
  }
@@ -10065,23 +10076,25 @@ function restrictExactTypesByEquality(a, b) {
10065
10076
  }
10066
10077
  case 64:
10067
10078
  case 32: {
10068
- let value_bits = 120;
10079
+ let value_bits = b.type & (120 | 128);
10080
+ if (b.type & 32768 && !getObjectValue(b)) {
10081
+ value_bits |= 120 | 128;
10082
+ }
10069
10083
  if (a.value != null) {
10070
10084
  if (!Number.isInteger(a.value)) {
10071
- value_bits -= 8 | 16;
10085
+ value_bits &= ~(8 | 16 | 128);
10072
10086
  } else {
10073
10087
  if (Number(BigInt.asIntN(32, BigInt(a.value))) !== a.value) {
10074
- value_bits -= 8;
10088
+ value_bits &= ~(8 | 128);
10075
10089
  }
10076
10090
  }
10077
10091
  }
10078
- value_bits &= b.type;
10079
10092
  let v = {
10080
10093
  type: value_bits
10081
10094
  };
10082
10095
  if (value_bits && !(value_bits & value_bits - 1)) {
10083
10096
  if (a.value != null) {
10084
- v.value = value_bits === 16 ? BigInt(a.value) : Number(a.value);
10097
+ v.value = value_bits === 16 ? BigInt(a.value) : value_bits === 128 ? String.fromCharCode(Number(a.value)) : a.value;
10085
10098
  if (b.value && !couldBe(v, b)) {
10086
10099
  v.type = 0;
10087
10100
  delete v.value;
@@ -10093,13 +10106,25 @@ function restrictExactTypesByEquality(a, b) {
10093
10106
  return fixupEnum(a, v, b);
10094
10107
  }
10095
10108
  case 128: {
10096
- const value_bits = b.type & (8 | 128);
10109
+ let extra_bits = 0;
10110
+ if (a.value == null || a.value.charCodeAt(0) === 0) {
10111
+ extra_bits |= 2;
10112
+ }
10113
+ if (a.value == null || a.value.charCodeAt(0) === 1) {
10114
+ extra_bits |= 4;
10115
+ }
10116
+ let value_bits = b.type & (120 | 128);
10117
+ if (b.type & 32768 && !getObjectValue(b)) {
10118
+ value_bits |= 120 | 128;
10119
+ } else {
10120
+ extra_bits &= b.type;
10121
+ }
10097
10122
  let v = {
10098
- type: value_bits
10123
+ type: value_bits | extra_bits
10099
10124
  };
10100
10125
  if (value_bits && !(value_bits & value_bits - 1)) {
10101
10126
  if (a.value != null) {
10102
- v.value = value_bits === 8 ? a.value.charCodeAt(0) : a.value;
10127
+ v.value = value_bits === 16 ? BigInt(a.value.charCodeAt(0)) : value_bits & 120 ? a.value.charCodeAt(0) : a.value;
10103
10128
  if (b.value && !couldBe(v, b)) {
10104
10129
  v.type = 0;
10105
10130
  delete v.value;
@@ -10403,10 +10428,10 @@ function equalsCheck(left, right) {
10403
10428
  return left.type & 120 && right.type & 120 ? (
10404
10429
  // eslint-disable-next-line eqeqeq
10405
10430
  left.value == right.value
10406
- ) : lrBits === (8 | 128) ? (
10407
- // Char vs Number is true iff the number is the char-code of the char
10408
- left.type === 128 ? left.value.charCodeAt(0) === right.value : left.value === right.value.charCodeAt(0)
10409
- ) : left.type === 8 && right.type & 6 ? left.value === (right.value ? 1 : 0) : right.type === 8 && left.type & 6 ? right.value === (left.value ? 1 : 0) : left.type !== right.type ? lrBits & 1 ? lrBits & (32768 | 512 | 1024) ? void 0 : false : lrBits & (4096 | 8192 | 16384) ? false : void 0 : left.type === 128 || left.type === 131072 ? left.value === right.value : isSingleton(left) ? true : void 0;
10431
+ ) : (
10432
+ // Char vs Numeric is true iff the number is the char-code of the char
10433
+ left.type === 128 && right.type & 120 ? left.value.charCodeAt(0) === Number(right.value) : right.type === 128 && left.type & 120 ? Number(left.value) === right.value.charCodeAt(0) : left.type === 128 && right.type & 6 ? left.value.charCodeAt(0) === (right.value ? 1 : 0) : right.type === 128 && left.type & 6 ? right.value.charCodeAt(0) === (left.value ? 1 : 0) : left.type === 8 && right.type & 6 ? left.value === (right.value ? 1 : 0) : right.type === 8 && left.type & 6 ? right.value === (left.value ? 1 : 0) : left.type !== right.type ? lrBits & 1 ? lrBits & (32768 | 512 | 1024) ? void 0 : false : lrBits & (4096 | 8192 | 16384) ? false : void 0 : left.type === 128 || left.type === 131072 ? left.value === right.value : isSingleton(left) ? true : void 0
10434
+ );
10410
10435
  }
10411
10436
  function evaluateBinaryTypes(op, left, right) {
10412
10437
  if (!operators) {
@@ -18180,7 +18205,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
18180
18205
  pragmaChecker(state, f.ast, state.diagnostics?.[name]);
18181
18206
  }
18182
18207
  });
18183
- return state.diagnostics;
18208
+ return { diagnostics: state.diagnostics, sdkVersion: state.sdkVersion };
18184
18209
  }
18185
18210
  function maybeCalled(state, func) {
18186
18211
  if (!func.body) {
@@ -21567,7 +21592,7 @@ function sizeBasedPRE2(func, context) {
21567
21592
  })
21568
21593
  );
21569
21594
  (0, import_node_assert7.default)(spush);
21570
- if (index >= 0 && index < block.bytecodes.length) {
21595
+ if (index >= 0 && index < block.bytecodes.length && bcs.has(block.bytecodes[index])) {
21571
21596
  index--;
21572
21597
  }
21573
21598
  block.bytecodes.splice(
@@ -29455,6 +29480,7 @@ async function generateOptimizedProject(options) {
29455
29480
  if (configsToBuild > 1) {
29456
29481
  poolStarted = startPool();
29457
29482
  }
29483
+ let hasPersonality = false;
29458
29484
  const promises = Object.keys(buildConfigs).sort().map((key) => {
29459
29485
  const buildConfig = buildConfigs[key];
29460
29486
  const outputPath = path4.join(config.outputPath, key);
@@ -29483,6 +29509,9 @@ async function generateOptimizedProject(options) {
29483
29509
  if (t.diagnostics) {
29484
29510
  diagnostics = { ...diagnostics, ...t.diagnostics };
29485
29511
  }
29512
+ if (t.sdkVersion != null && t.sdkVersion >= 4002001) {
29513
+ hasPersonality = true;
29514
+ }
29486
29515
  }) : fs6.rm(path4.resolve(workspace, outputPath), {
29487
29516
  recursive: true,
29488
29517
  force: true
@@ -29618,8 +29647,11 @@ async function generateOptimizedProject(options) {
29618
29647
  });
29619
29648
  }
29620
29649
  });
29621
- promises.push(fs6.writeFile(jungleFiles, parts.join("\n")));
29622
29650
  await Promise.all(promises);
29651
+ await fs6.writeFile(
29652
+ jungleFiles,
29653
+ (hasPersonality ? parts : parts.filter((part) => !/\.personality = /.test(part))).join("\n")
29654
+ );
29623
29655
  } finally {
29624
29656
  if (poolStarted) {
29625
29657
  stopPool();
@@ -29755,6 +29787,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29755
29787
  const {
29756
29788
  hasTests,
29757
29789
  diagnostics: prevDiagnostics,
29790
+ sdkVersion: prevSdkVersion,
29758
29791
  ...prevOptions
29759
29792
  } = JSON.parse(
29760
29793
  await fs6.readFile(path4.join(output, "build-info.json"), "utf-8").catch(() => "{}")
@@ -29769,8 +29802,12 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29769
29802
  const opt_time = await (0, import_chunk_PVBIKZYZ.first_modified)(
29770
29803
  Object.values(fnMap).map((v) => v.output)
29771
29804
  );
29772
- if (source_time < opt_time && 1682889148128 < opt_time) {
29773
- return { hasTests, diagnostics: prevDiagnostics };
29805
+ if (source_time < opt_time && 1684251991147 < opt_time) {
29806
+ return {
29807
+ hasTests,
29808
+ diagnostics: prevDiagnostics,
29809
+ sdkVersion: prevSdkVersion
29810
+ };
29774
29811
  }
29775
29812
  }
29776
29813
  const [, , prettierConfig] = await Promise.all([
@@ -29782,7 +29819,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29782
29819
  })
29783
29820
  ]);
29784
29821
  return optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config).then(
29785
- (diagnostics) => {
29822
+ ({ diagnostics, sdkVersion }) => {
29786
29823
  const options = { ...prettierConfig, ...config.prettier || {} };
29787
29824
  return Promise.all(
29788
29825
  mcFiles.map(async (info) => {
@@ -29801,12 +29838,13 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29801
29838
  JSON.stringify({
29802
29839
  hasTests: hasTests2,
29803
29840
  diagnostics,
29804
- optimizerVersion: "1.1.27",
29841
+ sdkVersion,
29842
+ optimizerVersion: "1.1.28",
29805
29843
  ...Object.fromEntries(
29806
29844
  configOptionsToCheck.map((option) => [option, config[option]])
29807
29845
  )
29808
29846
  })
29809
- ).then(() => ({ hasTests: hasTests2, diagnostics }));
29847
+ ).then(() => ({ hasTests: hasTests2, diagnostics, sdkVersion }));
29810
29848
  });
29811
29849
  }
29812
29850
  );
@@ -18,29 +18,29 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var optimizer_exports = {};
20
20
  __export(optimizer_exports, {
21
- StateNodeAttributes: () => import_chunk_DD4VX53Y.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_DD4VX53Y.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_ZI7CGRJC.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_ZI7CGRJC.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_PVBIKZYZ.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_DD4VX53Y.defaultConfig,
25
- display: () => import_chunk_DD4VX53Y.display,
26
- generateApiMirTests: () => import_chunk_DD4VX53Y.generateApiMirTests,
27
- generateOneConfig: () => import_chunk_DD4VX53Y.generateOneConfig,
28
- generateOptimizedProject: () => import_chunk_DD4VX53Y.generateOptimizedProject,
29
- getConfig: () => import_chunk_DD4VX53Y.getConfig,
30
- getProjectAnalysis: () => import_chunk_DD4VX53Y.getProjectAnalysis,
31
- get_jungle: () => import_chunk_DD4VX53Y.get_jungle,
32
- isErrorWithLocation: () => import_chunk_DD4VX53Y.isErrorWithLocation,
33
- launchSimulator: () => import_chunk_DD4VX53Y.launchSimulator,
34
- manifestProducts: () => import_chunk_DD4VX53Y.manifestProducts,
35
- mctree: () => import_chunk_DD4VX53Y.mctree,
36
- simulateProgram: () => import_chunk_DD4VX53Y.simulateProgram
24
+ defaultConfig: () => import_chunk_ZI7CGRJC.defaultConfig,
25
+ display: () => import_chunk_ZI7CGRJC.display,
26
+ generateApiMirTests: () => import_chunk_ZI7CGRJC.generateApiMirTests,
27
+ generateOneConfig: () => import_chunk_ZI7CGRJC.generateOneConfig,
28
+ generateOptimizedProject: () => import_chunk_ZI7CGRJC.generateOptimizedProject,
29
+ getConfig: () => import_chunk_ZI7CGRJC.getConfig,
30
+ getProjectAnalysis: () => import_chunk_ZI7CGRJC.getProjectAnalysis,
31
+ get_jungle: () => import_chunk_ZI7CGRJC.get_jungle,
32
+ isErrorWithLocation: () => import_chunk_ZI7CGRJC.isErrorWithLocation,
33
+ launchSimulator: () => import_chunk_ZI7CGRJC.launchSimulator,
34
+ manifestProducts: () => import_chunk_ZI7CGRJC.manifestProducts,
35
+ mctree: () => import_chunk_ZI7CGRJC.mctree,
36
+ simulateProgram: () => import_chunk_ZI7CGRJC.simulateProgram
37
37
  });
38
38
  module.exports = __toCommonJS(optimizer_exports);
39
- var import_chunk_DD4VX53Y = require("./chunk-DD4VX53Y.cjs");
39
+ var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
40
40
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
41
41
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
42
42
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
43
- (0, import_chunk_DD4VX53Y.init_optimizer)();
43
+ (0, import_chunk_ZI7CGRJC.init_optimizer)();
44
44
  // Annotate the CommonJS export names for ESM import in node:
45
45
  0 && (module.exports = {
46
46
  StateNodeAttributes,
@@ -18,25 +18,25 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var sdk_util_exports = {};
20
20
  __export(sdk_util_exports, {
21
- SectionKinds: () => import_chunk_DD4VX53Y.SectionKinds,
22
- appSupport: () => import_chunk_DD4VX53Y.appSupport,
23
- connectiq: () => import_chunk_DD4VX53Y.connectiq,
24
- getDeviceInfo: () => import_chunk_DD4VX53Y.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_DD4VX53Y.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_DD4VX53Y.getLanguages,
27
- getSdkPath: () => import_chunk_DD4VX53Y.getSdkPath,
28
- isWin: () => import_chunk_DD4VX53Y.isWin,
29
- optimizeProgram: () => import_chunk_DD4VX53Y.optimizeProgram,
30
- readPrg: () => import_chunk_DD4VX53Y.readPrg,
31
- readPrgWithOffsets: () => import_chunk_DD4VX53Y.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_DD4VX53Y.xml_util_exports
21
+ SectionKinds: () => import_chunk_ZI7CGRJC.SectionKinds,
22
+ appSupport: () => import_chunk_ZI7CGRJC.appSupport,
23
+ connectiq: () => import_chunk_ZI7CGRJC.connectiq,
24
+ getDeviceInfo: () => import_chunk_ZI7CGRJC.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_ZI7CGRJC.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_ZI7CGRJC.getLanguages,
27
+ getSdkPath: () => import_chunk_ZI7CGRJC.getSdkPath,
28
+ isWin: () => import_chunk_ZI7CGRJC.isWin,
29
+ optimizeProgram: () => import_chunk_ZI7CGRJC.optimizeProgram,
30
+ readPrg: () => import_chunk_ZI7CGRJC.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_ZI7CGRJC.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_ZI7CGRJC.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_DD4VX53Y = require("./chunk-DD4VX53Y.cjs");
35
+ var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
36
36
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
37
37
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
38
38
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
39
- (0, import_chunk_DD4VX53Y.init_sdk_util)();
39
+ (0, import_chunk_ZI7CGRJC.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -7,4 +7,7 @@ export declare function getFileASTs(fnMap: FilesToOptimizeMap): Promise<boolean>
7
7
  export declare function analyze(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document | undefined, config: BuildConfig): Promise<ProgramStateAnalysis>;
8
8
  export declare function reportMissingSymbols(state: ProgramStateAnalysis, config?: BuildConfig): void;
9
9
  export declare function getLiteralFromDecls(lookupDefns: LookupDefinition[]): mctree.Literal | mctree.AsExpression | null;
10
- export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document, config: BuildConfig): Promise<Record<string, import("./optimizer-types").Diagnostic[]> | undefined>;
10
+ export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document, config: BuildConfig): Promise<{
11
+ diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
12
+ sdkVersion: number | undefined;
13
+ }>;
@@ -89,6 +89,7 @@ export type Analysis = {
89
89
  export declare function generateOneConfig(buildConfig: JungleQualifier, manifestXML: xmlUtil.Document, dependencyFiles: string[], config: BuildConfig): Promise<{
90
90
  hasTests: boolean;
91
91
  diagnostics: ProgramState["diagnostics"];
92
+ sdkVersion: number | undefined;
92
93
  }>;
93
94
  export declare function getProjectAnalysis(targets: Target[], analysis: PreAnalysis | null, manifestXML: xmlUtil.Document, options: BuildConfig): Promise<Analysis | PreAnalysis>;
94
95
  /**
@@ -13,7 +13,7 @@ export type RemoteProject = string | {
13
13
  sourcePath?: string;
14
14
  jungleContent?: string[];
15
15
  garminOptLevel?: number;
16
- test?: boolean;
16
+ test?: boolean | string[];
17
17
  };
18
18
  export declare const githubProjects: RemoteProject[];
19
19
  export declare function fetchGitProjects(projects: RemoteProject[], testOnly: boolean, skipRemote: boolean): Promise<(string | {
@@ -21,4 +21,5 @@ export declare function fetchGitProjects(projects: RemoteProject[], testOnly: bo
21
21
  build: boolean | null;
22
22
  options: BuildConfig | null;
23
23
  garminOptLevel: number | null;
24
+ products: string[] | null;
24
25
  })[]>;
@@ -70,6 +70,7 @@ export declare const workerTaskHandlers: {
70
70
  readonly generateOneConfig: (data: GenerateOneConfig["data"]) => Promise<{
71
71
  hasTests: boolean;
72
72
  diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
73
+ sdkVersion: number | undefined;
73
74
  }>;
74
75
  readonly optimizePrgAndDebug: (data: OptimizePrgAndDebug["data"]) => Promise<{
75
76
  sigBuffer: ArrayBufferLike | undefined;
@@ -21,17 +21,17 @@ __export(worker_thread_exports, {
21
21
  default: () => worker_thread_default
22
22
  });
23
23
  module.exports = __toCommonJS(worker_thread_exports);
24
- var import_chunk_DD4VX53Y = require("./chunk-DD4VX53Y.cjs");
24
+ var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
25
25
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
26
26
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
27
27
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
28
28
  var import_node_worker_threads = require("node:worker_threads");
29
29
  var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
30
30
  "src/worker-thread.ts"() {
31
- (0, import_chunk_DD4VX53Y.init_worker_task)();
31
+ (0, import_chunk_ZI7CGRJC.init_worker_task)();
32
32
  if (import_node_worker_threads.parentPort) {
33
33
  import_node_worker_threads.parentPort.on("message", async (task) => {
34
- return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_DD4VX53Y.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_ZI7CGRJC.performTask)(task));
35
35
  });
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "commonjs",
4
- "version": "1.1.27",
4
+ "version": "1.1.28",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "types": "build/src/optimizer.d.ts",