@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 +6 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-MDTDXRQB.cjs → chunk-UDJNFXSX.cjs} +126 -77
- package/build/optimizer.cjs +17 -17
- package/build/sdk-util.cjs +14 -14
- package/build/src/build-config.d.ts +1 -0
- package/build/worker-thread.cjs +3 -3
- package/package.json +2 -2
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: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
formatScopedName: () =>
|
|
31
|
-
getApiFunctionInfo: () =>
|
|
32
|
-
getApiMapping: () =>
|
|
33
|
-
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: () =>
|
|
36
|
-
isLocal: () =>
|
|
37
|
-
isLookupCandidate: () =>
|
|
38
|
-
isStateNode: () =>
|
|
39
|
-
lookupByFullName: () =>
|
|
40
|
-
lookupNext: () =>
|
|
41
|
-
lookupResultContains: () =>
|
|
42
|
-
lookupWithType: () =>
|
|
43
|
-
makeToyboxLink: () =>
|
|
44
|
-
mapVarDeclsByType: () =>
|
|
45
|
-
markInvokeClassMethod: () =>
|
|
46
|
-
parseSdkVersion: () =>
|
|
47
|
-
resolveDiagnostics: () =>
|
|
48
|
-
resolveDiagnosticsMap: () =>
|
|
49
|
-
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: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
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
|
|
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,
|
|
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
|
|
30
|
-
__export(
|
|
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(
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
9610
|
-
|
|
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
|
-
|
|
17368
|
-
|
|
17369
|
-
|
|
17370
|
-
|
|
17371
|
-
|
|
17372
|
-
|
|
17373
|
-
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17395
|
-
|
|
17396
|
-
|
|
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 "
|
|
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
|
-
|
|
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
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
|
|
17547
|
-
|
|
17548
|
-
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
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
|
-
|
|
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 &&
|
|
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.
|
|
29627
|
+
optimizerVersion: "1.1.66",
|
|
29579
29628
|
...Object.fromEntries(
|
|
29580
29629
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29581
29630
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -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: () =>
|
|
22
|
-
buildConfigDescription: () =>
|
|
23
|
-
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: () =>
|
|
26
|
-
display: () =>
|
|
27
|
-
generateOneConfig: () =>
|
|
28
|
-
generateOptimizedProject: () =>
|
|
29
|
-
getConfig: () =>
|
|
30
|
-
getProjectAnalysis: () =>
|
|
31
|
-
get_jungle: () =>
|
|
32
|
-
isErrorWithLocation: () =>
|
|
33
|
-
launchSimulator: () =>
|
|
34
|
-
manifestProducts: () =>
|
|
35
|
-
mctree: () =>
|
|
36
|
-
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
|
|
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,
|
|
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,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -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: () =>
|
|
22
|
-
appSupport: () =>
|
|
23
|
-
connectiq: () =>
|
|
24
|
-
getDeviceInfo: () =>
|
|
25
|
-
getFunctionDocumentation: () =>
|
|
26
|
-
getLanguages: () =>
|
|
27
|
-
getSdkPath: () =>
|
|
28
|
-
isWin: () =>
|
|
29
|
-
optimizeProgram: () =>
|
|
30
|
-
readPrg: () =>
|
|
31
|
-
readPrgWithOffsets: () =>
|
|
32
|
-
xmlUtil: () =>
|
|
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
|
|
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,
|
|
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;
|
package/build/worker-thread.cjs
CHANGED
|
@@ -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
|
|
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,
|
|
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,
|
|
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.
|
|
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
|
|
39
|
+
"test-tiny": "node test/test-tiny.js",
|
|
40
40
|
"eslint": "npx eslint ."
|
|
41
41
|
},
|
|
42
42
|
"bin": {
|