@markw65/monkeyc-optimizer 1.0.35 → 1.0.37
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 +6 -0
- package/build/optimizer.cjs +25 -4
- package/build/src/launch.d.ts +2 -0
- package/build/src/optimizer-types.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -414,3 +414,9 @@ Bug Fixes
|
|
|
414
414
|
|
|
415
415
|
- Bug fixes
|
|
416
416
|
- Fixed a bug that caused the optimizer to fail if a top level variable declared in a case statement had an initializer with side effects. This didn't produce incorrect results, the optimizer simply bailed out with an obscure error, and refused to optimize the project.
|
|
417
|
+
|
|
418
|
+
### 1.0.36
|
|
419
|
+
|
|
420
|
+
- Update to [@markw65/prettier-plugin-monkeyc@1.0.35](https://github.com/markw65/prettier-plugin-monkeyc#1035).
|
|
421
|
+
- Fixes [prettier-plugin-monkeyc#1](https://github.com/markw65/prettier-plugin-monkeyc/issues/1)
|
|
422
|
+
- Fixes [monkeyc-optimizer#1](https://github.com/markw65/monkeyc-optimizer/issues/1)
|
package/build/optimizer.cjs
CHANGED
|
@@ -10956,6 +10956,8 @@ async function get_jungle(jungles, options) {
|
|
|
10956
10956
|
return result;
|
|
10957
10957
|
}
|
|
10958
10958
|
|
|
10959
|
+
;// CONCATENATED MODULE: external "net"
|
|
10960
|
+
const external_net_namespaceObject = require("net");
|
|
10959
10961
|
;// CONCATENATED MODULE: external "child_process"
|
|
10960
10962
|
const external_child_process_namespaceObject = require("child_process");
|
|
10961
10963
|
;// CONCATENATED MODULE: ./src/launch.ts
|
|
@@ -10963,10 +10965,27 @@ const external_child_process_namespaceObject = require("child_process");
|
|
|
10963
10965
|
|
|
10964
10966
|
|
|
10965
10967
|
|
|
10968
|
+
|
|
10966
10969
|
function launchSimulator() {
|
|
10967
|
-
return (
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
+
return checkIfSimulatorRunning().then((running) => running
|
|
10971
|
+
? Promise.resolve()
|
|
10972
|
+
: (0,external_sdk_util_cjs_namespaceObject.getSdkPath)().then((sdk) => {
|
|
10973
|
+
const child = (0,external_child_process_namespaceObject.execFile)(external_path_.resolve(sdk, "bin", external_sdk_util_cjs_namespaceObject.isWin ? "simulator" : "connectiq"));
|
|
10974
|
+
child.unref();
|
|
10975
|
+
}));
|
|
10976
|
+
}
|
|
10977
|
+
function checkIfSimulatorRunning() {
|
|
10978
|
+
return Promise.all([1234, 1235, 1236, 1237, 1238].map(checkIfSimulatorRunningOn)).then((results) => results.some((v) => v));
|
|
10979
|
+
}
|
|
10980
|
+
function checkIfSimulatorRunningOn(port) {
|
|
10981
|
+
return new Promise((resolve) => {
|
|
10982
|
+
let listening = false;
|
|
10983
|
+
const socket = new external_net_namespaceObject.Socket();
|
|
10984
|
+
socket.on("data", (data) => (listening = data.toString().includes("A garmin device")));
|
|
10985
|
+
socket.on("error", () => resolve(false));
|
|
10986
|
+
socket.on("end", () => resolve(listening));
|
|
10987
|
+
socket.connect(port, "localhost");
|
|
10988
|
+
socket.end();
|
|
10970
10989
|
});
|
|
10971
10990
|
}
|
|
10972
10991
|
function simulateProgram(prg, device, test = false, logger) {
|
|
@@ -15438,6 +15457,7 @@ const configOptionsToCheck = [
|
|
|
15438
15457
|
"ignoredSourcePaths",
|
|
15439
15458
|
"checkInvalidSymbols",
|
|
15440
15459
|
"sizeBasedPRE",
|
|
15460
|
+
"extensionVersion",
|
|
15441
15461
|
];
|
|
15442
15462
|
/**
|
|
15443
15463
|
* @param {BuildConfig} config
|
|
@@ -15489,7 +15509,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
|
|
|
15489
15509
|
// the oldest optimized file, we don't need to regenerate
|
|
15490
15510
|
const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap).concat(dependencyFiles));
|
|
15491
15511
|
const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap).map((v) => v.output));
|
|
15492
|
-
if (source_time < opt_time &&
|
|
15512
|
+
if (source_time < opt_time && 1666558228929 < opt_time) {
|
|
15493
15513
|
return { hasTests, diagnostics: prevDiagnostics };
|
|
15494
15514
|
}
|
|
15495
15515
|
}
|
|
@@ -15514,6 +15534,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
|
|
|
15514
15534
|
return promises_namespaceObject.writeFile(external_path_.join(output, "build-info.json"), JSON.stringify({
|
|
15515
15535
|
hasTests,
|
|
15516
15536
|
diagnostics,
|
|
15537
|
+
optimizerVersion: "1.0.37",
|
|
15517
15538
|
...Object.fromEntries(configOptionsToCheck.map((option) => [option, config[option]])),
|
|
15518
15539
|
}))
|
|
15519
15540
|
.then(() => ({ hasTests, diagnostics }));
|
package/build/src/launch.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { LineHandler } from "./util";
|
|
2
2
|
export declare function launchSimulator(): Promise<void>;
|
|
3
|
+
export declare function checkIfSimulatorRunning(): Promise<boolean>;
|
|
4
|
+
export declare function checkIfSimulatorRunningOn(port: number): Promise<boolean>;
|
|
3
5
|
export declare function simulateProgram(prg: string, device: string, test?: boolean, logger?: LineHandler | LineHandler[]): Promise<void>;
|
|
@@ -26,6 +26,7 @@ export declare type BuildConfig = {
|
|
|
26
26
|
checkInvalidSymbols?: DiagnosticType | "OFF";
|
|
27
27
|
sizeBasedPRE?: boolean | string;
|
|
28
28
|
prettier?: Record<string, unknown>;
|
|
29
|
+
extensionVersion?: string;
|
|
29
30
|
_cache?: {
|
|
30
31
|
barrels?: Record<string, ResolvedJungle>;
|
|
31
32
|
barrelMap?: Record<string, Record<string, ResolvedJungle>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markw65/monkeyc-optimizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.37",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"author": "markw65",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@markw65/prettier-plugin-monkeyc": "^1.0.
|
|
40
|
+
"@markw65/prettier-plugin-monkeyc": "^1.0.35"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/glob": "^7.2.0",
|