@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
package/build/sdk-util.cjs
CHANGED
|
@@ -7187,53 +7187,52 @@ const external_path_namespaceObject = require("path");
|
|
|
7187
7187
|
var xml2js = __webpack_require__(5055);
|
|
7188
7188
|
;// CONCATENATED MODULE: external "./util.cjs"
|
|
7189
7189
|
const external_util_cjs_namespaceObject = require("./util.cjs");
|
|
7190
|
-
;// CONCATENATED MODULE: ./src/sdk-util.
|
|
7191
|
-
|
|
7190
|
+
;// CONCATENATED MODULE: ./src/sdk-util.ts
|
|
7192
7191
|
|
|
7193
7192
|
|
|
7194
7193
|
|
|
7195
7194
|
|
|
7196
7195
|
const isWin = process.platform == "win32";
|
|
7197
|
-
|
|
7198
7196
|
const appSupport = isWin
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7197
|
+
? `${process.env.APPDATA}`.replace(/\\/g, "/")
|
|
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`;
|
|
7204
7204
|
function getSdkPath() {
|
|
7205
|
-
|
|
7206
|
-
|
|
7205
|
+
return promises_namespaceObject.readFile(connectiq + "/current-sdk.cfg")
|
|
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
|
+
});
|
|
7207
7210
|
}
|
|
7208
|
-
|
|
7209
7211
|
async function getDeviceInfo() {
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
})
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
});
|
|
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
|
+
}
|
|
7216
|
+
return Promise.all(files.map((file) => {
|
|
7217
|
+
return promises_namespaceObject.readFile(file).then((data) => {
|
|
7218
|
+
const { deviceId, appTypes, deviceFamily, displayName } = JSON.parse(data.toString());
|
|
7219
|
+
return [deviceId, { appTypes, deviceFamily, displayName }];
|
|
7220
|
+
});
|
|
7221
|
+
})).then((info) => {
|
|
7222
|
+
return Object.fromEntries(info);
|
|
7223
|
+
});
|
|
7223
7224
|
}
|
|
7224
|
-
|
|
7225
7225
|
async function getProjectInfo() {
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7226
|
+
const sdk = await getSdkPath();
|
|
7227
|
+
const data = await promises_namespaceObject.readFile(external_path_namespaceObject.join(sdk, "bin", "projectInfo.xml"));
|
|
7228
|
+
return (0,xml2js.parseStringPromise)(data.toString(), { trim: true });
|
|
7229
7229
|
}
|
|
7230
|
-
|
|
7231
7230
|
async function getLanguages() {
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7231
|
+
const projectInfo = await getProjectInfo();
|
|
7232
|
+
return projectInfo["monkeybrains"]["languages"][0]["language"].map((p) => ({
|
|
7233
|
+
id: p.$.id,
|
|
7234
|
+
name: p.$.name,
|
|
7235
|
+
}));
|
|
7237
7236
|
}
|
|
7238
7237
|
|
|
7239
7238
|
})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
|
+
export declare function getApiMapping(state?: ProgramState): Promise<ProgramStateNode | null>;
|
|
3
|
+
export declare function hasProperty<T extends null extends T ? unknown : undefined extends T ? unknown : never>(obj: T, prop: string): obj is NonNullable<T>;
|
|
4
|
+
export declare function hasProperty<T>(obj: T, prop: string): boolean;
|
|
5
|
+
export declare function isStateNode(node: StateNodeDecl): node is StateNode;
|
|
6
|
+
export declare function variableDeclarationName(node: mctree.TypedIdentifier): string;
|
|
7
|
+
export declare function collectNamespaces(ast: mctree.Program, stateIn?: ProgramState): ProgramStateNode;
|
|
8
|
+
export declare function traverseAst(node: mctree.Node, pre?: null | ((node: mctree.Node) => void | null | false | (keyof mctree.NodeAll)[]), post?: (node: mctree.Node) => void | null | false | mctree.Node): false | void | null | mctree.Node;
|
|
9
|
+
export declare function formatAst(node: mctree.Node, monkeyCSource?: string | null): string;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
declare type InclusiveUnionKeys<U> = U extends unknown ? keyof U : never;
|
|
2
|
+
declare type InclusiveUnion<U> = {
|
|
3
|
+
[K in InclusiveUnionKeys<U>]: U extends any ? K extends keyof U ? U[K] : never : never;
|
|
4
|
+
};
|
|
5
|
+
declare type SubfieldsOfType<T, U> = {
|
|
6
|
+
[K in keyof T as T[K] extends U ? K : never]: T[K];
|
|
7
|
+
};
|
|
8
|
+
export declare type NodeAll = InclusiveUnion<Node>;
|
|
9
|
+
export declare type NodeSubFields = SubfieldsOfType<NodeAll, Node>;
|
|
10
|
+
export declare type NodeSubArrays = SubfieldsOfType<NodeAll, Node[]>;
|
|
11
|
+
interface BaseNode {
|
|
12
|
+
type: string;
|
|
13
|
+
loc?: SourceLocation | null | undefined;
|
|
14
|
+
start?: number;
|
|
15
|
+
end?: number;
|
|
16
|
+
range?: [number, number] | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare type Node = Identifier | Literal | Program | SwitchCase | CatchClause | VariableDeclarator | EnumStringBody | EnumStringMember | Statement | Expression | Property | Declaration | ImportStatement | AsTypeSpec | TypeSpecList | ClassElement | ClassBody | Comment;
|
|
19
|
+
export interface Comment extends BaseNode {
|
|
20
|
+
type: "Line" | "Block";
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
interface SourceLocation {
|
|
24
|
+
source?: string | null | undefined;
|
|
25
|
+
start: Position;
|
|
26
|
+
end: Position;
|
|
27
|
+
}
|
|
28
|
+
export interface Position {
|
|
29
|
+
/** >= 1 */
|
|
30
|
+
line: number;
|
|
31
|
+
/** >= 0 */
|
|
32
|
+
column: number;
|
|
33
|
+
}
|
|
34
|
+
export interface Program extends BaseNode {
|
|
35
|
+
type: "Program";
|
|
36
|
+
body: Array<Declaration | ImportStatement>;
|
|
37
|
+
comments?: Array<Comment> | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface ModuleDeclaration extends BaseDeclaration {
|
|
40
|
+
type: "ModuleDeclaration";
|
|
41
|
+
body: Array<Declaration | ImportStatement>;
|
|
42
|
+
id: Identifier;
|
|
43
|
+
}
|
|
44
|
+
interface BaseFunction extends BaseNode {
|
|
45
|
+
params: Array<Identifier | AsExpression>;
|
|
46
|
+
body: BlockStatement;
|
|
47
|
+
}
|
|
48
|
+
export declare type Statement = ExpressionStatement | BlockStatement | ReturnStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | Declaration;
|
|
49
|
+
interface BaseStatement extends BaseNode {
|
|
50
|
+
}
|
|
51
|
+
export interface BlockStatement extends BaseStatement {
|
|
52
|
+
type: "BlockStatement";
|
|
53
|
+
body: Array<Statement>;
|
|
54
|
+
innerComments?: Array<Comment> | undefined;
|
|
55
|
+
}
|
|
56
|
+
export interface ExpressionStatement extends BaseStatement {
|
|
57
|
+
type: "ExpressionStatement";
|
|
58
|
+
expression: Expression;
|
|
59
|
+
}
|
|
60
|
+
export interface IfStatement extends BaseStatement {
|
|
61
|
+
type: "IfStatement";
|
|
62
|
+
test: Expression;
|
|
63
|
+
consequent: Statement;
|
|
64
|
+
alternate?: Statement | null | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface BreakStatement extends BaseStatement {
|
|
67
|
+
type: "BreakStatement";
|
|
68
|
+
}
|
|
69
|
+
export interface ContinueStatement extends BaseStatement {
|
|
70
|
+
type: "ContinueStatement";
|
|
71
|
+
}
|
|
72
|
+
export interface SwitchStatement extends BaseStatement {
|
|
73
|
+
type: "SwitchStatement";
|
|
74
|
+
discriminant: Expression;
|
|
75
|
+
cases: Array<SwitchCase>;
|
|
76
|
+
}
|
|
77
|
+
export interface ReturnStatement extends BaseStatement {
|
|
78
|
+
type: "ReturnStatement";
|
|
79
|
+
argument?: Expression | null | undefined;
|
|
80
|
+
}
|
|
81
|
+
export interface ThrowStatement extends BaseStatement {
|
|
82
|
+
type: "ThrowStatement";
|
|
83
|
+
argument: Expression;
|
|
84
|
+
}
|
|
85
|
+
export interface TryStatement extends BaseStatement {
|
|
86
|
+
type: "TryStatement";
|
|
87
|
+
block: BlockStatement;
|
|
88
|
+
handler?: CatchClause | CatchClauses | null | undefined;
|
|
89
|
+
finalizer?: BlockStatement | null | undefined;
|
|
90
|
+
}
|
|
91
|
+
export interface WhileStatement extends BaseStatement {
|
|
92
|
+
type: "WhileStatement";
|
|
93
|
+
test: Expression;
|
|
94
|
+
body: Statement;
|
|
95
|
+
}
|
|
96
|
+
export interface DoWhileStatement extends BaseStatement {
|
|
97
|
+
type: "DoWhileStatement";
|
|
98
|
+
body: Statement;
|
|
99
|
+
test: Expression;
|
|
100
|
+
}
|
|
101
|
+
export interface ForStatement extends BaseStatement {
|
|
102
|
+
type: "ForStatement";
|
|
103
|
+
init?: VariableDeclaration | Expression | null | undefined;
|
|
104
|
+
test?: Expression | null | undefined;
|
|
105
|
+
update?: Expression | null | undefined;
|
|
106
|
+
body: Statement;
|
|
107
|
+
}
|
|
108
|
+
export declare type Declaration = ClassDeclaration | EnumDeclaration | FunctionDeclaration | ModuleDeclaration | TypedefDeclaration | VariableDeclaration;
|
|
109
|
+
interface BaseDeclaration extends BaseStatement {
|
|
110
|
+
attrs?: AttributeList;
|
|
111
|
+
}
|
|
112
|
+
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
113
|
+
type: "FunctionDeclaration";
|
|
114
|
+
id: Identifier;
|
|
115
|
+
body: BlockStatement;
|
|
116
|
+
optimizable?: boolean;
|
|
117
|
+
hasOverride?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface VariableDeclaration extends BaseDeclaration {
|
|
120
|
+
type: "VariableDeclaration";
|
|
121
|
+
declarations: Array<VariableDeclarator>;
|
|
122
|
+
kind: "var" | "const";
|
|
123
|
+
}
|
|
124
|
+
export interface VariableDeclarator extends BaseNode {
|
|
125
|
+
type: "VariableDeclarator";
|
|
126
|
+
id: Identifier | AsExpression;
|
|
127
|
+
init?: Expression | null | undefined;
|
|
128
|
+
kind: "var" | "const";
|
|
129
|
+
}
|
|
130
|
+
declare type Expression = ThisExpression | ArrayExpression | ObjectExpression | Literal | UnaryExpression | UpdateExpression | BinaryExpression | AsExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier;
|
|
131
|
+
export interface BaseExpression extends BaseNode {
|
|
132
|
+
enumType?: string | Node;
|
|
133
|
+
}
|
|
134
|
+
export interface ThisExpression extends BaseExpression {
|
|
135
|
+
type: "ThisExpression";
|
|
136
|
+
text: string;
|
|
137
|
+
}
|
|
138
|
+
export interface ArrayExpression extends BaseExpression {
|
|
139
|
+
type: "ArrayExpression";
|
|
140
|
+
elements: Array<Expression>;
|
|
141
|
+
}
|
|
142
|
+
export interface ObjectExpression extends BaseExpression {
|
|
143
|
+
type: "ObjectExpression";
|
|
144
|
+
properties: Array<Property>;
|
|
145
|
+
}
|
|
146
|
+
export interface Property extends BaseNode {
|
|
147
|
+
type: "Property";
|
|
148
|
+
key: Expression;
|
|
149
|
+
value: Expression;
|
|
150
|
+
kind: "init";
|
|
151
|
+
}
|
|
152
|
+
export interface SequenceExpression extends BaseExpression {
|
|
153
|
+
type: "SequenceExpression";
|
|
154
|
+
expressions: Array<Expression>;
|
|
155
|
+
}
|
|
156
|
+
interface BaseUnaryExpression extends BaseExpression {
|
|
157
|
+
type: "UnaryExpression";
|
|
158
|
+
prefix: true;
|
|
159
|
+
}
|
|
160
|
+
interface TrueUnaryExpression extends BaseUnaryExpression {
|
|
161
|
+
operator: UnaryOperator;
|
|
162
|
+
argument: Expression;
|
|
163
|
+
}
|
|
164
|
+
interface SymbolExpression extends BaseUnaryExpression {
|
|
165
|
+
operator: ":";
|
|
166
|
+
argument: Identifier;
|
|
167
|
+
}
|
|
168
|
+
export declare type UnaryExpression = TrueUnaryExpression | SymbolExpression;
|
|
169
|
+
export interface BinaryExpression extends BaseExpression {
|
|
170
|
+
type: "BinaryExpression";
|
|
171
|
+
operator: BinaryOperator;
|
|
172
|
+
left: Expression;
|
|
173
|
+
right: Expression;
|
|
174
|
+
}
|
|
175
|
+
export interface AsExpression extends BaseExpression {
|
|
176
|
+
type: "BinaryExpression";
|
|
177
|
+
operator: "as";
|
|
178
|
+
left: Expression;
|
|
179
|
+
right: TypeSpecList;
|
|
180
|
+
}
|
|
181
|
+
export interface AssignmentExpression extends BaseExpression {
|
|
182
|
+
type: "AssignmentExpression";
|
|
183
|
+
operator: AssignmentOperator;
|
|
184
|
+
left: Identifier | MemberExpression;
|
|
185
|
+
right: Expression;
|
|
186
|
+
}
|
|
187
|
+
export interface UpdateExpression extends BaseExpression {
|
|
188
|
+
type: "UpdateExpression";
|
|
189
|
+
operator: UpdateOperator;
|
|
190
|
+
argument: Expression;
|
|
191
|
+
prefix: boolean;
|
|
192
|
+
}
|
|
193
|
+
export interface LogicalExpression extends BaseExpression {
|
|
194
|
+
type: "LogicalExpression";
|
|
195
|
+
operator: LogicalOperator;
|
|
196
|
+
left: Expression;
|
|
197
|
+
right: Expression;
|
|
198
|
+
}
|
|
199
|
+
export interface ConditionalExpression extends BaseExpression {
|
|
200
|
+
type: "ConditionalExpression";
|
|
201
|
+
test: Expression;
|
|
202
|
+
alternate: Expression;
|
|
203
|
+
consequent: Expression;
|
|
204
|
+
}
|
|
205
|
+
interface BaseCallExpression extends BaseExpression {
|
|
206
|
+
callee: Expression;
|
|
207
|
+
arguments: Array<Expression>;
|
|
208
|
+
}
|
|
209
|
+
export declare type CallExpression = SimpleCallExpression | NewExpression;
|
|
210
|
+
export interface SimpleCallExpression extends BaseCallExpression {
|
|
211
|
+
type: "CallExpression";
|
|
212
|
+
}
|
|
213
|
+
export interface NewExpression extends BaseCallExpression {
|
|
214
|
+
type: "NewExpression";
|
|
215
|
+
}
|
|
216
|
+
export interface MemberExpression extends BaseExpression {
|
|
217
|
+
type: "MemberExpression";
|
|
218
|
+
object: Expression;
|
|
219
|
+
property: Expression;
|
|
220
|
+
computed: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface SwitchCase extends BaseNode {
|
|
223
|
+
type: "SwitchCase";
|
|
224
|
+
test?: Expression | null | undefined;
|
|
225
|
+
consequent: Array<Statement>;
|
|
226
|
+
}
|
|
227
|
+
export interface CatchClause extends BaseNode {
|
|
228
|
+
type: "CatchClause";
|
|
229
|
+
param: Identifier | null;
|
|
230
|
+
body: BlockStatement;
|
|
231
|
+
}
|
|
232
|
+
export interface CatchClauses extends BaseNode {
|
|
233
|
+
type: "CatchClauses";
|
|
234
|
+
catches: CatchClause[];
|
|
235
|
+
}
|
|
236
|
+
export interface Identifier extends BaseNode, BaseExpression {
|
|
237
|
+
type: "Identifier";
|
|
238
|
+
name: string;
|
|
239
|
+
}
|
|
240
|
+
export interface Literal extends BaseNode, BaseExpression {
|
|
241
|
+
type: "Literal";
|
|
242
|
+
value: string | boolean | number | null;
|
|
243
|
+
raw?: string | undefined;
|
|
244
|
+
}
|
|
245
|
+
export declare type UnaryOperator = "-" | "+" | "!" | "~" | " as";
|
|
246
|
+
export declare type BinaryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "has" | "instanceof";
|
|
247
|
+
export declare type LogicalOperator = "||" | "&&";
|
|
248
|
+
export declare type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | "|=" | "^=" | "&=";
|
|
249
|
+
export declare type UpdateOperator = "++" | "--";
|
|
250
|
+
export interface ClassDeclaration extends BaseDeclaration {
|
|
251
|
+
type: "ClassDeclaration";
|
|
252
|
+
id: Identifier;
|
|
253
|
+
superClass?: Expression | null | undefined;
|
|
254
|
+
body: ClassBody;
|
|
255
|
+
}
|
|
256
|
+
export interface ClassBody extends BaseStatement {
|
|
257
|
+
type: "ClassBody";
|
|
258
|
+
body: Array<ClassElement>;
|
|
259
|
+
}
|
|
260
|
+
export interface ClassElement extends BaseStatement {
|
|
261
|
+
type: "ClassElement";
|
|
262
|
+
item: Omit<Declaration, "ModuleDeclaration">;
|
|
263
|
+
}
|
|
264
|
+
export interface EnumDeclaration extends BaseDeclaration {
|
|
265
|
+
type: "EnumDeclaration";
|
|
266
|
+
id?: Identifier | null;
|
|
267
|
+
body: EnumStringBody;
|
|
268
|
+
}
|
|
269
|
+
export interface EnumStringBody extends BaseNode {
|
|
270
|
+
type: "EnumStringBody";
|
|
271
|
+
members: Array<EnumStringMember | Identifier>;
|
|
272
|
+
enumType?: string | Node;
|
|
273
|
+
}
|
|
274
|
+
export interface EnumStringMember extends BaseNode {
|
|
275
|
+
type: "EnumStringMember";
|
|
276
|
+
id: Identifier;
|
|
277
|
+
init: Expression;
|
|
278
|
+
enumType?: string | Node;
|
|
279
|
+
}
|
|
280
|
+
export interface TypedefDeclaration extends BaseDeclaration {
|
|
281
|
+
type: "TypedefDeclaration";
|
|
282
|
+
id: Identifier;
|
|
283
|
+
ts: AsTypeSpec;
|
|
284
|
+
}
|
|
285
|
+
export interface AsTypeSpec extends Omit<UnaryExpression, "operator" | "argument"> {
|
|
286
|
+
operator: " as";
|
|
287
|
+
argument: TypeSpecList;
|
|
288
|
+
}
|
|
289
|
+
export interface TypeSpecList extends BaseNode {
|
|
290
|
+
type: "TypeSpecList";
|
|
291
|
+
ts: Array<TypeSpecPart>;
|
|
292
|
+
}
|
|
293
|
+
export interface TypeSpecPart extends BaseNode {
|
|
294
|
+
type: "TypeSpecPart";
|
|
295
|
+
name: Identifier | MemberExpression;
|
|
296
|
+
body?: BlockStatement;
|
|
297
|
+
callspec?: MethodDefinition;
|
|
298
|
+
generics?: Array<TypeSpecList>;
|
|
299
|
+
}
|
|
300
|
+
export interface MethodDefinition extends BaseNode {
|
|
301
|
+
type: "MethodDefinition";
|
|
302
|
+
kind: "method";
|
|
303
|
+
key: "";
|
|
304
|
+
params: Array<Identifier | AsExpression>;
|
|
305
|
+
returnType: AsTypeSpec;
|
|
306
|
+
}
|
|
307
|
+
export declare type AccessSpecifier = "static" | "private" | "protected" | "hidden" | "public";
|
|
308
|
+
export interface AttributeList extends BaseNode {
|
|
309
|
+
type: "AttributeList";
|
|
310
|
+
attrs?: Attribute[];
|
|
311
|
+
access?: AccessSpecifier[];
|
|
312
|
+
}
|
|
313
|
+
declare type Attribute = SymbolExpression | CallExpression;
|
|
314
|
+
export declare type ImportStatement = ImportModule | Using;
|
|
315
|
+
export interface ImportModule extends BaseNode {
|
|
316
|
+
type: "ImportModule";
|
|
317
|
+
id: MemberExpression;
|
|
318
|
+
}
|
|
319
|
+
export interface Using extends BaseNode {
|
|
320
|
+
type: "Using";
|
|
321
|
+
id: MemberExpression;
|
|
322
|
+
as: Identifier;
|
|
323
|
+
}
|
|
324
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ManifestXML } from "./manifest";
|
|
2
|
+
export declare type Target = {
|
|
3
|
+
product: string;
|
|
4
|
+
qualifier: JungleQualifier;
|
|
5
|
+
shape?: string;
|
|
6
|
+
group?: {
|
|
7
|
+
optimizerConfig: JungleQualifier;
|
|
8
|
+
dir?: string;
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare type LangResourcePaths = {
|
|
13
|
+
[key: string]: string[];
|
|
14
|
+
};
|
|
15
|
+
declare type BarrelAnnotations = {
|
|
16
|
+
[key: string]: string[];
|
|
17
|
+
};
|
|
18
|
+
declare type BarrelMap = {
|
|
19
|
+
[key: string]: ResolvedBarrel;
|
|
20
|
+
};
|
|
21
|
+
declare type OptBarrelMap = Record<string, {
|
|
22
|
+
rawBarrelDir: string;
|
|
23
|
+
manifest: string;
|
|
24
|
+
jungleFiles: string[];
|
|
25
|
+
optBarrelDir: string;
|
|
26
|
+
}>;
|
|
27
|
+
export declare type JungleQualifier = {
|
|
28
|
+
sourcePath?: string[];
|
|
29
|
+
sourceExcludes?: string[];
|
|
30
|
+
excludeAnnotations?: string[];
|
|
31
|
+
resourcePath?: string[];
|
|
32
|
+
lang?: LangResourcePaths;
|
|
33
|
+
barrelPath?: (string | string[])[];
|
|
34
|
+
annotations?: BarrelAnnotations;
|
|
35
|
+
barrelMap?: BarrelMap;
|
|
36
|
+
optBarrels?: OptBarrelMap;
|
|
37
|
+
};
|
|
38
|
+
declare type JungleInfoBase = {
|
|
39
|
+
jungles: string[];
|
|
40
|
+
manifest: string;
|
|
41
|
+
xml: ManifestXML;
|
|
42
|
+
annotations?: string[];
|
|
43
|
+
};
|
|
44
|
+
export declare type ResolvedJungle = JungleInfoBase & {
|
|
45
|
+
targets: Target[];
|
|
46
|
+
};
|
|
47
|
+
export declare type ResolvedBarrel = JungleInfoBase & {
|
|
48
|
+
qualifier: JungleQualifier;
|
|
49
|
+
};
|
|
50
|
+
export declare function get_jungle(jungles: string, options: BuildConfig): Promise<ResolvedJungle>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
declare type iqApplication = {
|
|
2
|
+
$: {
|
|
3
|
+
id: string;
|
|
4
|
+
entry: string;
|
|
5
|
+
launcherIcon: string;
|
|
6
|
+
minSdkVersion: string;
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
version: string;
|
|
10
|
+
};
|
|
11
|
+
"iq:products"?: Array<{
|
|
12
|
+
"iq:product"?: Array<{
|
|
13
|
+
$: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
}>;
|
|
18
|
+
"iq:barrels"?: Array<{
|
|
19
|
+
"iq:depends"?: Array<{
|
|
20
|
+
$: {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
"iq:permissions"?: Array<{
|
|
27
|
+
"iq:uses-permission"?: Array<{
|
|
28
|
+
$: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
"iq:languages"?: Array<{
|
|
34
|
+
"iq:language"?: Array<string>;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
declare type iqBarrel = {
|
|
38
|
+
$: {
|
|
39
|
+
id: string;
|
|
40
|
+
module: string;
|
|
41
|
+
version: string;
|
|
42
|
+
};
|
|
43
|
+
"iq:products"?: Array<{
|
|
44
|
+
"iq:product"?: Array<{
|
|
45
|
+
$: {
|
|
46
|
+
id: string;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
"iq:annotations"?: Array<{
|
|
51
|
+
"iq:annotation"?: Array<string>;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
export declare type ManifestXML = {
|
|
55
|
+
"iq:manifest": {
|
|
56
|
+
$: {
|
|
57
|
+
"xmlns:iq": string;
|
|
58
|
+
};
|
|
59
|
+
"iq:application"?: Array<iqApplication>;
|
|
60
|
+
"iq:barrel"?: Array<iqBarrel>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare function readManifest(manifest: string): Promise<ManifestXML>;
|
|
64
|
+
export declare function writeManifest(filename: string, xml: ManifestXML): Promise<void>;
|
|
65
|
+
export declare function manifestProducts(manifest: ManifestXML): string[];
|
|
66
|
+
export declare function manifestBarrels(manifest: ManifestXML): string[];
|
|
67
|
+
export declare function manifestDropBarrels(manifest: ManifestXML): void;
|
|
68
|
+
export declare function manifestBarrelName(manifestName: string, manifest: ManifestXML): string;
|
|
69
|
+
export declare function manifestAnnotations(manifest: ManifestXML): string[] | undefined;
|
|
70
|
+
export declare function checkManifest(manifest: ManifestXML, products: string[]): Promise<boolean>;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
|
+
export declare function getFileSources(fnMap: FilesToOptimizeMap): Promise<void>;
|
|
3
|
+
export declare function getFileASTs(fnMap: FilesToOptimizeMap): Promise<boolean>;
|
|
4
|
+
export declare function analyze(fnMap: FilesToOptimizeMap): Promise<ProgramStateAnalysis>;
|
|
5
|
+
export declare function getLiteralFromDecls(decls: StateNodeDecl[]): null;
|
|
6
|
+
export declare function getLiteralNode(node: mctree.Node | null | undefined): null | mctree.Literal | mctree.AsExpression;
|
|
7
|
+
export declare function optimizeMonkeyC(fnMap: FilesToOptimizeMap): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const negativeFixups: string[];
|