@markw65/monkeyc-optimizer 1.1.26 → 1.1.28
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 +21 -1
- package/bin/cft-font-info.js +63 -0
- package/build/api.cjs +36 -34
- package/build/cftinfo.cjs +112 -0
- package/build/chunk-ABYVSU2C.cjs +74 -0
- package/build/chunk-MBTLUWXR.cjs +375 -0
- package/build/{chunk-YZ44IUV6.cjs → chunk-PVBIKZYZ.cjs} +105 -153
- package/build/{chunk-XO53WBWQ.cjs → chunk-ZI7CGRJC.cjs} +630 -902
- package/build/optimizer.cjs +21 -19
- package/build/sdk-util.cjs +17 -15
- package/build/src/cftinfo.d.ts +32 -0
- package/build/src/mc-rewrite.d.ts +4 -1
- package/build/src/optimizer.d.ts +1 -0
- package/build/src/projects.d.ts +2 -1
- package/build/src/type-flow/interp.d.ts +1 -0
- package/build/src/worker-task.d.ts +1 -0
- package/build/util.cjs +25 -24
- package/build/worker-thread.cjs +7 -5
- package/package.json +6 -2
package/build/optimizer.cjs
CHANGED
|
@@ -18,27 +18,29 @@ 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: () =>
|
|
23
|
-
copyRecursiveAsNeeded: () =>
|
|
24
|
-
defaultConfig: () =>
|
|
25
|
-
display: () =>
|
|
26
|
-
generateApiMirTests: () =>
|
|
27
|
-
generateOneConfig: () =>
|
|
28
|
-
generateOptimizedProject: () =>
|
|
29
|
-
getConfig: () =>
|
|
30
|
-
getProjectAnalysis: () =>
|
|
31
|
-
get_jungle: () =>
|
|
32
|
-
isErrorWithLocation: () =>
|
|
33
|
-
launchSimulator: () =>
|
|
34
|
-
manifestProducts: () =>
|
|
35
|
-
mctree: () =>
|
|
36
|
-
simulateProgram: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_ZI7CGRJC.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_ZI7CGRJC.buildOptimizedProject,
|
|
23
|
+
copyRecursiveAsNeeded: () => import_chunk_PVBIKZYZ.copyRecursiveAsNeeded,
|
|
24
|
+
defaultConfig: () => import_chunk_ZI7CGRJC.defaultConfig,
|
|
25
|
+
display: () => import_chunk_ZI7CGRJC.display,
|
|
26
|
+
generateApiMirTests: () => import_chunk_ZI7CGRJC.generateApiMirTests,
|
|
27
|
+
generateOneConfig: () => import_chunk_ZI7CGRJC.generateOneConfig,
|
|
28
|
+
generateOptimizedProject: () => import_chunk_ZI7CGRJC.generateOptimizedProject,
|
|
29
|
+
getConfig: () => import_chunk_ZI7CGRJC.getConfig,
|
|
30
|
+
getProjectAnalysis: () => import_chunk_ZI7CGRJC.getProjectAnalysis,
|
|
31
|
+
get_jungle: () => import_chunk_ZI7CGRJC.get_jungle,
|
|
32
|
+
isErrorWithLocation: () => import_chunk_ZI7CGRJC.isErrorWithLocation,
|
|
33
|
+
launchSimulator: () => import_chunk_ZI7CGRJC.launchSimulator,
|
|
34
|
+
manifestProducts: () => import_chunk_ZI7CGRJC.manifestProducts,
|
|
35
|
+
mctree: () => import_chunk_ZI7CGRJC.mctree,
|
|
36
|
+
simulateProgram: () => import_chunk_ZI7CGRJC.simulateProgram
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(optimizer_exports);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
(
|
|
39
|
+
var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
|
|
40
|
+
var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
|
|
41
|
+
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
42
|
+
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
43
|
+
(0, import_chunk_ZI7CGRJC.init_optimizer)();
|
|
42
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
45
|
0 && (module.exports = {
|
|
44
46
|
StateNodeAttributes,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -18,23 +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_ZI7CGRJC.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_ZI7CGRJC.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_ZI7CGRJC.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_ZI7CGRJC.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_ZI7CGRJC.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_ZI7CGRJC.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_ZI7CGRJC.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_ZI7CGRJC.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_ZI7CGRJC.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_ZI7CGRJC.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_ZI7CGRJC.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_ZI7CGRJC.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
(
|
|
35
|
+
var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
|
|
36
|
+
var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
|
|
37
|
+
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
38
|
+
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
39
|
+
(0, import_chunk_ZI7CGRJC.init_sdk_util)();
|
|
38
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
41
|
0 && (module.exports = {
|
|
40
42
|
SectionKinds,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function getCFTFontInfoFromBuffer(name: string, data: Buffer): {
|
|
3
|
+
name: string;
|
|
4
|
+
height: number;
|
|
5
|
+
ascent: number;
|
|
6
|
+
internalLeading: number;
|
|
7
|
+
charInfo: {
|
|
8
|
+
code: number;
|
|
9
|
+
char: string;
|
|
10
|
+
width: number;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export declare function getCFTFontInfo(filename: string): Promise<{
|
|
14
|
+
name: string;
|
|
15
|
+
height: number;
|
|
16
|
+
ascent: number;
|
|
17
|
+
internalLeading: number;
|
|
18
|
+
charInfo: {
|
|
19
|
+
code: number;
|
|
20
|
+
char: string;
|
|
21
|
+
width: number;
|
|
22
|
+
}[];
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getDeviceFontInfo(dirname: string): Promise<{
|
|
25
|
+
device: string;
|
|
26
|
+
fontSets: {
|
|
27
|
+
[k: string]: {
|
|
28
|
+
[k: string]: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
langMap: Record<string, string>;
|
|
32
|
+
}>;
|
|
@@ -7,4 +7,7 @@ export declare function getFileASTs(fnMap: FilesToOptimizeMap): Promise<boolean>
|
|
|
7
7
|
export declare function analyze(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document | undefined, config: BuildConfig): Promise<ProgramStateAnalysis>;
|
|
8
8
|
export declare function reportMissingSymbols(state: ProgramStateAnalysis, config?: BuildConfig): void;
|
|
9
9
|
export declare function getLiteralFromDecls(lookupDefns: LookupDefinition[]): mctree.Literal | mctree.AsExpression | null;
|
|
10
|
-
export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document, config: BuildConfig): Promise<
|
|
10
|
+
export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap, resourcesMap: Record<string, JungleResourceMap>, manifestXML: xmlUtil.Document, config: BuildConfig): Promise<{
|
|
11
|
+
diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
|
|
12
|
+
sdkVersion: number | undefined;
|
|
13
|
+
}>;
|
package/build/src/optimizer.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export type Analysis = {
|
|
|
89
89
|
export declare function generateOneConfig(buildConfig: JungleQualifier, manifestXML: xmlUtil.Document, dependencyFiles: string[], config: BuildConfig): Promise<{
|
|
90
90
|
hasTests: boolean;
|
|
91
91
|
diagnostics: ProgramState["diagnostics"];
|
|
92
|
+
sdkVersion: number | undefined;
|
|
92
93
|
}>;
|
|
93
94
|
export declare function getProjectAnalysis(targets: Target[], analysis: PreAnalysis | null, manifestXML: xmlUtil.Document, options: BuildConfig): Promise<Analysis | PreAnalysis>;
|
|
94
95
|
/**
|
package/build/src/projects.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type RemoteProject = string | {
|
|
|
13
13
|
sourcePath?: string;
|
|
14
14
|
jungleContent?: string[];
|
|
15
15
|
garminOptLevel?: number;
|
|
16
|
-
test?: boolean;
|
|
16
|
+
test?: boolean | string[];
|
|
17
17
|
};
|
|
18
18
|
export declare const githubProjects: RemoteProject[];
|
|
19
19
|
export declare function fetchGitProjects(projects: RemoteProject[], testOnly: boolean, skipRemote: boolean): Promise<(string | {
|
|
@@ -21,4 +21,5 @@ export declare function fetchGitProjects(projects: RemoteProject[], testOnly: bo
|
|
|
21
21
|
build: boolean | null;
|
|
22
22
|
options: BuildConfig | null;
|
|
23
23
|
garminOptLevel: number | null;
|
|
24
|
+
products: string[] | null;
|
|
24
25
|
})[]>;
|
|
@@ -11,6 +11,7 @@ export type InterpState = {
|
|
|
11
11
|
state: ProgramStateAnalysis;
|
|
12
12
|
stack: InterpStackElem[];
|
|
13
13
|
typeMap?: TypeMap;
|
|
14
|
+
localLvals?: Set<mctree.Node>;
|
|
14
15
|
func?: FunctionStateNode;
|
|
15
16
|
pre?: (node: mctree.Node) => mctree.Node | false | null | void;
|
|
16
17
|
post?: (node: mctree.Node) => mctree.Node | false | null | void;
|
|
@@ -70,6 +70,7 @@ export declare const workerTaskHandlers: {
|
|
|
70
70
|
readonly generateOneConfig: (data: GenerateOneConfig["data"]) => Promise<{
|
|
71
71
|
hasTests: boolean;
|
|
72
72
|
diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
|
|
73
|
+
sdkVersion: number | undefined;
|
|
73
74
|
}>;
|
|
74
75
|
readonly optimizePrgAndDebug: (data: OptimizePrgAndDebug["data"]) => Promise<{
|
|
75
76
|
sigBuffer: ArrayBufferLike | undefined;
|
package/build/util.cjs
CHANGED
|
@@ -18,32 +18,33 @@ 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
|
-
GenericQueue: () =>
|
|
22
|
-
bumpLogging: () =>
|
|
23
|
-
copyRecursiveAsNeeded: () =>
|
|
24
|
-
every: () =>
|
|
25
|
-
first_modified: () =>
|
|
26
|
-
forEach: () =>
|
|
27
|
-
globSome: () =>
|
|
28
|
-
globa: () =>
|
|
29
|
-
last_modified: () =>
|
|
30
|
-
log: () =>
|
|
31
|
-
logger: () =>
|
|
32
|
-
map: () =>
|
|
33
|
-
popcount: () =>
|
|
34
|
-
promiseAll: () =>
|
|
35
|
-
pushUnique: () =>
|
|
36
|
-
readByLine: () =>
|
|
37
|
-
reduce: () =>
|
|
38
|
-
sameArrays: () =>
|
|
39
|
-
setBanner: () =>
|
|
40
|
-
some: () =>
|
|
41
|
-
spawnByLine: () =>
|
|
42
|
-
wouldLog: () =>
|
|
21
|
+
GenericQueue: () => import_chunk_PVBIKZYZ.GenericQueue,
|
|
22
|
+
bumpLogging: () => import_chunk_PVBIKZYZ.bumpLogging,
|
|
23
|
+
copyRecursiveAsNeeded: () => import_chunk_PVBIKZYZ.copyRecursiveAsNeeded,
|
|
24
|
+
every: () => import_chunk_PVBIKZYZ.every,
|
|
25
|
+
first_modified: () => import_chunk_PVBIKZYZ.first_modified,
|
|
26
|
+
forEach: () => import_chunk_PVBIKZYZ.forEach,
|
|
27
|
+
globSome: () => import_chunk_PVBIKZYZ.globSome,
|
|
28
|
+
globa: () => import_chunk_PVBIKZYZ.globa,
|
|
29
|
+
last_modified: () => import_chunk_PVBIKZYZ.last_modified,
|
|
30
|
+
log: () => import_chunk_PVBIKZYZ.log,
|
|
31
|
+
logger: () => import_chunk_PVBIKZYZ.logger,
|
|
32
|
+
map: () => import_chunk_PVBIKZYZ.map,
|
|
33
|
+
popcount: () => import_chunk_PVBIKZYZ.popcount,
|
|
34
|
+
promiseAll: () => import_chunk_PVBIKZYZ.promiseAll,
|
|
35
|
+
pushUnique: () => import_chunk_PVBIKZYZ.pushUnique,
|
|
36
|
+
readByLine: () => import_chunk_PVBIKZYZ.readByLine,
|
|
37
|
+
reduce: () => import_chunk_PVBIKZYZ.reduce,
|
|
38
|
+
sameArrays: () => import_chunk_PVBIKZYZ.sameArrays,
|
|
39
|
+
setBanner: () => import_chunk_PVBIKZYZ.setBanner,
|
|
40
|
+
some: () => import_chunk_PVBIKZYZ.some,
|
|
41
|
+
spawnByLine: () => import_chunk_PVBIKZYZ.spawnByLine,
|
|
42
|
+
wouldLog: () => import_chunk_PVBIKZYZ.wouldLog
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(util_exports);
|
|
45
|
-
var
|
|
46
|
-
(
|
|
45
|
+
var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
|
|
46
|
+
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
47
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
47
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
49
|
0 && (module.exports = {
|
|
49
50
|
GenericQueue,
|
package/build/worker-thread.cjs
CHANGED
|
@@ -21,15 +21,17 @@ __export(worker_thread_exports, {
|
|
|
21
21
|
default: () => worker_thread_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(worker_thread_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
24
|
+
var import_chunk_ZI7CGRJC = require("./chunk-ZI7CGRJC.cjs");
|
|
25
|
+
var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
|
|
26
|
+
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
27
|
+
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
26
28
|
var import_node_worker_threads = require("node:worker_threads");
|
|
27
|
-
var require_worker_thread = (0,
|
|
29
|
+
var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
28
30
|
"src/worker-thread.ts"() {
|
|
29
|
-
(0,
|
|
31
|
+
(0, import_chunk_ZI7CGRJC.init_worker_task)();
|
|
30
32
|
if (import_node_worker_threads.parentPort) {
|
|
31
33
|
import_node_worker_threads.parentPort.on("message", async (task) => {
|
|
32
|
-
return import_node_worker_threads.parentPort.postMessage(await (0,
|
|
34
|
+
return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_ZI7CGRJC.performTask)(task));
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
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.
|
|
4
|
+
"version": "1.1.28",
|
|
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prettier-live": "test -z \"$(git status --untracked-files=no --porcelain || echo dirty)\" && npm install ../prettier-plugin-monkeyc && git commit -am 'prettier-plugin-monkeyc-live'",
|
|
21
21
|
"build-debug": "node esbuild.mjs",
|
|
22
22
|
"build-release": "node esbuild.mjs --release",
|
|
23
|
-
"prepack": "node esbuild.mjs --release",
|
|
23
|
+
"prepack": "node esbuild.mjs --release && mkdir -p bin && cp test/cft-font-info.js bin",
|
|
24
24
|
"test": "npm run test-mocha && npm run test-optimized && npm run test-unopt && npm run test-post-only && npm run test-remote && npm run test-remote-tests && npm run test-personality",
|
|
25
25
|
"test-mocha": "npx mocha --timeout 999999 build/mocha.cjs",
|
|
26
26
|
"test-remote": "node ./test/test.js --showInfo --postOptimize --product=pick-one --github",
|
|
@@ -32,12 +32,16 @@
|
|
|
32
32
|
"test-personality": "node test/test-personality.js",
|
|
33
33
|
"eslint": "npx eslint ."
|
|
34
34
|
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"cft-font-info": "bin/cft-font-info.js"
|
|
37
|
+
},
|
|
35
38
|
"files": [
|
|
36
39
|
"build/optimizer.cjs",
|
|
37
40
|
"build/util.cjs",
|
|
38
41
|
"build/sdk-util.cjs",
|
|
39
42
|
"build/api.cjs",
|
|
40
43
|
"build/worker-thread.cjs",
|
|
44
|
+
"build/cftinfo.cjs",
|
|
41
45
|
"build/chunk-*.cjs",
|
|
42
46
|
"build/src/**/*.d.ts"
|
|
43
47
|
],
|