@markw65/monkeyc-optimizer 1.1.91 → 1.1.93

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.
@@ -56,25 +56,25 @@ export declare enum Opcodes {
56
56
  argc = 53,
57
57
  newba = 54,
58
58
  ipushz = 55,
59
- ipush1 = 56,
60
- ipush2 = 57,
61
- ipush3 = 58,
59
+ ipush1 = 56,// ArgumentType.ARGUMENT_NUMBER),
60
+ ipush2 = 57,// ArgumentType.ARGUMENT_NUMBER),
61
+ ipush3 = 58,// ArgumentType.ARGUMENT_NUMBER),
62
62
  fpushz = 59,
63
63
  lpushz = 60,
64
64
  dpushz = 61,
65
65
  btpush = 62,
66
66
  bfpush = 63,
67
- apush = 64,
68
- bapush = 65,
69
- hpush = 66,
70
- getselfv = 67,
67
+ apush = 64,// ArgumentType.ARGUMENT_LABEL),
68
+ bapush = 65,// ArgumentType.ARGUMENT_LABEL),
69
+ hpush = 66,// ArgumentType.ARGUMENT_LABEL),
70
+ getselfv = 67,// ArgumentType.ARGUMENT_SYMBOL),
71
71
  getself = 68,
72
- getmv = 69,
73
- getlocalv = 70,
74
- getsv = 71,
72
+ getmv = 69,// ArgumentType.ARGUMENT_SYMBOL, ArgumentType.ARGUMENT_SYMBOL),
73
+ getlocalv = 70,// ArgumentType.ARGUMENT_NUMBER, ArgumentType.ARGUMENT_SYMBOL),
74
+ getsv = 71,// ArgumentType.ARGUMENT_SYMBOL),
75
75
  invokemz = 72,
76
76
  aputvdup = 73,
77
- argcincsp = 74,
77
+ argcincsp = 74,// ArgumentType.ARGUMENT_NUMBER, ArgumentType.ARGUMENT_NUMBER),
78
78
  isnotnull = 75
79
79
  }
80
80
  interface BaseOpcode {
@@ -1,8 +1,6 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import * as crypto from "node:crypto";
4
2
  import { Context } from "./bytecode";
5
- export declare function getPrgSignature(context: Context): Buffer | undefined;
3
+ export declare function getPrgSignature(context: Context): Buffer<ArrayBuffer> | undefined;
6
4
  export declare function getDevKey(file: string): Promise<crypto.KeyObject>;
7
- export declare function signatureFromContext(context: Context, method?: string): Buffer | null;
8
- export declare function signView(key: crypto.KeyObject, view: DataView, method?: string): Buffer;
5
+ export declare function signatureFromContext(context: Context, method?: string): NonSharedBuffer | null;
6
+ export declare function signView(key: crypto.KeyObject, view: DataView, method?: string): NonSharedBuffer;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { xmlUtil } from "../sdk-util";
3
2
  export declare class SymbolTable {
4
3
  symbolToLabelMap: Map<number, number>;
@@ -11,7 +10,7 @@ export declare class SymbolTable {
11
10
  id: number | null;
12
11
  argc: number | null;
13
12
  }>;
14
- decoder: import("util").TextDecoder;
13
+ decoder: import("node:util").TextDecoder;
15
14
  parseSymbolTable(view: DataView): number;
16
15
  parse(view: DataView): void;
17
16
  parseXml(debugXml: xmlUtil.Document): void;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as crypto from "node:crypto";
3
2
  import { BuildConfig } from "./optimizer-types";
4
3
  import { SectionInfo } from "./readprg/bytecode";
@@ -6,19 +5,22 @@ export declare function readPrg(path: string): Promise<{
6
5
  [k: string]: number;
7
6
  }>;
8
7
  export declare function readPrgFromFile(prg: string): Promise<{
9
- view: DataView;
8
+ view: DataView<ArrayBufferLike>;
10
9
  sections: Record<number, SectionInfo>;
11
10
  }>;
12
11
  export declare function readPrgWithOffsets(view: DataView): {
13
- view: DataView;
12
+ view: DataView<ArrayBufferLike>;
14
13
  sections: Record<number, SectionInfo>;
15
14
  };
16
- export declare function optimizeProgram(filepath: string, devKey?: string | undefined, output?: string, config?: BuildConfig): Promise<unknown>;
15
+ export declare function optimizeProgram(filepath: string, devKey?: string | undefined, output?: string, config?: BuildConfig): Promise<void | {
16
+ signature: Buffer<ArrayBuffer> | undefined;
17
+ output: string;
18
+ }>;
17
19
  export declare function optimizePrgAndDebug(prgName: string, prgBuffer: ArrayBuffer, prgOffset: number, prgLength: number, xmlName: string, xmlBuffer: ArrayBuffer, xmlOffset: number, xmlLength: number, key: crypto.KeyObject, config: BuildConfig | undefined): Promise<{
18
- sigBuffer: ArrayBufferLike | undefined;
20
+ sigBuffer: ArrayBuffer | undefined;
19
21
  sigOffset: number | undefined;
20
22
  sigLength: number | undefined;
21
- prgBuffer: ArrayBufferLike;
23
+ prgBuffer: ArrayBuffer;
22
24
  prgOffset: number;
23
25
  prgLength: number;
24
26
  debugXml: string;
@@ -1,3 +1,6 @@
1
- /// <reference types="node" />
2
- export declare function unzipYauzl(filepath: string, process: (fileName: string, data: Buffer) => void): Promise<void>;
3
- export declare function unzip7(filepath: string, process: (fileName: string, data: Buffer) => void): Promise<void>;
1
+ export type SevenZipHandler = {
2
+ refresh: (filename: string, data?: Buffer) => void;
3
+ writeArchive: (filepath: string, t?: string) => void;
4
+ };
5
+ export declare function unzip7(filepath: string, destination: string): Promise<null>;
6
+ export declare function unzip7(filepath: string, process: (fileName: string, data: Buffer<ArrayBuffer>, refresh: (filename: string, data?: Buffer) => void) => void): Promise<SevenZipHandler>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as crypto from "node:crypto";
3
2
  import { JungleQualifier } from "./jungles";
4
3
  import { BuildConfig } from "./optimizer";
@@ -70,14 +69,14 @@ export declare const workerTaskHandlers: {
70
69
  }>;
71
70
  readonly generateOneConfig: (data: GenerateOneConfig["data"]) => Promise<{
72
71
  hasTests: boolean;
73
- diagnostics: Record<string, import("./optimizer-types").PreDiagnostic[]> | undefined;
72
+ diagnostics: import("./optimizer-types").ProgramState["diagnostics"];
74
73
  sdkVersion: number | undefined;
75
74
  }>;
76
75
  readonly optimizePrgAndDebug: (data: OptimizePrgAndDebug["data"]) => Promise<{
77
- sigBuffer: ArrayBufferLike | undefined;
76
+ sigBuffer: ArrayBuffer | undefined;
78
77
  sigOffset: number | undefined;
79
78
  sigLength: number | undefined;
80
- prgBuffer: ArrayBufferLike;
79
+ prgBuffer: ArrayBuffer;
81
80
  prgOffset: number;
82
81
  prgLength: number;
83
82
  debugXml: string;
package/build/util.cjs CHANGED
@@ -18,35 +18,35 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var util_exports = {};
20
20
  __export(util_exports, {
21
- AwaitedError: () => import_chunk_KHQPCXSJ.AwaitedError,
22
- GenericQueue: () => import_chunk_KHQPCXSJ.GenericQueue,
23
- bumpLogging: () => import_chunk_KHQPCXSJ.bumpLogging,
24
- copyRecursiveAsNeeded: () => import_chunk_KHQPCXSJ.copyRecursiveAsNeeded,
25
- every: () => import_chunk_KHQPCXSJ.every,
26
- first_modified: () => import_chunk_KHQPCXSJ.first_modified,
27
- forEach: () => import_chunk_KHQPCXSJ.forEach,
28
- globSome: () => import_chunk_KHQPCXSJ.globSome,
29
- globa: () => import_chunk_KHQPCXSJ.globa,
30
- last_modified: () => import_chunk_KHQPCXSJ.last_modified,
31
- log: () => import_chunk_KHQPCXSJ.log,
32
- logPromise: () => import_chunk_KHQPCXSJ.logPromise,
33
- logger: () => import_chunk_KHQPCXSJ.logger,
34
- map: () => import_chunk_KHQPCXSJ.map,
35
- popcount: () => import_chunk_KHQPCXSJ.popcount,
36
- promiseAll: () => import_chunk_KHQPCXSJ.promiseAll,
37
- pushUnique: () => import_chunk_KHQPCXSJ.pushUnique,
38
- readByLine: () => import_chunk_KHQPCXSJ.readByLine,
39
- reduce: () => import_chunk_KHQPCXSJ.reduce,
40
- sameArrays: () => import_chunk_KHQPCXSJ.sameArrays,
41
- setBanner: () => import_chunk_KHQPCXSJ.setBanner,
42
- some: () => import_chunk_KHQPCXSJ.some,
43
- spawnByLine: () => import_chunk_KHQPCXSJ.spawnByLine,
44
- wouldLog: () => import_chunk_KHQPCXSJ.wouldLog
21
+ AwaitedError: () => import_chunk_IJS7AYMN.AwaitedError,
22
+ GenericQueue: () => import_chunk_IJS7AYMN.GenericQueue,
23
+ bumpLogging: () => import_chunk_IJS7AYMN.bumpLogging,
24
+ copyRecursiveAsNeeded: () => import_chunk_IJS7AYMN.copyRecursiveAsNeeded,
25
+ every: () => import_chunk_IJS7AYMN.every,
26
+ first_modified: () => import_chunk_IJS7AYMN.first_modified,
27
+ forEach: () => import_chunk_IJS7AYMN.forEach,
28
+ globSome: () => import_chunk_IJS7AYMN.globSome,
29
+ globa: () => import_chunk_IJS7AYMN.globa,
30
+ last_modified: () => import_chunk_IJS7AYMN.last_modified,
31
+ log: () => import_chunk_IJS7AYMN.log,
32
+ logPromise: () => import_chunk_IJS7AYMN.logPromise,
33
+ logger: () => import_chunk_IJS7AYMN.logger,
34
+ map: () => import_chunk_IJS7AYMN.map,
35
+ popcount: () => import_chunk_IJS7AYMN.popcount,
36
+ promiseAll: () => import_chunk_IJS7AYMN.promiseAll,
37
+ pushUnique: () => import_chunk_IJS7AYMN.pushUnique,
38
+ readByLine: () => import_chunk_IJS7AYMN.readByLine,
39
+ reduce: () => import_chunk_IJS7AYMN.reduce,
40
+ sameArrays: () => import_chunk_IJS7AYMN.sameArrays,
41
+ setBanner: () => import_chunk_IJS7AYMN.setBanner,
42
+ some: () => import_chunk_IJS7AYMN.some,
43
+ spawnByLine: () => import_chunk_IJS7AYMN.spawnByLine,
44
+ wouldLog: () => import_chunk_IJS7AYMN.wouldLog
45
45
  });
46
46
  module.exports = __toCommonJS(util_exports);
47
- var import_chunk_KHQPCXSJ = require("./chunk-KHQPCXSJ.cjs");
47
+ var import_chunk_IJS7AYMN = require("./chunk-IJS7AYMN.cjs");
48
48
  var import_chunk_VS2QQHAK = require("./chunk-VS2QQHAK.cjs");
49
- (0, import_chunk_KHQPCXSJ.init_util)();
49
+ (0, import_chunk_IJS7AYMN.init_util)();
50
50
  // Annotate the CommonJS export names for ESM import in node:
51
51
  0 && (module.exports = {
52
52
  AwaitedError,
@@ -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 import_chunk_OCIRSLOJ = require("./chunk-OCIRSLOJ.cjs");
25
- var import_chunk_KHQPCXSJ = require("./chunk-KHQPCXSJ.cjs");
24
+ var import_chunk_BPXB3WQQ = require("./chunk-BPXB3WQQ.cjs");
25
+ var import_chunk_IJS7AYMN = require("./chunk-IJS7AYMN.cjs");
26
26
  var import_chunk_UBAYZSM3 = require("./chunk-UBAYZSM3.cjs");
27
27
  var import_chunk_VS2QQHAK = require("./chunk-VS2QQHAK.cjs");
28
28
  var import_node_worker_threads = require("node:worker_threads");
29
29
  var require_worker_thread = (0, import_chunk_VS2QQHAK.__commonJS)({
30
30
  "src/worker-thread.ts"() {
31
- (0, import_chunk_OCIRSLOJ.init_worker_task)();
31
+ (0, import_chunk_BPXB3WQQ.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, import_chunk_OCIRSLOJ.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_BPXB3WQQ.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.91",
4
+ "version": "1.1.93",
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.61",
59
+ "@markw65/prettier-plugin-monkeyc": "^1.0.64",
60
60
  "7z-wasm": "^1.2.0"
61
61
  },
62
62
  "devDependencies": {
@@ -64,25 +64,22 @@
64
64
  "@types/chai": "^4.3.4",
65
65
  "@types/glob": "^8.0.0",
66
66
  "@types/mocha": "^10.0.1",
67
- "@types/prettier": "^2.6.1",
68
67
  "@types/priorityqueuejs": "^1.0.1",
69
- "@types/yauzl": "^2.10.0",
70
- "@types/yazl": "^2.4.2",
71
68
  "@typescript-eslint/eslint-plugin": "^5.28.0",
72
69
  "@typescript-eslint/parser": "^5.28.0",
73
70
  "chai": "^4.3.7",
74
71
  "esbuild": "^0.25.8",
75
72
  "eslint": "^8.12.0",
76
- "extract-zip": "^2.0.1",
77
73
  "fast-glob": "^3.2.12",
78
74
  "mocha": "^10.2.0",
79
75
  "peggy": "^3.0.2",
80
- "prettier": "^2.6.2",
76
+ "prettier": "^3.8.1",
81
77
  "prettier-plugin-pegjs": "^1.0.1",
82
78
  "priorityqueuejs": "^2.0.0",
83
- "typescript": "^5.0.4",
84
- "yauzl": "^2.10.0",
85
- "yazl": "^2.5.1"
79
+ "typescript": "^5.0.4"
80
+ },
81
+ "prettier": {
82
+ "trailingComma": "es5"
86
83
  },
87
84
  "repository": {
88
85
  "type": "git",