@markw65/monkeyc-optimizer 1.1.84 → 1.1.85
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 +7 -0
- package/build/api.cjs +39 -39
- package/build/{chunk-ZWQB5L34.cjs → chunk-OFOOTSQM.cjs} +58 -13
- package/build/optimizer.cjs +18 -18
- package/build/sdk-util.cjs +14 -14
- package/build/src/type-flow/array-type.d.ts +2 -1
- package/build/worker-thread.cjs +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.85
|
|
6
|
+
|
|
7
|
+
- Update to [@markw65/prettier-plugin-monkeyc@1.0.60](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1060)
|
|
8
|
+
- Fixes a crash introduced by stashing ArrayExpression/ObjectExpression types on nodes.
|
|
9
|
+
- Preserve casts on ArrayExpression and ObjectExpression (Fixes #30)
|
|
10
|
+
- Identify more 'obviously safe' reference expressions
|
|
11
|
+
|
|
5
12
|
### 1.1.84
|
|
6
13
|
|
|
7
14
|
- Refactor `extraReferenceTypeChecks` and take account of type constraints (fixes #56)
|
package/build/api.cjs
CHANGED
|
@@ -18,52 +18,52 @@ 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
|
-
clearDiagnostics: () =>
|
|
23
|
-
collectNamespaces: () =>
|
|
24
|
-
createDocumentationMap: () =>
|
|
25
|
-
declKey: () =>
|
|
26
|
-
diagnostic: () =>
|
|
27
|
-
diagnosticHelper: () =>
|
|
28
|
-
findNamesInScope: () =>
|
|
29
|
-
findUsingForNode: () =>
|
|
30
|
-
formatAst: () =>
|
|
31
|
-
formatAstLongLines: () =>
|
|
32
|
-
formatScopedName: () =>
|
|
33
|
-
getApiFunctionInfo: () =>
|
|
34
|
-
getApiMapping: () =>
|
|
35
|
-
getSuperClasses: () =>
|
|
36
|
-
handleImportUsing: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_OFOOTSQM.checkCompilerVersion,
|
|
22
|
+
clearDiagnostics: () => import_chunk_OFOOTSQM.clearDiagnostics,
|
|
23
|
+
collectNamespaces: () => import_chunk_OFOOTSQM.collectNamespaces,
|
|
24
|
+
createDocumentationMap: () => import_chunk_OFOOTSQM.createDocumentationMap,
|
|
25
|
+
declKey: () => import_chunk_OFOOTSQM.declKey,
|
|
26
|
+
diagnostic: () => import_chunk_OFOOTSQM.diagnostic,
|
|
27
|
+
diagnosticHelper: () => import_chunk_OFOOTSQM.diagnosticHelper,
|
|
28
|
+
findNamesInScope: () => import_chunk_OFOOTSQM.findNamesInScope,
|
|
29
|
+
findUsingForNode: () => import_chunk_OFOOTSQM.findUsingForNode,
|
|
30
|
+
formatAst: () => import_chunk_OFOOTSQM.formatAst,
|
|
31
|
+
formatAstLongLines: () => import_chunk_OFOOTSQM.formatAstLongLines,
|
|
32
|
+
formatScopedName: () => import_chunk_OFOOTSQM.formatScopedName,
|
|
33
|
+
getApiFunctionInfo: () => import_chunk_OFOOTSQM.getApiFunctionInfo,
|
|
34
|
+
getApiMapping: () => import_chunk_OFOOTSQM.getApiMapping,
|
|
35
|
+
getSuperClasses: () => import_chunk_OFOOTSQM.getSuperClasses,
|
|
36
|
+
handleImportUsing: () => import_chunk_OFOOTSQM.handleImportUsing,
|
|
37
37
|
hasProperty: () => import_chunk_JDC43A3I.hasProperty,
|
|
38
|
-
isClassVariable: () =>
|
|
39
|
-
isLocal: () =>
|
|
40
|
-
isLookupCandidate: () =>
|
|
41
|
-
isStateNode: () =>
|
|
42
|
-
lookupByFullName: () =>
|
|
43
|
-
lookupNext: () =>
|
|
44
|
-
lookupResultContains: () =>
|
|
45
|
-
lookupWithType: () =>
|
|
46
|
-
makeToyboxLink: () =>
|
|
47
|
-
mapVarDeclsByType: () =>
|
|
48
|
-
markInvokeClassMethod: () =>
|
|
49
|
-
parseSdkVersion: () =>
|
|
50
|
-
popRootNode: () =>
|
|
51
|
-
pushRootNode: () =>
|
|
52
|
-
resolveDiagnostics: () =>
|
|
53
|
-
resolveDiagnosticsMap: () =>
|
|
54
|
-
sameLookupResult: () =>
|
|
38
|
+
isClassVariable: () => import_chunk_OFOOTSQM.isClassVariable,
|
|
39
|
+
isLocal: () => import_chunk_OFOOTSQM.isLocal,
|
|
40
|
+
isLookupCandidate: () => import_chunk_OFOOTSQM.isLookupCandidate,
|
|
41
|
+
isStateNode: () => import_chunk_OFOOTSQM.isStateNode,
|
|
42
|
+
lookupByFullName: () => import_chunk_OFOOTSQM.lookupByFullName,
|
|
43
|
+
lookupNext: () => import_chunk_OFOOTSQM.lookupNext,
|
|
44
|
+
lookupResultContains: () => import_chunk_OFOOTSQM.lookupResultContains,
|
|
45
|
+
lookupWithType: () => import_chunk_OFOOTSQM.lookupWithType,
|
|
46
|
+
makeToyboxLink: () => import_chunk_OFOOTSQM.makeToyboxLink,
|
|
47
|
+
mapVarDeclsByType: () => import_chunk_OFOOTSQM.mapVarDeclsByType,
|
|
48
|
+
markInvokeClassMethod: () => import_chunk_OFOOTSQM.markInvokeClassMethod,
|
|
49
|
+
parseSdkVersion: () => import_chunk_OFOOTSQM.parseSdkVersion,
|
|
50
|
+
popRootNode: () => import_chunk_OFOOTSQM.popRootNode,
|
|
51
|
+
pushRootNode: () => import_chunk_OFOOTSQM.pushRootNode,
|
|
52
|
+
resolveDiagnostics: () => import_chunk_OFOOTSQM.resolveDiagnostics,
|
|
53
|
+
resolveDiagnosticsMap: () => import_chunk_OFOOTSQM.resolveDiagnosticsMap,
|
|
54
|
+
sameLookupResult: () => import_chunk_OFOOTSQM.sameLookupResult,
|
|
55
55
|
traverseAst: () => import_chunk_JDC43A3I.traverseAst,
|
|
56
|
-
variableDeclarationName: () =>
|
|
57
|
-
visitReferences: () =>
|
|
58
|
-
visit_resources: () =>
|
|
59
|
-
visitorNode: () =>
|
|
56
|
+
variableDeclarationName: () => import_chunk_OFOOTSQM.variableDeclarationName,
|
|
57
|
+
visitReferences: () => import_chunk_OFOOTSQM.visitReferences,
|
|
58
|
+
visit_resources: () => import_chunk_OFOOTSQM.visit_resources,
|
|
59
|
+
visitorNode: () => import_chunk_OFOOTSQM.visitorNode
|
|
60
60
|
});
|
|
61
61
|
module.exports = __toCommonJS(api_exports);
|
|
62
|
-
var
|
|
62
|
+
var import_chunk_OFOOTSQM = require("./chunk-OFOOTSQM.cjs");
|
|
63
63
|
var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
|
|
64
64
|
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
|
|
65
65
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
66
|
-
(0,
|
|
66
|
+
(0, import_chunk_OFOOTSQM.init_api)();
|
|
67
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
68
|
0 && (module.exports = {
|
|
69
69
|
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_OFOOTSQM_exports = {};
|
|
30
|
+
__export(chunk_OFOOTSQM_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -140,7 +140,7 @@ __export(chunk_ZWQB5L34_exports, {
|
|
|
140
140
|
visitorNode: () => visitorNode,
|
|
141
141
|
xml_util_exports: () => xml_util_exports
|
|
142
142
|
});
|
|
143
|
-
module.exports = __toCommonJS(
|
|
143
|
+
module.exports = __toCommonJS(chunk_OFOOTSQM_exports);
|
|
144
144
|
var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
|
|
145
145
|
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
|
|
146
146
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
@@ -10102,7 +10102,7 @@ function expandKeys(state, table) {
|
|
|
10102
10102
|
return result;
|
|
10103
10103
|
}
|
|
10104
10104
|
function extraReferenceTypeChecks(istate, report, targetType, sourceType, sourceNode) {
|
|
10105
|
-
if (safeReferenceArg(sourceNode)) {
|
|
10105
|
+
if (targetType.type === 524287 || safeReferenceArg(istate, sourceNode)) {
|
|
10106
10106
|
return;
|
|
10107
10107
|
}
|
|
10108
10108
|
let constrainedType = null;
|
|
@@ -10682,6 +10682,11 @@ function evaluateNode(istate, node) {
|
|
|
10682
10682
|
}
|
|
10683
10683
|
istate.stack.push(item);
|
|
10684
10684
|
};
|
|
10685
|
+
const argType = (arg, i) => {
|
|
10686
|
+
const n = node;
|
|
10687
|
+
const t = n.originalTypes?.[i] || arg.node.type === "BinaryExpression" && arg.node.operator === "as" && arg.node.right;
|
|
10688
|
+
return t ? typeFromTypespec(istate.state, t) : arg.value;
|
|
10689
|
+
};
|
|
10685
10690
|
switch (node.type) {
|
|
10686
10691
|
case "BinaryExpression": {
|
|
10687
10692
|
if (node.operator === "as") {
|
|
@@ -10839,7 +10844,7 @@ function evaluateNode(istate, node) {
|
|
|
10839
10844
|
node
|
|
10840
10845
|
});
|
|
10841
10846
|
} else {
|
|
10842
|
-
const value2 = args.map((arg) => relaxType(arg
|
|
10847
|
+
const value2 = args.map((arg, i) => relaxType(argType(arg, i)));
|
|
10843
10848
|
push({
|
|
10844
10849
|
value: { type: 512, value: value2 },
|
|
10845
10850
|
embeddedEffects,
|
|
@@ -10852,9 +10857,9 @@ function evaluateNode(istate, node) {
|
|
|
10852
10857
|
const args = node.properties.length ? stack.splice(-node.properties.length * 2) : [];
|
|
10853
10858
|
const fields = /* @__PURE__ */ new Map();
|
|
10854
10859
|
for (let i = 0; i < args.length; i += 2) {
|
|
10855
|
-
const key = args[i];
|
|
10856
|
-
const value2 = args[i + 1];
|
|
10857
|
-
const keyStr = objectLiteralKeyFromType(key
|
|
10860
|
+
const key = argType(args[i], i);
|
|
10861
|
+
const value2 = argType(args[i + 1], i + 1);
|
|
10862
|
+
const keyStr = objectLiteralKeyFromType(key);
|
|
10858
10863
|
if (!keyStr) {
|
|
10859
10864
|
const value3 = args.reduce(
|
|
10860
10865
|
(cur, next, i2) => {
|
|
@@ -10884,7 +10889,7 @@ function evaluateNode(istate, node) {
|
|
|
10884
10889
|
});
|
|
10885
10890
|
return;
|
|
10886
10891
|
}
|
|
10887
|
-
fields.set(keyStr, relaxType(value2
|
|
10892
|
+
fields.set(keyStr, relaxType(value2));
|
|
10888
10893
|
}
|
|
10889
10894
|
push({
|
|
10890
10895
|
value: {
|
|
@@ -12837,8 +12842,18 @@ function checkArrayCovariance(arg, param) {
|
|
|
12837
12842
|
);
|
|
12838
12843
|
return ok;
|
|
12839
12844
|
}
|
|
12840
|
-
function safeReferenceArg(arg) {
|
|
12841
|
-
|
|
12845
|
+
function safeReferenceArg(istate, arg) {
|
|
12846
|
+
if (arg.type === "Literal" || arg.type === "ArrayExpression" || arg.type === "ObjectExpression" || arg.type === "NewExpression" || arg.type === "BinaryExpression" && arg.operator === "as" && safeReferenceArg(istate, arg.left) || arg.type === "ConditionalExpression" && safeReferenceArg(istate, arg.consequent) && safeReferenceArg(istate, arg.alternate)) {
|
|
12847
|
+
return true;
|
|
12848
|
+
}
|
|
12849
|
+
const type = istate.typeMap?.get(arg) ?? evaluate(istate, arg).value;
|
|
12850
|
+
if (type && !couldBe({
|
|
12851
|
+
type: 512 | 1024
|
|
12852
|
+
/* Dictionary */
|
|
12853
|
+
}, type)) {
|
|
12854
|
+
return true;
|
|
12855
|
+
}
|
|
12856
|
+
return false;
|
|
12842
12857
|
}
|
|
12843
12858
|
var init_array_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
12844
12859
|
"src/type-flow/array-type.ts"() {
|
|
@@ -12846,6 +12861,7 @@ var init_array_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12846
12861
|
init_sub_type();
|
|
12847
12862
|
init_types();
|
|
12848
12863
|
init_could_be();
|
|
12864
|
+
init_interp();
|
|
12849
12865
|
}
|
|
12850
12866
|
});
|
|
12851
12867
|
function cloneAnt(antMap) {
|
|
@@ -17681,6 +17697,9 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17681
17697
|
elem.embeddedEffects = false;
|
|
17682
17698
|
}
|
|
17683
17699
|
}
|
|
17700
|
+
if (istate2 !== gistate) {
|
|
17701
|
+
delete istate2.typeChecker;
|
|
17702
|
+
}
|
|
17684
17703
|
again = true;
|
|
17685
17704
|
}
|
|
17686
17705
|
return result;
|
|
@@ -17893,6 +17912,29 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17893
17912
|
case "ClassDeclaration":
|
|
17894
17913
|
case "ModuleDeclaration":
|
|
17895
17914
|
return ["body"];
|
|
17915
|
+
case "ArrayExpression": {
|
|
17916
|
+
const n = node;
|
|
17917
|
+
if (!n.originalTypes && n.elements.some(
|
|
17918
|
+
(e) => e.type === "BinaryExpression" && e.operator === "as"
|
|
17919
|
+
)) {
|
|
17920
|
+
n.originalTypes = n.elements.map(
|
|
17921
|
+
(e) => e.type === "BinaryExpression" && e.operator === "as" ? e.right : null
|
|
17922
|
+
);
|
|
17923
|
+
}
|
|
17924
|
+
break;
|
|
17925
|
+
}
|
|
17926
|
+
case "ObjectExpression": {
|
|
17927
|
+
const n = node;
|
|
17928
|
+
if (!n.originalTypes && n.properties.some(
|
|
17929
|
+
(e) => e.key.type === "BinaryExpression" && e.key.operator === "as" || e.value.type === "BinaryExpression" && e.value.operator === "as"
|
|
17930
|
+
)) {
|
|
17931
|
+
n.originalTypes = n.properties.flatMap((e) => [
|
|
17932
|
+
e.key.type === "BinaryExpression" && e.key.operator === "as" ? e.key.right : null,
|
|
17933
|
+
e.value.type === "BinaryExpression" && e.value.operator === "as" ? e.value.right : null
|
|
17934
|
+
]);
|
|
17935
|
+
}
|
|
17936
|
+
break;
|
|
17937
|
+
}
|
|
17896
17938
|
}
|
|
17897
17939
|
return ret;
|
|
17898
17940
|
};
|
|
@@ -17932,6 +17974,9 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17932
17974
|
case "BlockStatement":
|
|
17933
17975
|
case "ForStatement":
|
|
17934
17976
|
if (locals.map && cleanupUnusedVars(this, node) && !this.inlining) {
|
|
17977
|
+
if (istate !== gistate) {
|
|
17978
|
+
delete istate.typeChecker;
|
|
17979
|
+
}
|
|
17935
17980
|
again = true;
|
|
17936
17981
|
}
|
|
17937
17982
|
break;
|
|
@@ -30662,7 +30707,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30662
30707
|
const opt_time = await (0, import_chunk_X7QCZR3F.first_modified)(
|
|
30663
30708
|
Object.values(fnMap).map((v) => v.output)
|
|
30664
30709
|
);
|
|
30665
|
-
if (source_time < opt_time &&
|
|
30710
|
+
if (source_time < opt_time && 1734300554639 < opt_time) {
|
|
30666
30711
|
return {
|
|
30667
30712
|
hasTests,
|
|
30668
30713
|
diagnostics: prevDiagnostics,
|
|
@@ -30700,7 +30745,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30700
30745
|
hasTests: hasTests2,
|
|
30701
30746
|
diagnostics,
|
|
30702
30747
|
sdkVersion,
|
|
30703
|
-
optimizerVersion: "1.1.
|
|
30748
|
+
optimizerVersion: "1.1.85",
|
|
30704
30749
|
...Object.fromEntries(
|
|
30705
30750
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
30706
30751
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -18,30 +18,30 @@ 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_OFOOTSQM.StateNodeAttributes,
|
|
22
|
+
buildConfigDescription: () => import_chunk_OFOOTSQM.buildConfigDescription,
|
|
23
|
+
buildOptimizedProject: () => import_chunk_OFOOTSQM.buildOptimizedProject,
|
|
24
24
|
copyRecursiveAsNeeded: () => import_chunk_X7QCZR3F.copyRecursiveAsNeeded,
|
|
25
|
-
defaultConfig: () =>
|
|
26
|
-
display: () =>
|
|
27
|
-
generateOneConfig: () =>
|
|
28
|
-
generateOptimizedProject: () =>
|
|
29
|
-
getConfig: () =>
|
|
30
|
-
getFnMapAnalysis: () =>
|
|
31
|
-
getProjectAnalysis: () =>
|
|
32
|
-
get_jungle: () =>
|
|
33
|
-
isErrorWithLocation: () =>
|
|
34
|
-
launchSimulator: () =>
|
|
35
|
-
manifestProducts: () =>
|
|
36
|
-
mctree: () =>
|
|
37
|
-
simulateProgram: () =>
|
|
25
|
+
defaultConfig: () => import_chunk_OFOOTSQM.defaultConfig,
|
|
26
|
+
display: () => import_chunk_OFOOTSQM.display,
|
|
27
|
+
generateOneConfig: () => import_chunk_OFOOTSQM.generateOneConfig,
|
|
28
|
+
generateOptimizedProject: () => import_chunk_OFOOTSQM.generateOptimizedProject,
|
|
29
|
+
getConfig: () => import_chunk_OFOOTSQM.getConfig,
|
|
30
|
+
getFnMapAnalysis: () => import_chunk_OFOOTSQM.getFnMapAnalysis,
|
|
31
|
+
getProjectAnalysis: () => import_chunk_OFOOTSQM.getProjectAnalysis,
|
|
32
|
+
get_jungle: () => import_chunk_OFOOTSQM.get_jungle,
|
|
33
|
+
isErrorWithLocation: () => import_chunk_OFOOTSQM.isErrorWithLocation,
|
|
34
|
+
launchSimulator: () => import_chunk_OFOOTSQM.launchSimulator,
|
|
35
|
+
manifestProducts: () => import_chunk_OFOOTSQM.manifestProducts,
|
|
36
|
+
mctree: () => import_chunk_OFOOTSQM.mctree,
|
|
37
|
+
simulateProgram: () => import_chunk_OFOOTSQM.simulateProgram
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(optimizer_exports);
|
|
40
|
-
var
|
|
40
|
+
var import_chunk_OFOOTSQM = require("./chunk-OFOOTSQM.cjs");
|
|
41
41
|
var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
|
|
42
42
|
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
|
|
43
43
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
44
|
-
(0,
|
|
44
|
+
(0, import_chunk_OFOOTSQM.init_optimizer)();
|
|
45
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
46
|
0 && (module.exports = {
|
|
47
47
|
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_OFOOTSQM.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_OFOOTSQM.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_OFOOTSQM.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_OFOOTSQM.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_OFOOTSQM.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_OFOOTSQM.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_OFOOTSQM.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_OFOOTSQM.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_OFOOTSQM.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_OFOOTSQM.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_OFOOTSQM.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_OFOOTSQM.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_OFOOTSQM = require("./chunk-OFOOTSQM.cjs");
|
|
36
36
|
var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
|
|
37
37
|
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
|
|
38
38
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
39
|
-
(0,
|
|
39
|
+
(0, import_chunk_OFOOTSQM.init_sdk_util)();
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
SectionKinds,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
2
|
import { ArrayType, ExactOrUnion } from "./types";
|
|
3
|
+
import { InterpState } from "./interp";
|
|
3
4
|
export type ArrayTypeData = NonNullable<ArrayType["value"]>;
|
|
4
5
|
export declare function tupleForEach(t: ArrayTypeData, tupleFn: (v: ExactOrUnion[]) => unknown, arrayFn: (v: ExactOrUnion) => unknown): void;
|
|
5
6
|
export declare function tupleMap<T, U, V>(t: ArrayTypeData, tupleFn: (v: ExactOrUnion[]) => U | null, arrayFn: (v: ExactOrUnion) => V | null, reduceFn: (v: Array<U | V>) => T): T;
|
|
@@ -7,4 +8,4 @@ export declare function tupleReduce(v: Array<ExactOrUnion | ExactOrUnion[]>): im
|
|
|
7
8
|
export declare function reducedArrayType(t: ArrayTypeData): ExactOrUnion;
|
|
8
9
|
export declare function restrictArrayData(constraint: ArrayTypeData, tracked: ArrayTypeData): ArrayTypeData;
|
|
9
10
|
export declare function checkArrayCovariance(arg: ArrayTypeData, param: ArrayTypeData): boolean;
|
|
10
|
-
export declare function safeReferenceArg(arg: mctree.Expression): boolean;
|
|
11
|
+
export declare function safeReferenceArg(istate: InterpState, arg: mctree.Expression): 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_OFOOTSQM = require("./chunk-OFOOTSQM.cjs");
|
|
25
25
|
var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
|
|
26
26
|
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.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_OFOOTSQM.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_OFOOTSQM.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.85",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "markw65",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@markw65/prettier-plugin-monkeyc": "^1.0.
|
|
59
|
+
"@markw65/prettier-plugin-monkeyc": "^1.0.60"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@markw65/peggy-optimizer": "^1.0.1",
|