@markw65/monkeyc-optimizer 1.0.11 → 1.0.12

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 CHANGED
@@ -119,3 +119,7 @@ More fixes found via open source projects.
119
119
  - Refactoring to make analysis available in prettier-extension-monkeyc
120
120
  - Generate .d.ts, and drop unneeded paths/resolve.alias
121
121
  - Pull in a typed version of @markw65/prettier-plugin-monkeyc
122
+
123
+ ### 1.0.12
124
+
125
+ - Fix connectiq and vscode paths on linux, and better error reporting when they're missing
@@ -11937,7 +11937,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
11937
11937
  // the oldest optimized file, we don't need to regenerate
11938
11938
  const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap).concat(dependencyFiles));
11939
11939
  const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap).map((v) => v.output));
11940
- if (source_time < opt_time && 1653156641658 < opt_time) {
11940
+ if (source_time < opt_time && 1653327101857 < opt_time) {
11941
11941
  return hasTests;
11942
11942
  }
11943
11943
  }
@@ -7195,14 +7195,24 @@ const external_util_cjs_namespaceObject = require("./util.cjs");
7195
7195
  const isWin = process.platform == "win32";
7196
7196
  const appSupport = isWin
7197
7197
  ? `${process.env.APPDATA}`.replace(/\\/g, "/")
7198
- : `${process.env.HOME}/Library/Application Support`;
7199
- const connectiq = `${appSupport}/Garmin/ConnectIQ`;
7198
+ : process.platform == "linux"
7199
+ ? `${process.env.HOME}/.config`
7200
+ : `${process.env.HOME}/Library/Application Support`;
7201
+ const connectiq = process.platform == "linux"
7202
+ ? `${process.env.HOME}/.Garmin/ConnectIQ`
7203
+ : `${appSupport}/Garmin/ConnectIQ`;
7200
7204
  function getSdkPath() {
7201
7205
  return promises_namespaceObject.readFile(connectiq + "/current-sdk.cfg")
7202
- .then((contents) => contents.toString().replace(/^\s*(.*?)\s*$/s, "$1"));
7206
+ .then((contents) => contents.toString().replace(/^\s*(.*?)\s*$/s, "$1"))
7207
+ .catch(() => {
7208
+ throw new Error(`No sdk found at '${connectiq}'. Check your sdk is correctly installed`);
7209
+ });
7203
7210
  }
7204
7211
  async function getDeviceInfo() {
7205
7212
  const files = await (0,external_util_cjs_namespaceObject.globa)(`${connectiq}/Devices/*/compiler.json`);
7213
+ if (!files.length) {
7214
+ throw new Error(`No devices found at '${connectiq}/Devices'. Check your sdk is correctly installed`);
7215
+ }
7206
7216
  return Promise.all(files.map((file) => {
7207
7217
  return promises_namespaceObject.readFile(file).then((data) => {
7208
7218
  const { deviceId, appTypes, deviceFamily } = JSON.parse(data.toString());
@@ -2,6 +2,6 @@ import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
2
  export declare function getFileSources(fnMap: FilesToOptimizeMap): Promise<void>;
3
3
  export declare function getFileASTs(fnMap: FilesToOptimizeMap): Promise<boolean>;
4
4
  export declare function analyze(fnMap: FilesToOptimizeMap): Promise<ProgramState>;
5
- export declare function getLiteralFromDecls(decls: StateNodeDecl[]): mctree.Literal | mctree.AsExpression;
5
+ export declare function getLiteralFromDecls(decls: StateNodeDecl[]): mctree.AsExpression | mctree.Literal;
6
6
  export declare function getLiteralNode(node: mctree.Node): null | mctree.Literal | mctree.AsExpression;
7
7
  export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "module",
4
- "version": "1.0.11",
4
+ "version": "1.0.12",
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",