@markw65/monkeyc-optimizer 1.1.65 → 1.1.66

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
4
4
 
5
5
  ### 1.1.65
6
6
 
7
+ - Match Garmin's handling of add and addAll for tuples (fixes #38)
8
+ - Add preSkipLiterals option (workaround for part of #38)
9
+ - Remove casts when an enum is replaced by a typedef (Fixes #44)
10
+
11
+ ### 1.1.65
12
+
7
13
  - Fix lookup scopes for tuples and object literals (fixes #39)
8
14
  - Fix a race creating the output directory
9
15
  - Don't put system personality files in barrel namespace (partial fix for #40)
package/build/api.cjs CHANGED
@@ -18,47 +18,47 @@ 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_MDTDXRQB.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_MDTDXRQB.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_MDTDXRQB.createDocumentationMap,
24
- diagnostic: () => import_chunk_MDTDXRQB.diagnostic,
25
- diagnosticHelper: () => import_chunk_MDTDXRQB.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_MDTDXRQB.findNamesInScope,
27
- findUsingForNode: () => import_chunk_MDTDXRQB.findUsingForNode,
28
- formatAst: () => import_chunk_MDTDXRQB.formatAst,
29
- formatAstLongLines: () => import_chunk_MDTDXRQB.formatAstLongLines,
30
- formatScopedName: () => import_chunk_MDTDXRQB.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_MDTDXRQB.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_MDTDXRQB.getApiMapping,
33
- getSuperClasses: () => import_chunk_MDTDXRQB.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_UDJNFXSX.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_UDJNFXSX.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_UDJNFXSX.createDocumentationMap,
24
+ diagnostic: () => import_chunk_UDJNFXSX.diagnostic,
25
+ diagnosticHelper: () => import_chunk_UDJNFXSX.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_UDJNFXSX.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_UDJNFXSX.findUsingForNode,
28
+ formatAst: () => import_chunk_UDJNFXSX.formatAst,
29
+ formatAstLongLines: () => import_chunk_UDJNFXSX.formatAstLongLines,
30
+ formatScopedName: () => import_chunk_UDJNFXSX.formatScopedName,
31
+ getApiFunctionInfo: () => import_chunk_UDJNFXSX.getApiFunctionInfo,
32
+ getApiMapping: () => import_chunk_UDJNFXSX.getApiMapping,
33
+ getSuperClasses: () => import_chunk_UDJNFXSX.getSuperClasses,
34
34
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
35
- isClassVariable: () => import_chunk_MDTDXRQB.isClassVariable,
36
- isLocal: () => import_chunk_MDTDXRQB.isLocal,
37
- isLookupCandidate: () => import_chunk_MDTDXRQB.isLookupCandidate,
38
- isStateNode: () => import_chunk_MDTDXRQB.isStateNode,
39
- lookupByFullName: () => import_chunk_MDTDXRQB.lookupByFullName,
40
- lookupNext: () => import_chunk_MDTDXRQB.lookupNext,
41
- lookupResultContains: () => import_chunk_MDTDXRQB.lookupResultContains,
42
- lookupWithType: () => import_chunk_MDTDXRQB.lookupWithType,
43
- makeToyboxLink: () => import_chunk_MDTDXRQB.makeToyboxLink,
44
- mapVarDeclsByType: () => import_chunk_MDTDXRQB.mapVarDeclsByType,
45
- markInvokeClassMethod: () => import_chunk_MDTDXRQB.markInvokeClassMethod,
46
- parseSdkVersion: () => import_chunk_MDTDXRQB.parseSdkVersion,
47
- resolveDiagnostics: () => import_chunk_MDTDXRQB.resolveDiagnostics,
48
- resolveDiagnosticsMap: () => import_chunk_MDTDXRQB.resolveDiagnosticsMap,
49
- sameLookupResult: () => import_chunk_MDTDXRQB.sameLookupResult,
35
+ isClassVariable: () => import_chunk_UDJNFXSX.isClassVariable,
36
+ isLocal: () => import_chunk_UDJNFXSX.isLocal,
37
+ isLookupCandidate: () => import_chunk_UDJNFXSX.isLookupCandidate,
38
+ isStateNode: () => import_chunk_UDJNFXSX.isStateNode,
39
+ lookupByFullName: () => import_chunk_UDJNFXSX.lookupByFullName,
40
+ lookupNext: () => import_chunk_UDJNFXSX.lookupNext,
41
+ lookupResultContains: () => import_chunk_UDJNFXSX.lookupResultContains,
42
+ lookupWithType: () => import_chunk_UDJNFXSX.lookupWithType,
43
+ makeToyboxLink: () => import_chunk_UDJNFXSX.makeToyboxLink,
44
+ mapVarDeclsByType: () => import_chunk_UDJNFXSX.mapVarDeclsByType,
45
+ markInvokeClassMethod: () => import_chunk_UDJNFXSX.markInvokeClassMethod,
46
+ parseSdkVersion: () => import_chunk_UDJNFXSX.parseSdkVersion,
47
+ resolveDiagnostics: () => import_chunk_UDJNFXSX.resolveDiagnostics,
48
+ resolveDiagnosticsMap: () => import_chunk_UDJNFXSX.resolveDiagnosticsMap,
49
+ sameLookupResult: () => import_chunk_UDJNFXSX.sameLookupResult,
50
50
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
51
- variableDeclarationName: () => import_chunk_MDTDXRQB.variableDeclarationName,
52
- visitReferences: () => import_chunk_MDTDXRQB.visitReferences,
53
- visit_resources: () => import_chunk_MDTDXRQB.visit_resources,
54
- visitorNode: () => import_chunk_MDTDXRQB.visitorNode
51
+ variableDeclarationName: () => import_chunk_UDJNFXSX.variableDeclarationName,
52
+ visitReferences: () => import_chunk_UDJNFXSX.visitReferences,
53
+ visit_resources: () => import_chunk_UDJNFXSX.visit_resources,
54
+ visitorNode: () => import_chunk_UDJNFXSX.visitorNode
55
55
  });
56
56
  module.exports = __toCommonJS(api_exports);
57
- var import_chunk_MDTDXRQB = require("./chunk-MDTDXRQB.cjs");
57
+ var import_chunk_UDJNFXSX = require("./chunk-UDJNFXSX.cjs");
58
58
  var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.cjs");
59
59
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
60
60
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
61
- (0, import_chunk_MDTDXRQB.init_api)();
61
+ (0, import_chunk_UDJNFXSX.init_api)();
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  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_MDTDXRQB_exports = {};
30
- __export(chunk_MDTDXRQB_exports, {
29
+ var chunk_UDJNFXSX_exports = {};
30
+ __export(chunk_UDJNFXSX_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -134,7 +134,7 @@ __export(chunk_MDTDXRQB_exports, {
134
134
  visitorNode: () => visitorNode,
135
135
  xml_util_exports: () => xml_util_exports
136
136
  });
137
- module.exports = __toCommonJS(chunk_MDTDXRQB_exports);
137
+ module.exports = __toCommonJS(chunk_UDJNFXSX_exports);
138
138
  var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.cjs");
139
139
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
140
140
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -5643,49 +5643,56 @@ var init_build_config = (0, import_chunk_ABYVSU2C.__esm)({
5643
5643
  scope: "resource"
5644
5644
  },
5645
5645
  trustDeclaredTypes: {
5646
- order: 10,
5646
+ order: 100,
5647
5647
  type: "boolean",
5648
5648
  markdownDescription: "[Whether to rely on type declarations when optimizing](https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis#trust-declared-types)",
5649
5649
  default: true,
5650
5650
  scope: "resource"
5651
5651
  },
5652
5652
  propagateTypes: {
5653
- order: 11,
5653
+ order: 110,
5654
5654
  type: "boolean",
5655
5655
  markdownDescription: "[Whether to propagate type information, or process it locally](https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis#propagate-types)",
5656
5656
  default: true,
5657
5657
  scope: "resource"
5658
5658
  },
5659
5659
  sizeBasedPRE: {
5660
- order: 11,
5660
+ order: 111,
5661
5661
  type: "boolean",
5662
5662
  markdownDescription: "[Whether to enable the size based partial redundancy pass](https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis#size-based-pre)",
5663
5663
  default: true,
5664
5664
  scope: "resource"
5665
5665
  },
5666
+ preSkipLiterals: {
5667
+ order: 112,
5668
+ type: "boolean",
5669
+ markdownDescription: "[Whether to skip the size based partial redundancy pass for literal values](https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis#size-based-pre-skip-literals)",
5670
+ default: false,
5671
+ scope: "resource"
5672
+ },
5666
5673
  minimizeLocals: {
5667
- order: 12,
5674
+ order: 120,
5668
5675
  type: "boolean",
5669
5676
  markdownDescription: "[Whether to enable the minimize locals pass](https://github.com/markw65/monkeyc-optimizer/wiki/Local-variable-elimination#minimize-locals)",
5670
5677
  default: true,
5671
5678
  scope: "resource"
5672
5679
  },
5673
5680
  singleUseCopyProp: {
5674
- order: 12,
5681
+ order: 120,
5675
5682
  type: "boolean",
5676
5683
  markdownDescription: "[Whether to enable the single use copy propagation pass](https://github.com/markw65/monkeyc-optimizer/wiki/Local-variable-elimination#single-use-copy-propagation)",
5677
5684
  default: true,
5678
5685
  scope: "resource"
5679
5686
  },
5680
5687
  minimizeModules: {
5681
- order: 12,
5688
+ order: 120,
5682
5689
  type: "boolean",
5683
5690
  markdownDescription: "[Whether to enable the minimize modules pass](https://github.com/markw65/monkeyc-optimizer/wiki/Optimizing-module-imports#minimize-modules)",
5684
5691
  default: true,
5685
5692
  scope: "resource"
5686
5693
  },
5687
5694
  iterateOptimizer: {
5688
- order: 12,
5695
+ order: 120,
5689
5696
  type: "boolean",
5690
5697
  description: "Whether to keep running the optimizer pass until it makes no further changes (may be slow)",
5691
5698
  default: false,
@@ -9606,8 +9613,16 @@ function getSystemCallTable(state) {
9606
9613
  512
9607
9614
  /* Array */
9608
9615
  );
9609
- if (argSubtypes && Array.isArray(argSubtypes)) {
9610
- const newAData = [...adata, ...argSubtypes];
9616
+ if (argSubtypes) {
9617
+ if (Array.isArray(argSubtypes)) {
9618
+ const newAData2 = [...adata, ...argSubtypes];
9619
+ ret.returnType.value = newAData2;
9620
+ ret.argTypes = [arg];
9621
+ ret.calleeObj = ret.returnType;
9622
+ return ret;
9623
+ }
9624
+ const newAData = reducedType(adata);
9625
+ unionInto(newAData, argSubtypes);
9611
9626
  ret.returnType.value = newAData;
9612
9627
  ret.argTypes = [arg];
9613
9628
  ret.calleeObj = ret.returnType;
@@ -14973,7 +14988,7 @@ function buildPREGraph(state, func) {
14973
14988
  const result = buildDataFlowGraph(
14974
14989
  state,
14975
14990
  func,
14976
- (literal) => refCost(literal) > LocalRefCost,
14991
+ (literal) => !state.config?.preSkipLiterals && refCost(literal) > LocalRefCost,
14977
14992
  true,
14978
14993
  false
14979
14994
  );
@@ -17362,26 +17377,49 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
17362
17377
  Object.values(fnMap).forEach((f) => {
17363
17378
  collectNamespaces(f.ast, state);
17364
17379
  });
17380
+ let Changes;
17381
+ ((Changes2) => {
17382
+ Changes2[Changes2["None"] = 0] = "None";
17383
+ Changes2[Changes2["Some"] = 1] = "Some";
17384
+ Changes2[Changes2["Force"] = 2] = "Force";
17385
+ })(Changes || (Changes = {}));
17365
17386
  const cleanupAll = () => {
17366
17387
  const usedDecls = findRezRefs(state);
17367
- return Object.values(fnMap).reduce((changes, f) => {
17368
- (0, import_chunk_MBTLUWXR.traverseAst)(f.ast, void 0, (node) => {
17369
- if (usedDecls.has(node)) {
17370
- return null;
17371
- }
17372
- const ret = cleanup(state, node, f.ast, usedDecls);
17373
- if (ret === false) {
17374
- changes = true;
17375
- state.removeNodeComments(node, f.ast);
17376
- } else if (ret) {
17377
- changes = true;
17378
- }
17379
- return ret;
17380
- });
17381
- return changes;
17382
- }, false);
17388
+ const pre = state.pre;
17389
+ const post = state.post;
17390
+ try {
17391
+ delete state.pre;
17392
+ return Object.values(fnMap).reduce(
17393
+ (changes, f) => {
17394
+ state.post = (node) => {
17395
+ if (usedDecls.has(node)) {
17396
+ return null;
17397
+ }
17398
+ const ret = cleanup(state, node, f.ast, usedDecls);
17399
+ if (ret === false) {
17400
+ changes |= 1;
17401
+ state.removeNodeComments(node, f.ast);
17402
+ } else if (ret) {
17403
+ if (node.type === "EnumDeclaration" && ret.type === "TypedefDeclaration" && ret.ts.argument.ts.length > 1) {
17404
+ changes |= 2;
17405
+ } else {
17406
+ changes |= 1;
17407
+ }
17408
+ }
17409
+ return ret;
17410
+ };
17411
+ collectNamespaces(f.ast, state);
17412
+ return changes;
17413
+ },
17414
+ 0
17415
+ /* None */
17416
+ );
17417
+ } finally {
17418
+ state.pre = pre;
17419
+ state.post = post;
17420
+ }
17383
17421
  };
17384
- do {
17422
+ while (true) {
17385
17423
  state.usedByName = {};
17386
17424
  state.calledFunctions = {};
17387
17425
  state.exposed = state.nextExposed;
@@ -17391,9 +17429,12 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
17391
17429
  });
17392
17430
  state.exposed = state.nextExposed;
17393
17431
  state.nextExposed = {};
17394
- if (!cleanupAll())
17395
- break;
17396
- } while (state.config?.iterateOptimizer);
17432
+ const changes = cleanupAll();
17433
+ if (changes & 2 || changes & 1 && state.config?.iterateOptimizer) {
17434
+ continue;
17435
+ }
17436
+ break;
17437
+ }
17397
17438
  delete state.pre;
17398
17439
  delete state.post;
17399
17440
  if (state.config?.minimizeModules ?? true) {
@@ -17514,56 +17555,64 @@ function cleanup(state, node, ast, usedNodes) {
17514
17555
  case "ThisExpression":
17515
17556
  node.text = "self";
17516
17557
  break;
17517
- case "EnumStringBody":
17518
- if (node.members.every((m) => {
17558
+ case "EnumDeclaration": {
17559
+ if (!node.body.members.every((m) => {
17519
17560
  if (usedNodes.has(m))
17520
17561
  return false;
17521
17562
  const name = "name" in m ? m.name : m.id.name;
17522
17563
  return (0, import_chunk_MBTLUWXR.hasProperty)(state.index, name) && !(0, import_chunk_MBTLUWXR.hasProperty)(state.exposed, name) && !(0, import_chunk_MBTLUWXR.hasProperty)(state.usedByName, name);
17523
17564
  })) {
17524
- const enumType = new Set(
17525
- node.members.map((m) => {
17526
- if (!("init" in m))
17527
- return "Number";
17528
- const [node2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(m.init);
17529
- return node2 ? type : null;
17530
- })
17531
- );
17532
- if (!enumType.has(null)) {
17533
- node.enumType = [...enumType].map((t) => t === "Null" ? t : `Toybox.Lang.${t}`).join(" or ");
17534
- node.members.splice(0);
17535
- }
17565
+ break;
17536
17566
  }
17537
- break;
17538
- case "EnumDeclaration":
17539
- if (!node.body.members.length) {
17540
- if (!node.id)
17541
- return false;
17542
- if (!node.body.enumType) {
17543
- throw new Error("Missing enumType on optimized enum");
17544
- }
17545
- state.removeNodeComments(node, ast);
17546
- return (0, import_chunk_MBTLUWXR.withLocDeep)(
17547
- {
17548
- type: "TypedefDeclaration",
17549
- id: node.id,
17550
- ts: {
17551
- type: "UnaryExpression",
17552
- argument: {
17553
- type: "TypeSpecList",
17554
- ts: [
17555
- node.body.enumType
17556
- ]
17557
- },
17558
- prefix: true,
17559
- operator: " as"
17560
- }
17561
- },
17562
- node,
17563
- node
17567
+ const enumType = new Set(
17568
+ node.body.members.map((m) => {
17569
+ if (!("init" in m))
17570
+ return "Number";
17571
+ const [node2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(m.init);
17572
+ return node2 ? type : null;
17573
+ })
17574
+ );
17575
+ if (enumType.has(null))
17576
+ break;
17577
+ if (!node.id)
17578
+ return false;
17579
+ state.removeNodeComments(node, ast);
17580
+ const typedefDecl = (0, import_chunk_MBTLUWXR.withLocDeep)(
17581
+ {
17582
+ type: "TypedefDeclaration",
17583
+ id: node.id,
17584
+ ts: {
17585
+ type: "UnaryExpression",
17586
+ argument: {
17587
+ type: "TypeSpecList",
17588
+ ts: Array.from(enumType).map((t) => ({
17589
+ type: "TypeSpecPart",
17590
+ name: t === "Null" ? t : (0, import_chunk_MBTLUWXR.makeScopedName)(`Toybox.Lang.${t}`)
17591
+ }))
17592
+ },
17593
+ prefix: true,
17594
+ operator: " as"
17595
+ }
17596
+ },
17597
+ node,
17598
+ node
17599
+ );
17600
+ const decls = state.stack[state.stack.length - 1].sn?.type_decls?.[node.id.name];
17601
+ if (decls) {
17602
+ const i = decls.findIndex(
17603
+ (d) => d.type === "EnumDeclaration" && d.node === node
17564
17604
  );
17605
+ if (i >= 0) {
17606
+ const old = decls[i];
17607
+ decls.splice(i, 1, {
17608
+ ...old,
17609
+ type: "TypedefDeclaration",
17610
+ node: typedefDecl
17611
+ });
17612
+ }
17565
17613
  }
17566
- break;
17614
+ return typedefDecl;
17615
+ }
17567
17616
  case "VariableDeclarator": {
17568
17617
  const name = variableDeclarationName(node.id);
17569
17618
  return !(0, import_chunk_MBTLUWXR.hasProperty)(state.index, name) || (0, import_chunk_MBTLUWXR.hasProperty)(state.exposed, name) || (0, import_chunk_MBTLUWXR.hasProperty)(state.usedByName, name) ? null : false;
@@ -29536,7 +29585,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29536
29585
  const opt_time = await (0, import_chunk_67LU4GPQ.first_modified)(
29537
29586
  Object.values(fnMap).map((v) => v.output)
29538
29587
  );
29539
- if (source_time < opt_time && 1719447701318 < opt_time) {
29588
+ if (source_time < opt_time && 1719699536477 < opt_time) {
29540
29589
  return {
29541
29590
  hasTests,
29542
29591
  diagnostics: prevDiagnostics,
@@ -29575,7 +29624,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29575
29624
  hasTests: hasTests2,
29576
29625
  diagnostics,
29577
29626
  sdkVersion,
29578
- optimizerVersion: "1.1.65",
29627
+ optimizerVersion: "1.1.66",
29579
29628
  ...Object.fromEntries(
29580
29629
  configOptionsToCheck.map((option) => [option, config[option]])
29581
29630
  )
@@ -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_MDTDXRQB.StateNodeAttributes,
22
- buildConfigDescription: () => import_chunk_MDTDXRQB.buildConfigDescription,
23
- buildOptimizedProject: () => import_chunk_MDTDXRQB.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_UDJNFXSX.StateNodeAttributes,
22
+ buildConfigDescription: () => import_chunk_UDJNFXSX.buildConfigDescription,
23
+ buildOptimizedProject: () => import_chunk_UDJNFXSX.buildOptimizedProject,
24
24
  copyRecursiveAsNeeded: () => import_chunk_67LU4GPQ.copyRecursiveAsNeeded,
25
- defaultConfig: () => import_chunk_MDTDXRQB.defaultConfig,
26
- display: () => import_chunk_MDTDXRQB.display,
27
- generateOneConfig: () => import_chunk_MDTDXRQB.generateOneConfig,
28
- generateOptimizedProject: () => import_chunk_MDTDXRQB.generateOptimizedProject,
29
- getConfig: () => import_chunk_MDTDXRQB.getConfig,
30
- getProjectAnalysis: () => import_chunk_MDTDXRQB.getProjectAnalysis,
31
- get_jungle: () => import_chunk_MDTDXRQB.get_jungle,
32
- isErrorWithLocation: () => import_chunk_MDTDXRQB.isErrorWithLocation,
33
- launchSimulator: () => import_chunk_MDTDXRQB.launchSimulator,
34
- manifestProducts: () => import_chunk_MDTDXRQB.manifestProducts,
35
- mctree: () => import_chunk_MDTDXRQB.mctree,
36
- simulateProgram: () => import_chunk_MDTDXRQB.simulateProgram
25
+ defaultConfig: () => import_chunk_UDJNFXSX.defaultConfig,
26
+ display: () => import_chunk_UDJNFXSX.display,
27
+ generateOneConfig: () => import_chunk_UDJNFXSX.generateOneConfig,
28
+ generateOptimizedProject: () => import_chunk_UDJNFXSX.generateOptimizedProject,
29
+ getConfig: () => import_chunk_UDJNFXSX.getConfig,
30
+ getProjectAnalysis: () => import_chunk_UDJNFXSX.getProjectAnalysis,
31
+ get_jungle: () => import_chunk_UDJNFXSX.get_jungle,
32
+ isErrorWithLocation: () => import_chunk_UDJNFXSX.isErrorWithLocation,
33
+ launchSimulator: () => import_chunk_UDJNFXSX.launchSimulator,
34
+ manifestProducts: () => import_chunk_UDJNFXSX.manifestProducts,
35
+ mctree: () => import_chunk_UDJNFXSX.mctree,
36
+ simulateProgram: () => import_chunk_UDJNFXSX.simulateProgram
37
37
  });
38
38
  module.exports = __toCommonJS(optimizer_exports);
39
- var import_chunk_MDTDXRQB = require("./chunk-MDTDXRQB.cjs");
39
+ var import_chunk_UDJNFXSX = require("./chunk-UDJNFXSX.cjs");
40
40
  var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.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_MDTDXRQB.init_optimizer)();
43
+ (0, import_chunk_UDJNFXSX.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_MDTDXRQB.SectionKinds,
22
- appSupport: () => import_chunk_MDTDXRQB.appSupport,
23
- connectiq: () => import_chunk_MDTDXRQB.connectiq,
24
- getDeviceInfo: () => import_chunk_MDTDXRQB.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_MDTDXRQB.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_MDTDXRQB.getLanguages,
27
- getSdkPath: () => import_chunk_MDTDXRQB.getSdkPath,
28
- isWin: () => import_chunk_MDTDXRQB.isWin,
29
- optimizeProgram: () => import_chunk_MDTDXRQB.optimizeProgram,
30
- readPrg: () => import_chunk_MDTDXRQB.readPrg,
31
- readPrgWithOffsets: () => import_chunk_MDTDXRQB.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_MDTDXRQB.xml_util_exports
21
+ SectionKinds: () => import_chunk_UDJNFXSX.SectionKinds,
22
+ appSupport: () => import_chunk_UDJNFXSX.appSupport,
23
+ connectiq: () => import_chunk_UDJNFXSX.connectiq,
24
+ getDeviceInfo: () => import_chunk_UDJNFXSX.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_UDJNFXSX.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_UDJNFXSX.getLanguages,
27
+ getSdkPath: () => import_chunk_UDJNFXSX.getSdkPath,
28
+ isWin: () => import_chunk_UDJNFXSX.isWin,
29
+ optimizeProgram: () => import_chunk_UDJNFXSX.optimizeProgram,
30
+ readPrg: () => import_chunk_UDJNFXSX.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_UDJNFXSX.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_UDJNFXSX.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_MDTDXRQB = require("./chunk-MDTDXRQB.cjs");
35
+ var import_chunk_UDJNFXSX = require("./chunk-UDJNFXSX.cjs");
36
36
  var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.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_MDTDXRQB.init_sdk_util)();
39
+ (0, import_chunk_UDJNFXSX.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -30,6 +30,7 @@ export type BuildConfig = {
30
30
  compilerLookupRules?: LookupRules;
31
31
  enforceStatic?: EnforceStatic;
32
32
  sizeBasedPRE?: boolean | string;
33
+ preSkipLiterals?: boolean;
33
34
  prettier?: Record<string, unknown>;
34
35
  extensionVersion?: string;
35
36
  useLocalOptimizer?: boolean;
@@ -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_MDTDXRQB = require("./chunk-MDTDXRQB.cjs");
24
+ var import_chunk_UDJNFXSX = require("./chunk-UDJNFXSX.cjs");
25
25
  var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.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_MDTDXRQB.init_worker_task)();
31
+ (0, import_chunk_UDJNFXSX.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_MDTDXRQB.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_UDJNFXSX.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.65",
4
+ "version": "1.1.66",
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",
@@ -36,7 +36,7 @@
36
36
  "test-garmin-opt": "node test/test.js --typeCheckLevel Strict --skipOptimization --garminOptLevel=2 --run-tests --product=fenix5 --product=fr235 --jungle ./test/OptimizerTests/monkey.jungle",
37
37
  "test-personality": "node test/test-personality.js",
38
38
  "test-analysis": "node test/test.js --showInfo --typeCheckLevel Strict --product=fr955 --sourceFile 'test/analysis/*.mc'",
39
- "test-tiny": "node test/test.js --postOptimize --showInfo --typeCheckLevel Strict --run-tests --product=pick-one --jungle test/tiny/array-overflow/monkey.jungle",
39
+ "test-tiny": "node test/test-tiny.js",
40
40
  "eslint": "npx eslint ."
41
41
  },
42
42
  "bin": {