@markw65/monkeyc-optimizer 1.0.10 → 1.0.13
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 +41 -0
- package/build/api.cjs +1333 -1066
- package/build/optimizer.cjs +2020 -2080
- package/build/sdk-util.cjs +33 -34
- package/build/src/api.d.ts +9 -0
- package/build/src/build.d.ts +6 -0
- package/build/src/estree-types.d.ts +324 -0
- package/build/src/jungles.d.ts +51 -0
- package/build/src/launch.d.ts +2 -0
- package/build/src/manifest.d.ts +71 -0
- package/build/src/mc-rewrite.d.ts +7 -0
- package/build/src/negative-fixups.d.ts +1 -0
- package/build/src/optimizer.d.ts +185 -0
- package/build/src/sdk-util.d.ts +15 -0
- package/build/src/util.d.ts +13 -0
- package/build/util.cjs +108 -108
- package/package.json +10 -3
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
|
+
import { get_jungle, ResolvedJungle, Target } from "./jungles";
|
|
3
|
+
import { launchSimulator, simulateProgram } from "./launch";
|
|
4
|
+
import { manifestProducts } from "./manifest";
|
|
5
|
+
import { copyRecursiveAsNeeded } from "./util";
|
|
6
|
+
export { copyRecursiveAsNeeded, get_jungle, launchSimulator, manifestProducts, mctree, ResolvedJungle, simulateProgram, };
|
|
7
|
+
export declare const defaultConfig: {
|
|
8
|
+
outputPath: string;
|
|
9
|
+
workspace: string;
|
|
10
|
+
};
|
|
11
|
+
export interface ErrorWithLocation extends Error {
|
|
12
|
+
location?: NonNullable<mctree.Node["loc"]>;
|
|
13
|
+
}
|
|
14
|
+
export declare function isErrorWithLocation(e: Error): e is ErrorWithLocation;
|
|
15
|
+
declare global {
|
|
16
|
+
type BuildConfig = {
|
|
17
|
+
workspace?: string;
|
|
18
|
+
jungleFiles?: string;
|
|
19
|
+
developerKeyPath?: string;
|
|
20
|
+
typeCheckLevel?: string;
|
|
21
|
+
compilerOptions?: string;
|
|
22
|
+
compilerWarnings?: boolean;
|
|
23
|
+
simulatorBuild?: boolean;
|
|
24
|
+
releaseBuild?: boolean;
|
|
25
|
+
testBuild?: boolean;
|
|
26
|
+
products?: string[];
|
|
27
|
+
buildDir?: string;
|
|
28
|
+
outputPath?: string;
|
|
29
|
+
program?: string;
|
|
30
|
+
skipOptimization?: boolean;
|
|
31
|
+
checkManifest?: boolean;
|
|
32
|
+
device?: string;
|
|
33
|
+
ignoredExcludeAnnotations?: string;
|
|
34
|
+
ignoredAnnotations?: string;
|
|
35
|
+
ignoredSourcePaths?: string;
|
|
36
|
+
returnCommand?: boolean;
|
|
37
|
+
_cache?: {
|
|
38
|
+
barrels?: Record<string, ResolvedJungle>;
|
|
39
|
+
barrelMap?: Record<string, Record<string, ResolvedJungle>>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type StateNodeDecl = StateNode | mctree.EnumStringMember | mctree.TypedIdentifier | mctree.EnumDeclaration | mctree.TypedefDeclaration | mctree.VariableDeclarator;
|
|
43
|
+
type StateNodeDecls = {
|
|
44
|
+
[key: string]: StateNodeDecl[];
|
|
45
|
+
};
|
|
46
|
+
type ProgramStateNode = {
|
|
47
|
+
type: "Program";
|
|
48
|
+
node: null | undefined;
|
|
49
|
+
name: "$";
|
|
50
|
+
fullName: "$";
|
|
51
|
+
decls?: StateNodeDecls;
|
|
52
|
+
stack?: null | undefined;
|
|
53
|
+
};
|
|
54
|
+
type ModuleStateNode = {
|
|
55
|
+
type: "ModuleDeclaration";
|
|
56
|
+
name: string;
|
|
57
|
+
fullName: string;
|
|
58
|
+
node: mctree.ModuleDeclaration;
|
|
59
|
+
stack?: ProgramStateStack;
|
|
60
|
+
decls?: StateNodeDecls;
|
|
61
|
+
};
|
|
62
|
+
type ClassStateNode = {
|
|
63
|
+
type: "ClassDeclaration";
|
|
64
|
+
name: string;
|
|
65
|
+
fullName: string;
|
|
66
|
+
node: mctree.ClassDeclaration;
|
|
67
|
+
decls?: StateNodeDecls;
|
|
68
|
+
stack?: ProgramStateStack;
|
|
69
|
+
superClass: ClassStateNode[] | true;
|
|
70
|
+
};
|
|
71
|
+
type FunctionStateNode = {
|
|
72
|
+
type: "FunctionDeclaration";
|
|
73
|
+
name: string;
|
|
74
|
+
fullName: string;
|
|
75
|
+
node: mctree.FunctionDeclaration;
|
|
76
|
+
stack?: ProgramStateStack;
|
|
77
|
+
decls?: undefined;
|
|
78
|
+
};
|
|
79
|
+
type BlockStateNode = {
|
|
80
|
+
type: "BlockStatement";
|
|
81
|
+
name?: null | undefined;
|
|
82
|
+
fullName?: null | undefined;
|
|
83
|
+
node: mctree.BlockStatement;
|
|
84
|
+
decls?: StateNodeDecls;
|
|
85
|
+
stack?: null | undefined;
|
|
86
|
+
};
|
|
87
|
+
type StateNode = ProgramStateNode | FunctionStateNode | BlockStateNode | ClassStateNode | ModuleStateNode;
|
|
88
|
+
type ProgramStateStack = StateNode[];
|
|
89
|
+
export type ProgramState = {
|
|
90
|
+
allFunctions?: FunctionStateNode[];
|
|
91
|
+
allClasses?: ClassStateNode[];
|
|
92
|
+
stack?: ProgramStateStack;
|
|
93
|
+
shouldExclude?: (node: any) => any;
|
|
94
|
+
pre?: (node: mctree.Node, state: ProgramStateLive) => null | false | (keyof mctree.NodeAll)[];
|
|
95
|
+
post?: (node: mctree.Node, state: ProgramStateLive) => null | false | mctree.Node;
|
|
96
|
+
lookup?: (node: mctree.Node, name?: string | null, stack?: ProgramStateStack) => [string, StateNodeDecl[], ProgramStateStack] | [null, null, null];
|
|
97
|
+
traverse?: (node: mctree.Node) => void | null | false | mctree.Node;
|
|
98
|
+
exposed?: {
|
|
99
|
+
[key: string]: true;
|
|
100
|
+
};
|
|
101
|
+
calledFunctions?: {
|
|
102
|
+
[key: string]: unknown[];
|
|
103
|
+
};
|
|
104
|
+
localsStack?: {
|
|
105
|
+
node?: mctree.Node;
|
|
106
|
+
map?: {
|
|
107
|
+
[key: string]: true | string;
|
|
108
|
+
};
|
|
109
|
+
inners?: {
|
|
110
|
+
[key: string]: true;
|
|
111
|
+
};
|
|
112
|
+
}[];
|
|
113
|
+
index?: {
|
|
114
|
+
[key: string]: unknown[];
|
|
115
|
+
};
|
|
116
|
+
constants?: {
|
|
117
|
+
[key: string]: mctree.Literal;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
type Finalized<T, Keys extends keyof T> = T & {
|
|
121
|
+
[key in Keys]-?: NonNullable<T[key]>;
|
|
122
|
+
};
|
|
123
|
+
export type ProgramStateLive = Finalized<ProgramState, "stack" | "lookup" | "traverse" | "index" | "constants">;
|
|
124
|
+
export type ProgramStateAnalysis = Finalized<ProgramStateLive, "allClasses" | "allFunctions">;
|
|
125
|
+
export type ProgramStateOptimizer = Finalized<ProgramStateAnalysis, "localsStack" | "exposed" | "calledFunctions">;
|
|
126
|
+
type ExcludeAnnotationsMap = {
|
|
127
|
+
[key: string]: boolean;
|
|
128
|
+
};
|
|
129
|
+
type FilesToOptimizeMap = {
|
|
130
|
+
[key: string]: {
|
|
131
|
+
output: string;
|
|
132
|
+
excludeAnnotations: ExcludeAnnotationsMap;
|
|
133
|
+
monkeyCSource?: string;
|
|
134
|
+
ast?: mctree.Program;
|
|
135
|
+
parserError?: Error;
|
|
136
|
+
hasTests?: boolean;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
var lastModifiedSource: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param {string | null} product
|
|
144
|
+
* @param {BuildConfig} options
|
|
145
|
+
* @returns
|
|
146
|
+
*/
|
|
147
|
+
export declare function buildOptimizedProject(product: string | null, options: BuildConfig): Promise<{
|
|
148
|
+
exe: string;
|
|
149
|
+
args: string[];
|
|
150
|
+
program: string;
|
|
151
|
+
product: string | null;
|
|
152
|
+
hasTests: boolean | undefined;
|
|
153
|
+
}>;
|
|
154
|
+
export declare function generateOptimizedProject(options: BuildConfig): Promise<{
|
|
155
|
+
jungleFiles: string | undefined;
|
|
156
|
+
program: string;
|
|
157
|
+
xml?: undefined;
|
|
158
|
+
hasTests?: undefined;
|
|
159
|
+
} | {
|
|
160
|
+
jungleFiles: string;
|
|
161
|
+
xml: import("./manifest").ManifestXML;
|
|
162
|
+
program: string;
|
|
163
|
+
hasTests: boolean;
|
|
164
|
+
}>;
|
|
165
|
+
export declare type PreAnalysis = {
|
|
166
|
+
fnMap: FilesToOptimizeMap;
|
|
167
|
+
paths: string[];
|
|
168
|
+
};
|
|
169
|
+
declare type RequiredNonNull<T> = {
|
|
170
|
+
[K1 in keyof T]-?: {
|
|
171
|
+
[K2 in keyof T[K1]]-?: NonNullable<T[K1][K2]>;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
export declare type Analysis = {
|
|
175
|
+
fnMap: RequiredNonNull<FilesToOptimizeMap>;
|
|
176
|
+
paths: string[];
|
|
177
|
+
state: ProgramState;
|
|
178
|
+
};
|
|
179
|
+
export declare function getProjectAnalysis(targets: Target[], analysis: PreAnalysis | null, options: BuildConfig): Promise<Analysis | PreAnalysis>;
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {BuildConfig} options
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
export declare function generateApiMirTests(options: BuildConfig): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const isWin: boolean;
|
|
2
|
+
export declare const appSupport: string;
|
|
3
|
+
export declare const connectiq: string;
|
|
4
|
+
export declare function getSdkPath(): Promise<string>;
|
|
5
|
+
export declare function getDeviceInfo(): Promise<{
|
|
6
|
+
[key: string]: {
|
|
7
|
+
appTypes: {
|
|
8
|
+
memoryLimit: number;
|
|
9
|
+
type: string;
|
|
10
|
+
}[];
|
|
11
|
+
deviceFamily: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export declare function getLanguages(): Promise<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as glob from "glob";
|
|
2
|
+
export declare function globa(pattern: string, options?: glob.IOptions): Promise<Array<string>>;
|
|
3
|
+
export declare function last_modified(inputs: string[]): Promise<number>;
|
|
4
|
+
export declare function first_modified(inputs: string[]): Promise<number>;
|
|
5
|
+
export declare function pushUnique<T>(arr: T[], value: T): void;
|
|
6
|
+
declare type LineHandler = (line: string) => void;
|
|
7
|
+
export declare function spawnByLine(command: string, args: string[], lineHandlers: LineHandler | LineHandler[], options?: {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function readByLine(file: string, lineHandler: LineHandler): Promise<unknown>;
|
|
11
|
+
export declare function promiseAll<T>(promiseFn: (i: number) => Promise<T>, parallelism: number): Promise<T[]>;
|
|
12
|
+
export declare function copyRecursiveAsNeeded(source: string, target: string, filter?: (src: string, tgt: string) => boolean): Promise<void>;
|
|
13
|
+
export {};
|
package/build/util.cjs
CHANGED
|
@@ -3952,6 +3952,18 @@ module.exports = require("util");
|
|
|
3952
3952
|
/******/ };
|
|
3953
3953
|
/******/ })();
|
|
3954
3954
|
/******/
|
|
3955
|
+
/******/ /* webpack/runtime/global */
|
|
3956
|
+
/******/ (() => {
|
|
3957
|
+
/******/ __webpack_require__.g = (function() {
|
|
3958
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
3959
|
+
/******/ try {
|
|
3960
|
+
/******/ return this || new Function('return this')();
|
|
3961
|
+
/******/ } catch (e) {
|
|
3962
|
+
/******/ if (typeof window === 'object') return window;
|
|
3963
|
+
/******/ }
|
|
3964
|
+
/******/ })();
|
|
3965
|
+
/******/ })();
|
|
3966
|
+
/******/
|
|
3955
3967
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3956
3968
|
/******/ (() => {
|
|
3957
3969
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -4000,8 +4012,7 @@ var glob = __webpack_require__(2884);
|
|
|
4000
4012
|
var external_path_ = __webpack_require__(1423);
|
|
4001
4013
|
;// CONCATENATED MODULE: external "readline"
|
|
4002
4014
|
const external_readline_namespaceObject = require("readline");
|
|
4003
|
-
;// CONCATENATED MODULE: ./src/util.
|
|
4004
|
-
|
|
4015
|
+
;// CONCATENATED MODULE: ./src/util.ts
|
|
4005
4016
|
|
|
4006
4017
|
|
|
4007
4018
|
|
|
@@ -4010,143 +4021,132 @@ const external_readline_namespaceObject = require("readline");
|
|
|
4010
4021
|
|
|
4011
4022
|
// Write it this way so that webpack.DefinePlugin doesn't
|
|
4012
4023
|
// recognize global.lastModifiedSource.
|
|
4013
|
-
|
|
4014
|
-
|
|
4024
|
+
// @ts-ignore
|
|
4025
|
+
__webpack_require__.g["lastModifiedSource" + ""] = 0;
|
|
4015
4026
|
function globa(pattern, options) {
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4027
|
+
return new Promise((resolve, reject) => {
|
|
4028
|
+
glob.glob(pattern, options || {}, (er, files) => {
|
|
4029
|
+
if (er) {
|
|
4030
|
+
reject(files);
|
|
4031
|
+
}
|
|
4032
|
+
else {
|
|
4033
|
+
resolve(files);
|
|
4034
|
+
}
|
|
4035
|
+
});
|
|
4023
4036
|
});
|
|
4024
|
-
});
|
|
4025
4037
|
}
|
|
4026
|
-
|
|
4027
4038
|
async function modified_times(inputs, missing) {
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
})
|
|
4037
|
-
);
|
|
4039
|
+
return Promise.all(inputs.map(async (path) => {
|
|
4040
|
+
try {
|
|
4041
|
+
const stat = await promises_namespaceObject.stat(path);
|
|
4042
|
+
return stat.mtimeMs;
|
|
4043
|
+
}
|
|
4044
|
+
catch (e) {
|
|
4045
|
+
return missing;
|
|
4046
|
+
}
|
|
4047
|
+
}));
|
|
4038
4048
|
}
|
|
4039
|
-
|
|
4040
4049
|
async function last_modified(inputs) {
|
|
4041
|
-
|
|
4050
|
+
return Math.max(...(await modified_times(inputs, Infinity)));
|
|
4042
4051
|
}
|
|
4043
|
-
|
|
4044
4052
|
async function first_modified(inputs) {
|
|
4045
|
-
|
|
4053
|
+
return Math.min(...(await modified_times(inputs, 0)));
|
|
4046
4054
|
}
|
|
4047
|
-
|
|
4048
4055
|
function pushUnique(arr, value) {
|
|
4049
|
-
|
|
4050
|
-
|
|
4056
|
+
if (arr.find((v) => v === value) != null)
|
|
4057
|
+
return;
|
|
4058
|
+
arr.push(value);
|
|
4051
4059
|
}
|
|
4052
|
-
|
|
4053
4060
|
// return a promise that will process the output of command
|
|
4054
4061
|
// line-by-line via lineHandlers.
|
|
4055
4062
|
function spawnByLine(command, args, lineHandlers, options) {
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4063
|
+
const [lineHandler, errHandler] = Array.isArray(lineHandlers)
|
|
4064
|
+
? lineHandlers
|
|
4065
|
+
: [lineHandlers, (line) => console.error(line)];
|
|
4066
|
+
return new Promise((resolve, reject) => {
|
|
4067
|
+
const proc = external_child_process_namespaceObject.spawn(command, args, {
|
|
4068
|
+
...(options || {}),
|
|
4069
|
+
shell: false,
|
|
4070
|
+
});
|
|
4071
|
+
const rl = external_readline_namespaceObject.createInterface({
|
|
4072
|
+
input: proc.stdout,
|
|
4073
|
+
});
|
|
4074
|
+
const rle = external_readline_namespaceObject.createInterface({
|
|
4075
|
+
input: proc.stderr,
|
|
4076
|
+
});
|
|
4077
|
+
proc.on("error", reject);
|
|
4078
|
+
rle.on("line", errHandler);
|
|
4079
|
+
rl.on("line", lineHandler);
|
|
4080
|
+
proc.on("close", (code) => {
|
|
4081
|
+
if (code == 0)
|
|
4082
|
+
resolve();
|
|
4083
|
+
reject(code);
|
|
4084
|
+
});
|
|
4076
4085
|
});
|
|
4077
|
-
});
|
|
4078
4086
|
}
|
|
4079
|
-
|
|
4080
4087
|
// return a promise that will process file
|
|
4081
4088
|
// line-by-line via lineHandler.
|
|
4082
4089
|
function readByLine(file, lineHandler) {
|
|
4083
|
-
|
|
4084
|
-
(fh) =>
|
|
4085
|
-
new Promise((resolve, _reject) => {
|
|
4090
|
+
return promises_namespaceObject.open(file, "r").then((fh) => new Promise((resolve, _reject) => {
|
|
4086
4091
|
const stream = fh.createReadStream();
|
|
4087
4092
|
const rl = external_readline_namespaceObject.createInterface({
|
|
4088
|
-
|
|
4093
|
+
input: stream,
|
|
4089
4094
|
});
|
|
4090
4095
|
rl.on("line", lineHandler);
|
|
4091
4096
|
stream.on("close", resolve);
|
|
4092
|
-
|
|
4093
|
-
);
|
|
4097
|
+
}));
|
|
4094
4098
|
}
|
|
4095
|
-
|
|
4096
4099
|
async function promiseAll(promiseFn, parallelism) {
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4100
|
+
parallelism = parallelism || 4;
|
|
4101
|
+
const serializer = [];
|
|
4102
|
+
const results = [];
|
|
4103
|
+
let done = false;
|
|
4104
|
+
let i = 0;
|
|
4105
|
+
const next = () => {
|
|
4106
|
+
const index = i++;
|
|
4107
|
+
if (done)
|
|
4108
|
+
return null;
|
|
4109
|
+
const promise = promiseFn(index);
|
|
4110
|
+
if (!promise) {
|
|
4111
|
+
done = true;
|
|
4112
|
+
return null;
|
|
4113
|
+
}
|
|
4114
|
+
return promise
|
|
4115
|
+
.then((r) => {
|
|
4116
|
+
results[index] = r;
|
|
4117
|
+
})
|
|
4118
|
+
.then(next);
|
|
4119
|
+
};
|
|
4120
|
+
while (i < parallelism) {
|
|
4121
|
+
serializer.push(next());
|
|
4109
4122
|
}
|
|
4110
|
-
return
|
|
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);
|
|
4123
|
+
return Promise.all(serializer).then(() => results);
|
|
4120
4124
|
}
|
|
4121
|
-
|
|
4122
4125
|
async function copyRecursiveAsNeeded(source, target, filter) {
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
var tgt = external_path_.join(target, file);
|
|
4138
|
-
return copyRecursiveAsNeeded(src, tgt, filter);
|
|
4139
|
-
})
|
|
4140
|
-
);
|
|
4141
|
-
} else {
|
|
4142
|
-
if (filter && !filter(source, target)) {
|
|
4143
|
-
return;
|
|
4126
|
+
const fstat = promises_namespaceObject.stat;
|
|
4127
|
+
const sstat = await fstat(source);
|
|
4128
|
+
if (sstat.isDirectory()) {
|
|
4129
|
+
const stat = await fstat(target).catch(() => null);
|
|
4130
|
+
if (!stat || !stat.isDirectory()) {
|
|
4131
|
+
stat && (await promises_namespaceObject.rm(target, { force: true }));
|
|
4132
|
+
await promises_namespaceObject.mkdir(target, { recursive: true });
|
|
4133
|
+
}
|
|
4134
|
+
const files = await promises_namespaceObject.readdir(source);
|
|
4135
|
+
return Promise.all(files.map((file) => {
|
|
4136
|
+
var src = external_path_.join(source, file);
|
|
4137
|
+
var tgt = external_path_.join(target, file);
|
|
4138
|
+
return copyRecursiveAsNeeded(src, tgt, filter);
|
|
4139
|
+
})).then(() => { });
|
|
4144
4140
|
}
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4141
|
+
else {
|
|
4142
|
+
if (filter && !filter(source, target)) {
|
|
4143
|
+
return;
|
|
4144
|
+
}
|
|
4145
|
+
const tstat = await fstat(target).catch(() => null);
|
|
4146
|
+
if (!tstat || tstat.mtimeMs < sstat.mtimeMs) {
|
|
4147
|
+
return promises_namespaceObject.copyFile(source, target, external_fs_.constants.COPYFILE_FICLONE);
|
|
4148
|
+
}
|
|
4148
4149
|
}
|
|
4149
|
-
}
|
|
4150
4150
|
}
|
|
4151
4151
|
|
|
4152
4152
|
})();
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markw65/monkeyc-optimizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13",
|
|
5
5
|
"description": "Source to source optimizer for Garmin Monkey C code",
|
|
6
6
|
"main": "build/optimizer.cjs",
|
|
7
|
+
"types": "build/src/optimizer.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./build/optimizer.cjs",
|
|
9
10
|
"./*.js": "./build/*.cjs"
|
|
@@ -20,20 +21,26 @@
|
|
|
20
21
|
"build/optimizer.cjs",
|
|
21
22
|
"build/util.cjs",
|
|
22
23
|
"build/sdk-util.cjs",
|
|
23
|
-
"build/api.cjs"
|
|
24
|
+
"build/api.cjs",
|
|
25
|
+
"build/src/*.d.ts"
|
|
24
26
|
],
|
|
25
27
|
"author": "markw65",
|
|
26
28
|
"license": "MIT",
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@markw65/prettier-plugin-monkeyc": "^1.0.
|
|
30
|
+
"@markw65/prettier-plugin-monkeyc": "^1.0.20"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
33
|
+
"@types/glob": "^7.2.0",
|
|
34
|
+
"@types/prettier": "^2.6.1",
|
|
35
|
+
"@types/xml2js": "^0.4.11",
|
|
31
36
|
"eslint": "^8.12.0",
|
|
32
37
|
"extract-zip": "^2.0.1",
|
|
33
38
|
"glob": "^7.2.0",
|
|
34
39
|
"peggy": "^1.2.0",
|
|
35
40
|
"prettier": "^2.6.2",
|
|
36
41
|
"prettier-plugin-pegjs": "^0.5.0",
|
|
42
|
+
"ts-loader": "^9.3.0",
|
|
43
|
+
"typescript": "^4.6.4",
|
|
37
44
|
"webpack": "^5.72.0",
|
|
38
45
|
"webpack-cli": "^4.9.2",
|
|
39
46
|
"xml2js": "^0.4.23"
|