@markw65/monkeyc-optimizer 1.1.54 → 1.1.55
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 +5 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-5K64MLXC.cjs → chunk-GWRGLJLB.cjs} +50 -11
- package/build/optimizer.cjs +16 -16
- package/build/sdk-util.cjs +14 -14
- package/build/worker-thread.cjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.55
|
|
6
|
+
|
|
7
|
+
- Allow class typedef lookups from static methods
|
|
8
|
+
- Fix method lookups on enum values
|
|
9
|
+
|
|
5
10
|
### 1.1.54
|
|
6
11
|
|
|
7
12
|
- Fix return types of Dictionary.values() and Dictionary.keys()
|
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_GWRGLJLB.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_GWRGLJLB.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_GWRGLJLB.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_GWRGLJLB.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_GWRGLJLB.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_GWRGLJLB.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_GWRGLJLB.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_GWRGLJLB.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_GWRGLJLB.formatAstLongLines,
|
|
30
|
+
formatScopedName: () => import_chunk_GWRGLJLB.formatScopedName,
|
|
31
|
+
getApiFunctionInfo: () => import_chunk_GWRGLJLB.getApiFunctionInfo,
|
|
32
|
+
getApiMapping: () => import_chunk_GWRGLJLB.getApiMapping,
|
|
33
|
+
getSuperClasses: () => import_chunk_GWRGLJLB.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_GWRGLJLB.isClassVariable,
|
|
36
|
+
isLocal: () => import_chunk_GWRGLJLB.isLocal,
|
|
37
|
+
isLookupCandidate: () => import_chunk_GWRGLJLB.isLookupCandidate,
|
|
38
|
+
isStateNode: () => import_chunk_GWRGLJLB.isStateNode,
|
|
39
|
+
lookupByFullName: () => import_chunk_GWRGLJLB.lookupByFullName,
|
|
40
|
+
lookupNext: () => import_chunk_GWRGLJLB.lookupNext,
|
|
41
|
+
lookupResultContains: () => import_chunk_GWRGLJLB.lookupResultContains,
|
|
42
|
+
lookupWithType: () => import_chunk_GWRGLJLB.lookupWithType,
|
|
43
|
+
makeToyboxLink: () => import_chunk_GWRGLJLB.makeToyboxLink,
|
|
44
|
+
mapVarDeclsByType: () => import_chunk_GWRGLJLB.mapVarDeclsByType,
|
|
45
|
+
markInvokeClassMethod: () => import_chunk_GWRGLJLB.markInvokeClassMethod,
|
|
46
|
+
parseSdkVersion: () => import_chunk_GWRGLJLB.parseSdkVersion,
|
|
47
|
+
resolveDiagnostics: () => import_chunk_GWRGLJLB.resolveDiagnostics,
|
|
48
|
+
resolveDiagnosticsMap: () => import_chunk_GWRGLJLB.resolveDiagnosticsMap,
|
|
49
|
+
sameLookupResult: () => import_chunk_GWRGLJLB.sameLookupResult,
|
|
50
50
|
traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
|
|
51
|
-
variableDeclarationName: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
visitorNode: () =>
|
|
51
|
+
variableDeclarationName: () => import_chunk_GWRGLJLB.variableDeclarationName,
|
|
52
|
+
visitReferences: () => import_chunk_GWRGLJLB.visitReferences,
|
|
53
|
+
visit_resources: () => import_chunk_GWRGLJLB.visit_resources,
|
|
54
|
+
visitorNode: () => import_chunk_GWRGLJLB.visitorNode
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(api_exports);
|
|
57
|
-
var
|
|
57
|
+
var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
|
|
58
58
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.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_GWRGLJLB.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_GWRGLJLB_exports = {};
|
|
30
|
+
__export(chunk_GWRGLJLB_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -133,7 +133,7 @@ __export(chunk_5K64MLXC_exports, {
|
|
|
133
133
|
visitorNode: () => visitorNode,
|
|
134
134
|
xml_util_exports: () => xml_util_exports
|
|
135
135
|
});
|
|
136
|
-
module.exports = __toCommonJS(
|
|
136
|
+
module.exports = __toCommonJS(chunk_GWRGLJLB_exports);
|
|
137
137
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
138
138
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
139
139
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
@@ -18247,13 +18247,51 @@ function isLookupCandidate(node) {
|
|
|
18247
18247
|
}
|
|
18248
18248
|
function lookupNext(state, results, decls, property) {
|
|
18249
18249
|
return results.reduce((current, lookupDef) => {
|
|
18250
|
-
const items =
|
|
18250
|
+
const items = [];
|
|
18251
|
+
const addToItems = (sns) => sns.forEach((module2) => {
|
|
18251
18252
|
if (!isStateNode(module2)) {
|
|
18252
|
-
|
|
18253
|
+
if (module2.type === "EnumStringMember") {
|
|
18254
|
+
if (!module2.init) {
|
|
18255
|
+
addToItems(lookupByFullName(state, "Toybox.Lang.Number"));
|
|
18256
|
+
} else if (module2.init.type === "Literal") {
|
|
18257
|
+
const [, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(module2.init);
|
|
18258
|
+
switch (type) {
|
|
18259
|
+
case "Null":
|
|
18260
|
+
return;
|
|
18261
|
+
case "Boolean":
|
|
18262
|
+
case "Char":
|
|
18263
|
+
case "Double":
|
|
18264
|
+
case "Float":
|
|
18265
|
+
case "Long":
|
|
18266
|
+
case "Number":
|
|
18267
|
+
case "String":
|
|
18268
|
+
addToItems(lookupByFullName(state, `Toybox.Lang.${type}`));
|
|
18269
|
+
return;
|
|
18270
|
+
}
|
|
18271
|
+
} else {
|
|
18272
|
+
[
|
|
18273
|
+
"Boolean",
|
|
18274
|
+
"Char",
|
|
18275
|
+
"Double",
|
|
18276
|
+
"Float",
|
|
18277
|
+
"Long",
|
|
18278
|
+
"Number",
|
|
18279
|
+
"String"
|
|
18280
|
+
].forEach(
|
|
18281
|
+
(type) => addToItems(lookupByFullName(state, `Toybox.Lang.${type}`))
|
|
18282
|
+
);
|
|
18283
|
+
return;
|
|
18284
|
+
}
|
|
18285
|
+
}
|
|
18286
|
+
addToItems(lookupByFullName(state, "Toybox.Lang.Object"));
|
|
18287
|
+
return;
|
|
18253
18288
|
}
|
|
18254
18289
|
const res = checkOne(state, module2, decls, property);
|
|
18255
|
-
|
|
18256
|
-
|
|
18290
|
+
if (res) {
|
|
18291
|
+
items.push({ parent: module2, results: res });
|
|
18292
|
+
}
|
|
18293
|
+
});
|
|
18294
|
+
addToItems(lookupDef.results);
|
|
18257
18295
|
if (!items.length)
|
|
18258
18296
|
return current;
|
|
18259
18297
|
return current ? current.concat(items) : items;
|
|
@@ -18327,8 +18365,8 @@ function lookup(state, decls, node, name, maybeStack, nonlocal, ignoreImports) {
|
|
|
18327
18365
|
case "ClassDeclaration":
|
|
18328
18366
|
if (inStatic && state.config?.enforceStatic !== "NO") {
|
|
18329
18367
|
inStatic = false;
|
|
18330
|
-
if ((0, import_chunk_MBTLUWXR.hasProperty)(si
|
|
18331
|
-
const r = si
|
|
18368
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(si[decls], node.name)) {
|
|
18369
|
+
const r = si[decls][node.name].filter((s) => {
|
|
18332
18370
|
switch (s.type) {
|
|
18333
18371
|
case "FunctionDeclaration":
|
|
18334
18372
|
case "VariableDeclarator":
|
|
@@ -19279,6 +19317,7 @@ var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
19279
19317
|
init_type_flow_util();
|
|
19280
19318
|
init_types();
|
|
19281
19319
|
(0, import_chunk_SG7ODKRM.init_util)();
|
|
19320
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
19282
19321
|
init_visitor();
|
|
19283
19322
|
}
|
|
19284
19323
|
});
|
|
@@ -28983,7 +29022,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
28983
29022
|
const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
|
|
28984
29023
|
Object.values(fnMap).map((v) => v.output)
|
|
28985
29024
|
);
|
|
28986
|
-
if (source_time < opt_time &&
|
|
29025
|
+
if (source_time < opt_time && 1713229195228 < opt_time) {
|
|
28987
29026
|
return {
|
|
28988
29027
|
hasTests,
|
|
28989
29028
|
diagnostics: prevDiagnostics,
|
|
@@ -29022,7 +29061,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29022
29061
|
hasTests: hasTests2,
|
|
29023
29062
|
diagnostics,
|
|
29024
29063
|
sdkVersion,
|
|
29025
|
-
optimizerVersion: "1.1.
|
|
29064
|
+
optimizerVersion: "1.1.55",
|
|
29026
29065
|
...Object.fromEntries(
|
|
29027
29066
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29028
29067
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -18,28 +18,28 @@ 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
|
-
buildOptimizedProject: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_GWRGLJLB.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_GWRGLJLB.buildOptimizedProject,
|
|
23
23
|
copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
|
|
24
|
-
defaultConfig: () =>
|
|
25
|
-
display: () =>
|
|
26
|
-
generateOneConfig: () =>
|
|
27
|
-
generateOptimizedProject: () =>
|
|
28
|
-
getConfig: () =>
|
|
29
|
-
getProjectAnalysis: () =>
|
|
30
|
-
get_jungle: () =>
|
|
31
|
-
isErrorWithLocation: () =>
|
|
32
|
-
launchSimulator: () =>
|
|
33
|
-
manifestProducts: () =>
|
|
34
|
-
mctree: () =>
|
|
35
|
-
simulateProgram: () =>
|
|
24
|
+
defaultConfig: () => import_chunk_GWRGLJLB.defaultConfig,
|
|
25
|
+
display: () => import_chunk_GWRGLJLB.display,
|
|
26
|
+
generateOneConfig: () => import_chunk_GWRGLJLB.generateOneConfig,
|
|
27
|
+
generateOptimizedProject: () => import_chunk_GWRGLJLB.generateOptimizedProject,
|
|
28
|
+
getConfig: () => import_chunk_GWRGLJLB.getConfig,
|
|
29
|
+
getProjectAnalysis: () => import_chunk_GWRGLJLB.getProjectAnalysis,
|
|
30
|
+
get_jungle: () => import_chunk_GWRGLJLB.get_jungle,
|
|
31
|
+
isErrorWithLocation: () => import_chunk_GWRGLJLB.isErrorWithLocation,
|
|
32
|
+
launchSimulator: () => import_chunk_GWRGLJLB.launchSimulator,
|
|
33
|
+
manifestProducts: () => import_chunk_GWRGLJLB.manifestProducts,
|
|
34
|
+
mctree: () => import_chunk_GWRGLJLB.mctree,
|
|
35
|
+
simulateProgram: () => import_chunk_GWRGLJLB.simulateProgram
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(optimizer_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
|
|
39
39
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
40
40
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
41
41
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
42
|
-
(0,
|
|
42
|
+
(0, import_chunk_GWRGLJLB.init_optimizer)();
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
44
|
0 && (module.exports = {
|
|
45
45
|
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_GWRGLJLB.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_GWRGLJLB.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_GWRGLJLB.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_GWRGLJLB.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_GWRGLJLB.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_GWRGLJLB.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_GWRGLJLB.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_GWRGLJLB.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_GWRGLJLB.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_GWRGLJLB.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_GWRGLJLB.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_GWRGLJLB.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
|
|
36
36
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.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_GWRGLJLB.init_sdk_util)();
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
SectionKinds,
|
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_GWRGLJLB = require("./chunk-GWRGLJLB.cjs");
|
|
25
25
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.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_GWRGLJLB.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_GWRGLJLB.performTask)(task));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
package/package.json
CHANGED