@markw65/monkeyc-optimizer 1.0.6 → 1.0.9

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/build/util.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 0 && (module.exports = {isWin,appSupport,connectiq,getSdkPath,globa,last_modified,first_modified,pushUnique,spawnByLine,readByLine,promiseAll,copyRecursiveAsNeeded});
1
+ 0 && (module.exports = {globa,last_modified,first_modified,pushUnique,spawnByLine,readByLine,promiseAll,copyRecursiveAsNeeded});
2
2
  /******/ (() => { // webpackBootstrap
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
@@ -3978,13 +3978,9 @@ __webpack_require__.r(__webpack_exports__);
3978
3978
 
3979
3979
  // EXPORTS
3980
3980
  __webpack_require__.d(__webpack_exports__, {
3981
- "appSupport": () => (/* binding */ appSupport),
3982
- "connectiq": () => (/* binding */ connectiq),
3983
3981
  "copyRecursiveAsNeeded": () => (/* binding */ copyRecursiveAsNeeded),
3984
3982
  "first_modified": () => (/* binding */ first_modified),
3985
- "getSdkPath": () => (/* binding */ getSdkPath),
3986
3983
  "globa": () => (/* binding */ globa),
3987
- "isWin": () => (/* binding */ isWin),
3988
3984
  "last_modified": () => (/* binding */ last_modified),
3989
3985
  "promiseAll": () => (/* binding */ promiseAll),
3990
3986
  "pushUnique": () => (/* binding */ pushUnique),
@@ -4012,18 +4008,9 @@ const external_readline_namespaceObject = require("readline");
4012
4008
 
4013
4009
 
4014
4010
 
4015
- const isWin = process.platform == "win32";
4016
-
4017
- const appSupport = isWin
4018
- ? `${process.env.APPDATA}`.replace(/\\/g, "/")
4019
- : `${process.env.HOME}/Library/Application Support`;
4020
-
4021
- const connectiq = `${appSupport}/Garmin/ConnectIQ`;
4022
-
4023
- function getSdkPath() {
4024
- return promises_namespaceObject.readFile(connectiq + "/current-sdk.cfg")
4025
- .then((contents) => contents.toString().replace(/^\s*(.*?)\s*$/s, "$1"));
4026
- }
4011
+ // Write it this way so that webpack.DefinePlugin doesn't
4012
+ // recognize global.lastModifiedSource.
4013
+ global["lastModifiedSource" + ""] = 0;
4027
4014
 
4028
4015
  function globa(pattern, options) {
4029
4016
  return new Promise((resolve, reject) => {
@@ -4106,17 +4093,30 @@ function readByLine(file, lineHandler) {
4106
4093
  );
4107
4094
  }
4108
4095
 
4109
- async function promiseAll(promises, parallelism) {
4096
+ async function promiseAll(promiseFn, parallelism) {
4110
4097
  parallelism = parallelism || 4;
4111
4098
  const serializer = [];
4112
- promises.forEach((p, i) => {
4113
- if (serializer.length < parallelism) {
4114
- serializer.push(p);
4115
- } else {
4116
- serializer[i % parallelism].then(() => p);
4099
+ const results = [];
4100
+ let done = false;
4101
+ let i = 0;
4102
+ const next = () => {
4103
+ const index = i++;
4104
+ if (done) return;
4105
+ const promise = promiseFn(index);
4106
+ if (!promise) {
4107
+ done = true;
4108
+ return;
4117
4109
  }
4118
- });
4119
- return Promise.all(serializer);
4110
+ return promise
4111
+ .then((r) => {
4112
+ results[index] = r;
4113
+ })
4114
+ .then(next);
4115
+ };
4116
+ while (i < parallelism) {
4117
+ serializer.push(next());
4118
+ }
4119
+ return Promise.all(serializer).then(() => results);
4120
4120
  }
4121
4121
 
4122
4122
  async function copyRecursiveAsNeeded(source, target, filter) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "module",
4
- "version": "1.0.6",
4
+ "version": "1.0.9",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "exports": {
@@ -13,17 +13,19 @@
13
13
  "build-debug": "webpack --mode development",
14
14
  "build-release": "webpack --mode production",
15
15
  "prepack": "webpack --mode production",
16
- "test": "echo \"Error: no test specified\" && exit 1"
16
+ "test": "npm run test-remote",
17
+ "test-remote": "node ./test/test.js --product=pick-one --github"
17
18
  },
18
19
  "files": [
19
20
  "build/optimizer.cjs",
20
21
  "build/util.cjs",
22
+ "build/sdk-util.cjs",
21
23
  "build/api.cjs"
22
24
  ],
23
25
  "author": "markw65",
24
26
  "license": "MIT",
25
27
  "dependencies": {
26
- "@markw65/prettier-plugin-monkeyc": "^1.0.12"
28
+ "@markw65/prettier-plugin-monkeyc": "^1.0.15"
27
29
  },
28
30
  "devDependencies": {
29
31
  "eslint": "^8.12.0",