@markw65/monkeyc-optimizer 1.1.67 → 1.1.68
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/CHANGELOG.md +9 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-2OEXWI65.cjs → chunk-NGCEDNHJ.cjs} +129 -59
- package/build/optimizer.cjs +18 -18
- package/build/sdk-util.cjs +14 -14
- package/build/src/optimizer.d.ts +1 -1
- package/build/src/worker-task.d.ts +1 -0
- package/build/worker-thread.cjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.68
|
|
6
|
+
|
|
7
|
+
- Fix a race between removing and creating outputPath that could potentially cause a build to fail
|
|
8
|
+
- Only ignore jungle paths that resolve to `prettierMonkeyC.outputPath` if the pattern is the default, `**.mc`
|
|
9
|
+
- Ignore jungle paths that resolve to `prettierMonkeyC.outputPath`, rather than `bin`.
|
|
10
|
+
- Prevent infinite recursion with cyclic Class graphs. Now gives sensible error messages, and doesn't crash
|
|
11
|
+
- Record barrel paths in build dependencies, so that rebuilding a barrel will cause a re-run of the live analysis
|
|
12
|
+
- Add the jungle as the source file for "unresolved barrel" errors. Lets you know which project caused the error.
|
|
13
|
+
|
|
5
14
|
### 1.1.67
|
|
6
15
|
|
|
7
16
|
- Use the type of a variable, when known, if its the base of a lookup (fixes #35)
|
package/build/api.cjs
CHANGED
|
@@ -18,47 +18,47 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var api_exports = {};
|
|
20
20
|
__export(api_exports, {
|
|
21
|
-
checkCompilerVersion: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
formatScopedName: () =>
|
|
31
|
-
getApiFunctionInfo: () =>
|
|
32
|
-
getApiMapping: () =>
|
|
33
|
-
getSuperClasses: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_NGCEDNHJ.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_NGCEDNHJ.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_NGCEDNHJ.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_NGCEDNHJ.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_NGCEDNHJ.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_NGCEDNHJ.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_NGCEDNHJ.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_NGCEDNHJ.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_NGCEDNHJ.formatAstLongLines,
|
|
30
|
+
formatScopedName: () => import_chunk_NGCEDNHJ.formatScopedName,
|
|
31
|
+
getApiFunctionInfo: () => import_chunk_NGCEDNHJ.getApiFunctionInfo,
|
|
32
|
+
getApiMapping: () => import_chunk_NGCEDNHJ.getApiMapping,
|
|
33
|
+
getSuperClasses: () => import_chunk_NGCEDNHJ.getSuperClasses,
|
|
34
34
|
hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
|
|
35
|
-
isClassVariable: () =>
|
|
36
|
-
isLocal: () =>
|
|
37
|
-
isLookupCandidate: () =>
|
|
38
|
-
isStateNode: () =>
|
|
39
|
-
lookupByFullName: () =>
|
|
40
|
-
lookupNext: () =>
|
|
41
|
-
lookupResultContains: () =>
|
|
42
|
-
lookupWithType: () =>
|
|
43
|
-
makeToyboxLink: () =>
|
|
44
|
-
mapVarDeclsByType: () =>
|
|
45
|
-
markInvokeClassMethod: () =>
|
|
46
|
-
parseSdkVersion: () =>
|
|
47
|
-
resolveDiagnostics: () =>
|
|
48
|
-
resolveDiagnosticsMap: () =>
|
|
49
|
-
sameLookupResult: () =>
|
|
35
|
+
isClassVariable: () => import_chunk_NGCEDNHJ.isClassVariable,
|
|
36
|
+
isLocal: () => import_chunk_NGCEDNHJ.isLocal,
|
|
37
|
+
isLookupCandidate: () => import_chunk_NGCEDNHJ.isLookupCandidate,
|
|
38
|
+
isStateNode: () => import_chunk_NGCEDNHJ.isStateNode,
|
|
39
|
+
lookupByFullName: () => import_chunk_NGCEDNHJ.lookupByFullName,
|
|
40
|
+
lookupNext: () => import_chunk_NGCEDNHJ.lookupNext,
|
|
41
|
+
lookupResultContains: () => import_chunk_NGCEDNHJ.lookupResultContains,
|
|
42
|
+
lookupWithType: () => import_chunk_NGCEDNHJ.lookupWithType,
|
|
43
|
+
makeToyboxLink: () => import_chunk_NGCEDNHJ.makeToyboxLink,
|
|
44
|
+
mapVarDeclsByType: () => import_chunk_NGCEDNHJ.mapVarDeclsByType,
|
|
45
|
+
markInvokeClassMethod: () => import_chunk_NGCEDNHJ.markInvokeClassMethod,
|
|
46
|
+
parseSdkVersion: () => import_chunk_NGCEDNHJ.parseSdkVersion,
|
|
47
|
+
resolveDiagnostics: () => import_chunk_NGCEDNHJ.resolveDiagnostics,
|
|
48
|
+
resolveDiagnosticsMap: () => import_chunk_NGCEDNHJ.resolveDiagnosticsMap,
|
|
49
|
+
sameLookupResult: () => import_chunk_NGCEDNHJ.sameLookupResult,
|
|
50
50
|
traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
|
|
51
|
-
variableDeclarationName: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
visitorNode: () =>
|
|
51
|
+
variableDeclarationName: () => import_chunk_NGCEDNHJ.variableDeclarationName,
|
|
52
|
+
visitReferences: () => import_chunk_NGCEDNHJ.visitReferences,
|
|
53
|
+
visit_resources: () => import_chunk_NGCEDNHJ.visit_resources,
|
|
54
|
+
visitorNode: () => import_chunk_NGCEDNHJ.visitorNode
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(api_exports);
|
|
57
|
-
var
|
|
57
|
+
var import_chunk_NGCEDNHJ = require("./chunk-NGCEDNHJ.cjs");
|
|
58
58
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
59
59
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
60
60
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
61
|
-
(0,
|
|
61
|
+
(0, import_chunk_NGCEDNHJ.init_api)();
|
|
62
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
63
|
0 && (module.exports = {
|
|
64
64
|
checkCompilerVersion,
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_NGCEDNHJ_exports = {};
|
|
30
|
+
__export(chunk_NGCEDNHJ_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -135,7 +135,7 @@ __export(chunk_2OEXWI65_exports, {
|
|
|
135
135
|
visitorNode: () => visitorNode,
|
|
136
136
|
xml_util_exports: () => xml_util_exports
|
|
137
137
|
});
|
|
138
|
-
module.exports = __toCommonJS(
|
|
138
|
+
module.exports = __toCommonJS(chunk_NGCEDNHJ_exports);
|
|
139
139
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
140
140
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
141
141
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
@@ -16626,6 +16626,7 @@ function collectClassInfo(state) {
|
|
|
16626
16626
|
const toybox = state.stack[0].sn.decls["Toybox"][0];
|
|
16627
16627
|
const lang = toybox.decls["Lang"][0];
|
|
16628
16628
|
const object = lang.decls["Object"];
|
|
16629
|
+
const invalidSymbols = state.config?.checkInvalidSymbols ?? "WARNING";
|
|
16629
16630
|
state.allClasses.forEach((elm) => {
|
|
16630
16631
|
if (elm.stack[elm.stack.length - 1].sn.type === "ClassDeclaration") {
|
|
16631
16632
|
elm.stack = elm.stack.slice(0, 1);
|
|
@@ -16640,7 +16641,18 @@ function collectClassInfo(state) {
|
|
|
16640
16641
|
(c) => isStateNode(c) && c.type === "ClassDeclaration"
|
|
16641
16642
|
);
|
|
16642
16643
|
elm.superClass = superClass && superClass.length ? superClass : true;
|
|
16643
|
-
if (
|
|
16644
|
+
if (elm.superClass === true) {
|
|
16645
|
+
if (invalidSymbols !== "OFF") {
|
|
16646
|
+
diagnostic(
|
|
16647
|
+
state,
|
|
16648
|
+
elm.node,
|
|
16649
|
+
formatAstLongLines(elm.node.superClass).then(
|
|
16650
|
+
(superClass2) => `Unable to find super class ${superClass2} for ${elm.fullName}`
|
|
16651
|
+
),
|
|
16652
|
+
invalidSymbols
|
|
16653
|
+
);
|
|
16654
|
+
}
|
|
16655
|
+
} else if (name) {
|
|
16644
16656
|
if (!elm.decls)
|
|
16645
16657
|
elm.decls = {};
|
|
16646
16658
|
elm.decls[name] = elm.superClass;
|
|
@@ -16649,24 +16661,44 @@ function collectClassInfo(state) {
|
|
|
16649
16661
|
elm.superClass = object;
|
|
16650
16662
|
}
|
|
16651
16663
|
});
|
|
16652
|
-
const markOverrides = (cls, scls) => {
|
|
16664
|
+
const markOverrides = (cls, scls, seen) => {
|
|
16653
16665
|
if (scls === true)
|
|
16654
16666
|
return;
|
|
16655
|
-
scls.
|
|
16656
|
-
|
|
16667
|
+
for (let i = scls.length; i--; ) {
|
|
16668
|
+
const c = scls[i];
|
|
16669
|
+
if (!c.decls)
|
|
16670
|
+
continue;
|
|
16671
|
+
if (seen.has(c)) {
|
|
16672
|
+
if (invalidSymbols !== "OFF") {
|
|
16673
|
+
diagnostic(
|
|
16674
|
+
state,
|
|
16675
|
+
cls.node,
|
|
16676
|
+
`Class ${cls.fullName}'s inheritance graph contains a cycle including ${c.fullName}`,
|
|
16677
|
+
invalidSymbols
|
|
16678
|
+
);
|
|
16679
|
+
}
|
|
16680
|
+
scls.splice(i, 1);
|
|
16681
|
+
continue;
|
|
16682
|
+
}
|
|
16683
|
+
Object.values(c.decls).forEach((funcs) => {
|
|
16657
16684
|
funcs.forEach((f) => {
|
|
16658
16685
|
if (f.type === "FunctionDeclaration" && (0, import_chunk_MBTLUWXR.hasProperty)(cls.decls, f.name)) {
|
|
16659
16686
|
f.node.hasOverride = true;
|
|
16660
16687
|
}
|
|
16661
16688
|
});
|
|
16662
16689
|
});
|
|
16663
|
-
if (c.superClass)
|
|
16664
|
-
|
|
16665
|
-
|
|
16690
|
+
if (c.superClass) {
|
|
16691
|
+
seen.add(c);
|
|
16692
|
+
markOverrides(cls, c.superClass, seen);
|
|
16693
|
+
seen.delete(c);
|
|
16694
|
+
}
|
|
16695
|
+
}
|
|
16666
16696
|
};
|
|
16667
16697
|
state.allClasses.forEach((elm) => {
|
|
16668
|
-
if (elm.superClass)
|
|
16669
|
-
|
|
16698
|
+
if (elm.superClass) {
|
|
16699
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16700
|
+
markOverrides(elm, elm.superClass, seen);
|
|
16701
|
+
}
|
|
16670
16702
|
if (elm.hasInvoke && elm.decls) {
|
|
16671
16703
|
Object.values(elm.decls).forEach((funcs) => {
|
|
16672
16704
|
funcs.forEach((f) => {
|
|
@@ -16677,6 +16709,11 @@ function collectClassInfo(state) {
|
|
|
16677
16709
|
});
|
|
16678
16710
|
}
|
|
16679
16711
|
});
|
|
16712
|
+
state.allClasses.forEach((elm) => {
|
|
16713
|
+
if (elm.superClass && elm.superClass !== true && elm.superClass.length === 0) {
|
|
16714
|
+
elm.superClass = true;
|
|
16715
|
+
}
|
|
16716
|
+
});
|
|
16680
16717
|
}
|
|
16681
16718
|
function getFileSources(fnMap) {
|
|
16682
16719
|
return Promise.all(
|
|
@@ -28335,7 +28372,7 @@ function resolve_filename(literal, default_source = null) {
|
|
|
28335
28372
|
return path2.resolve(root, literal.value);
|
|
28336
28373
|
}
|
|
28337
28374
|
async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
28338
|
-
const resolve_file_list = (literals) => Promise.all(
|
|
28375
|
+
const resolve_file_list = (literals, checkExists = true) => Promise.all(
|
|
28339
28376
|
literals.map((v) => {
|
|
28340
28377
|
if (!isJNode(v)) {
|
|
28341
28378
|
return v;
|
|
@@ -28359,7 +28396,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28359
28396
|
} else {
|
|
28360
28397
|
cache.resolvedPaths[resolved] = fs5.stat(resolved).then(
|
|
28361
28398
|
() => true,
|
|
28362
|
-
() =>
|
|
28399
|
+
() => !checkExists
|
|
28363
28400
|
);
|
|
28364
28401
|
}
|
|
28365
28402
|
}
|
|
@@ -28370,12 +28407,13 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28370
28407
|
).then(
|
|
28371
28408
|
(results) => results.filter((name) => name != null)
|
|
28372
28409
|
);
|
|
28373
|
-
const resolve_one_file_list = async (base, name) => {
|
|
28410
|
+
const resolve_one_file_list = async (base, name, checkExists = true) => {
|
|
28374
28411
|
const bname = base[name];
|
|
28375
28412
|
if (!bname)
|
|
28376
28413
|
return;
|
|
28377
28414
|
const result = await resolve_file_list(
|
|
28378
|
-
bname
|
|
28415
|
+
bname,
|
|
28416
|
+
checkExists
|
|
28379
28417
|
);
|
|
28380
28418
|
if (!result || !result.length) {
|
|
28381
28419
|
delete base[name];
|
|
@@ -28387,7 +28425,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28387
28425
|
resolve_one_file_list(qualifier, "sourcePath"),
|
|
28388
28426
|
resolve_one_file_list(qualifier, "resourcePath"),
|
|
28389
28427
|
resolve_one_file_list(qualifier, "personality"),
|
|
28390
|
-
resolve_one_file_list(qualifier, "barrelPath")
|
|
28428
|
+
resolve_one_file_list(qualifier, "barrelPath", false)
|
|
28391
28429
|
];
|
|
28392
28430
|
const lang = qualifier["lang"];
|
|
28393
28431
|
if (lang) {
|
|
@@ -28672,23 +28710,32 @@ function identify_optimizer_groups(targets, options) {
|
|
|
28672
28710
|
target.group.optimizerConfig.products.push(target.product);
|
|
28673
28711
|
});
|
|
28674
28712
|
}
|
|
28675
|
-
function find_barrels(barrelPath) {
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28713
|
+
function find_barrels(barrelPath, buildDependencies) {
|
|
28714
|
+
return (Array.isArray(barrelPath) ? (
|
|
28715
|
+
// This is a sublist. The barrel has more than one jungle file.
|
|
28716
|
+
Promise.all(barrelPath.map((path7) => (0, import_chunk_OASVKTK5.globa)(path7, { mark: true }))).then(
|
|
28717
|
+
(paths) => [
|
|
28718
|
+
paths.flat().filter((path7) => path7.endsWith(".jungle")).join(";")
|
|
28719
|
+
]
|
|
28720
|
+
)
|
|
28721
|
+
) : (0, import_chunk_OASVKTK5.globa)(barrelPath, { mark: true }).then(
|
|
28684
28722
|
(paths) => Promise.all(
|
|
28685
28723
|
paths.map(
|
|
28686
28724
|
(path7) => path7.endsWith("/") ? (0, import_chunk_OASVKTK5.globa)(`${path7}**/*.barrel`) : path7
|
|
28687
28725
|
)
|
|
28688
28726
|
)
|
|
28689
28727
|
).then(
|
|
28690
|
-
(barrelPaths) => barrelPaths.flat().filter(
|
|
28691
|
-
|
|
28728
|
+
(barrelPaths) => barrelPaths.flat().filter(
|
|
28729
|
+
(path7) => path7.endsWith(".jungle") || path7.endsWith(".barrel")
|
|
28730
|
+
)
|
|
28731
|
+
)).then((paths) => {
|
|
28732
|
+
(0, import_chunk_OASVKTK5.forEach)(
|
|
28733
|
+
barrelPath,
|
|
28734
|
+
(path7) => /[*?[\]{}]/.test(path7) || (buildDependencies[path7] = true)
|
|
28735
|
+
);
|
|
28736
|
+
paths.forEach((path7) => buildDependencies[path7] = true);
|
|
28737
|
+
return paths;
|
|
28738
|
+
});
|
|
28692
28739
|
}
|
|
28693
28740
|
function resolve_barrel(barrel, barrelDir, products, options, cache, buildDependencies) {
|
|
28694
28741
|
if ((0, import_chunk_MBTLUWXR.hasProperty)(cache.barrels, barrel)) {
|
|
@@ -28734,7 +28781,7 @@ function resolve_barrel(barrel, barrelDir, products, options, cache, buildDepend
|
|
|
28734
28781
|
throw e;
|
|
28735
28782
|
});
|
|
28736
28783
|
}
|
|
28737
|
-
function resolve_barrels(product, qualifier, barrels, products, options, cache, buildDependencies) {
|
|
28784
|
+
function resolve_barrels(jungle, product, qualifier, barrels, products, options, cache, buildDependencies) {
|
|
28738
28785
|
if (qualifier.annotations) {
|
|
28739
28786
|
Object.keys(qualifier.annotations).forEach((key) => {
|
|
28740
28787
|
if (!barrels.includes(key)) {
|
|
@@ -28772,7 +28819,7 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
28772
28819
|
barrels.map((b) => [b, null])
|
|
28773
28820
|
);
|
|
28774
28821
|
return (qualifier.barrelPath || []).reduce(
|
|
28775
|
-
(promise, barrelPath) => promise.then(() => find_barrels(barrelPath)).then((barrelPaths) => {
|
|
28822
|
+
(promise, barrelPath) => promise.then(() => find_barrels(barrelPath, buildDependencies)).then((barrelPaths) => {
|
|
28776
28823
|
return Promise.all(
|
|
28777
28824
|
barrelPaths.map(
|
|
28778
28825
|
(barrel) => resolve_barrel(
|
|
@@ -28809,9 +28856,11 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
28809
28856
|
).then(() => {
|
|
28810
28857
|
const unresolved = Object.entries(barrelMap).filter((v) => v[1] === null);
|
|
28811
28858
|
if (unresolved.length) {
|
|
28812
|
-
|
|
28859
|
+
const e = new Error(
|
|
28813
28860
|
`Failed to resolve some barrels: ${unresolved.map(([name]) => name).join(",")}`
|
|
28814
28861
|
);
|
|
28862
|
+
e.source = jungle;
|
|
28863
|
+
throw e;
|
|
28815
28864
|
}
|
|
28816
28865
|
const finalMap = barrelMap;
|
|
28817
28866
|
if (!cache.barrelMap)
|
|
@@ -28876,6 +28925,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
28876
28925
|
).then((qualifier) => {
|
|
28877
28926
|
targets.push({ product, qualifier, shape });
|
|
28878
28927
|
return resolve_barrels(
|
|
28928
|
+
jungles[0],
|
|
28879
28929
|
product,
|
|
28880
28930
|
qualifier,
|
|
28881
28931
|
barrels,
|
|
@@ -29295,17 +29345,14 @@ async function generateOptimizedProject(options) {
|
|
|
29295
29345
|
let hasPersonality = false;
|
|
29296
29346
|
const promises = Object.keys(buildConfigs).sort().map((key) => {
|
|
29297
29347
|
const buildConfig = buildConfigs[key];
|
|
29298
|
-
const outputPath = path4.join(config.outputPath, key);
|
|
29299
29348
|
return buildConfig ? runTaskInPool({
|
|
29300
29349
|
type: "generateOneConfig",
|
|
29301
29350
|
data: {
|
|
29302
29351
|
buildConfig,
|
|
29303
29352
|
manifestXML: xml,
|
|
29304
29353
|
dependencyFiles,
|
|
29305
|
-
config
|
|
29306
|
-
|
|
29307
|
-
outputPath
|
|
29308
|
-
}
|
|
29354
|
+
config,
|
|
29355
|
+
key
|
|
29309
29356
|
}
|
|
29310
29357
|
}).catch((e) => {
|
|
29311
29358
|
if (!e.stack) {
|
|
@@ -29324,7 +29371,7 @@ async function generateOptimizedProject(options) {
|
|
|
29324
29371
|
if (t.sdkVersion != null && t.sdkVersion >= 4002001) {
|
|
29325
29372
|
hasPersonality = true;
|
|
29326
29373
|
}
|
|
29327
|
-
}) : fs6.rm(path4.resolve(workspace, outputPath), {
|
|
29374
|
+
}) : fs6.rm(path4.resolve(workspace, config.outputPath, key), {
|
|
29328
29375
|
recursive: true,
|
|
29329
29376
|
force: true
|
|
29330
29377
|
});
|
|
@@ -29477,30 +29524,48 @@ async function generateOptimizedProject(options) {
|
|
|
29477
29524
|
diagnostics
|
|
29478
29525
|
};
|
|
29479
29526
|
}
|
|
29480
|
-
async function filesFromPaths(workspace,
|
|
29481
|
-
|
|
29482
|
-
|
|
29527
|
+
async function filesFromPaths(workspace, buildDir, inPaths, extension) {
|
|
29528
|
+
const filter = buildDir.startsWith(workspace);
|
|
29529
|
+
const paths = (await Promise.all(
|
|
29530
|
+
inPaths?.map(
|
|
29531
|
+
(pattern) => (0, import_chunk_OASVKTK5.globa)(pattern, { cwd: workspace, mark: true }).then(
|
|
29532
|
+
(paths2) => paths2.map((p) => ({
|
|
29533
|
+
path: p,
|
|
29534
|
+
filter: filter && /^\*\*[\\/]\*.mc$/i.test(path4.relative(workspace, pattern))
|
|
29535
|
+
}))
|
|
29536
|
+
)
|
|
29537
|
+
) || []
|
|
29483
29538
|
)).flat();
|
|
29484
29539
|
const files = await Promise.all(
|
|
29485
29540
|
paths.map(
|
|
29486
|
-
(
|
|
29541
|
+
(result) => result.path.endsWith("/") ? (0, import_chunk_OASVKTK5.globa)(`${result.path}**/*${extension}`, {
|
|
29542
|
+
cwd: workspace,
|
|
29543
|
+
mark: true
|
|
29544
|
+
}).then(
|
|
29545
|
+
(paths2) => paths2.map((path7) => ({
|
|
29546
|
+
path: path7,
|
|
29547
|
+
filter: result.filter
|
|
29548
|
+
}))
|
|
29549
|
+
) : result
|
|
29487
29550
|
)
|
|
29488
29551
|
);
|
|
29489
29552
|
return {
|
|
29490
29553
|
files: files.flat().filter(
|
|
29491
|
-
(file) => file.endsWith(extension) && !
|
|
29492
|
-
),
|
|
29493
|
-
paths
|
|
29554
|
+
(file) => file.path.endsWith(extension) && (!file.filter || !file.path.startsWith(buildDir))
|
|
29555
|
+
).map(({ path: path7 }) => path7),
|
|
29556
|
+
paths: paths.map(({ path: path7 }) => path7)
|
|
29494
29557
|
};
|
|
29495
29558
|
}
|
|
29496
|
-
async function fileInfoFromConfig(workspace, output, buildConfig, extraExcludes, barrel) {
|
|
29559
|
+
async function fileInfoFromConfig(workspace, buildDir, output, buildConfig, extraExcludes, barrel) {
|
|
29497
29560
|
const { files, paths } = await filesFromPaths(
|
|
29498
29561
|
workspace,
|
|
29562
|
+
buildDir,
|
|
29499
29563
|
buildConfig.sourcePath,
|
|
29500
29564
|
".mc"
|
|
29501
29565
|
);
|
|
29502
29566
|
const { files: personalityFiles } = await filesFromPaths(
|
|
29503
29567
|
workspace,
|
|
29568
|
+
buildDir,
|
|
29504
29569
|
buildConfig.personality,
|
|
29505
29570
|
".mss"
|
|
29506
29571
|
);
|
|
@@ -29538,9 +29603,10 @@ function excludesFromAnnotations(barrel, annotations, resolvedBarrel) {
|
|
|
29538
29603
|
}
|
|
29539
29604
|
return excludes;
|
|
29540
29605
|
}
|
|
29541
|
-
async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, config) {
|
|
29606
|
+
async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, config, key) {
|
|
29542
29607
|
const { workspace } = config;
|
|
29543
|
-
const
|
|
29608
|
+
const outputRoot = path4.resolve(workspace, config.outputPath);
|
|
29609
|
+
const output = path4.join(outputRoot, key);
|
|
29544
29610
|
const buildModeExcludes = {
|
|
29545
29611
|
// note: exclude debug in release builds, and release in debug builds
|
|
29546
29612
|
[config.releaseBuild ? "debug" : "release"]: true
|
|
@@ -29554,6 +29620,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29554
29620
|
}
|
|
29555
29621
|
const { fnMap } = await fileInfoFromConfig(
|
|
29556
29622
|
workspace,
|
|
29623
|
+
outputRoot,
|
|
29557
29624
|
path4.join(output, "source"),
|
|
29558
29625
|
buildConfig,
|
|
29559
29626
|
buildModeExcludes,
|
|
@@ -29571,6 +29638,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29571
29638
|
);
|
|
29572
29639
|
return fileInfoFromConfig(
|
|
29573
29640
|
path4.dirname(resolvedBarrel.jungles[0]),
|
|
29641
|
+
outputRoot,
|
|
29574
29642
|
path4.join(output, "barrels", barrel),
|
|
29575
29643
|
resolvedBarrel.qualifier,
|
|
29576
29644
|
{
|
|
@@ -29586,9 +29654,9 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29586
29654
|
}).flat()
|
|
29587
29655
|
);
|
|
29588
29656
|
barrelFnMaps.forEach(
|
|
29589
|
-
(barrelFnMap) => Object.entries(barrelFnMap).forEach(([
|
|
29590
|
-
if (!(0, import_chunk_MBTLUWXR.hasProperty)(fnMap,
|
|
29591
|
-
fnMap[
|
|
29657
|
+
(barrelFnMap) => Object.entries(barrelFnMap).forEach(([key2, value2]) => {
|
|
29658
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(fnMap, key2)) {
|
|
29659
|
+
fnMap[key2] = value2;
|
|
29592
29660
|
}
|
|
29593
29661
|
})
|
|
29594
29662
|
);
|
|
@@ -29615,7 +29683,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29615
29683
|
const opt_time = await (0, import_chunk_OASVKTK5.first_modified)(
|
|
29616
29684
|
Object.values(fnMap).map((v) => v.output)
|
|
29617
29685
|
);
|
|
29618
|
-
if (source_time < opt_time &&
|
|
29686
|
+
if (source_time < opt_time && 1720645332171 < opt_time) {
|
|
29619
29687
|
return {
|
|
29620
29688
|
hasTests,
|
|
29621
29689
|
diagnostics: prevDiagnostics,
|
|
@@ -29624,13 +29692,12 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29624
29692
|
}
|
|
29625
29693
|
}
|
|
29626
29694
|
}
|
|
29627
|
-
const [
|
|
29628
|
-
fs6.rm(output, { recursive: true, force: true }),
|
|
29629
|
-
fs6.mkdir(output, { recursive: true }),
|
|
29695
|
+
const [prettierConfig] = await Promise.all([
|
|
29630
29696
|
Prettier2.resolveConfig(config.workspace, {
|
|
29631
29697
|
useCache: false,
|
|
29632
29698
|
editorconfig: true
|
|
29633
|
-
})
|
|
29699
|
+
}),
|
|
29700
|
+
fs6.rm(output, { recursive: true, force: true }).then(() => fs6.mkdir(output, { recursive: true }))
|
|
29634
29701
|
]);
|
|
29635
29702
|
return optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config).then(
|
|
29636
29703
|
({ diagnostics, sdkVersion }) => {
|
|
@@ -29654,7 +29721,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29654
29721
|
hasTests: hasTests2,
|
|
29655
29722
|
diagnostics,
|
|
29656
29723
|
sdkVersion,
|
|
29657
|
-
optimizerVersion: "1.1.
|
|
29724
|
+
optimizerVersion: "1.1.68",
|
|
29658
29725
|
...Object.fromEntries(
|
|
29659
29726
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29660
29727
|
)
|
|
@@ -29699,11 +29766,13 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29699
29766
|
}
|
|
29700
29767
|
return product;
|
|
29701
29768
|
});
|
|
29769
|
+
const { workspace, outputPath } = options;
|
|
29702
29770
|
const { fnMap, paths } = await Promise.all(
|
|
29703
29771
|
Array.from(qualifiers).map(
|
|
29704
29772
|
([name, qualifier]) => fileInfoFromConfig(
|
|
29705
29773
|
qualifier.root,
|
|
29706
|
-
|
|
29774
|
+
path4.resolve(workspace, outputPath ?? "bin/optimized"),
|
|
29775
|
+
workspace,
|
|
29707
29776
|
{
|
|
29708
29777
|
sourcePath: Array.from(qualifier.sourcePath),
|
|
29709
29778
|
personality: Array.from(qualifier.personality),
|
|
@@ -29820,6 +29889,7 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29820
29889
|
init_launch();
|
|
29821
29890
|
init_manifest();
|
|
29822
29891
|
init_mc_rewrite();
|
|
29892
|
+
init_pragma_checker();
|
|
29823
29893
|
init_sdk_util();
|
|
29824
29894
|
init_type_flow();
|
|
29825
29895
|
init_could_be();
|
|
@@ -29827,7 +29897,6 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29827
29897
|
init_sub_type();
|
|
29828
29898
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
29829
29899
|
init_worker_pool();
|
|
29830
|
-
init_pragma_checker();
|
|
29831
29900
|
init_optimizer_types();
|
|
29832
29901
|
init_types();
|
|
29833
29902
|
defaultConfig = {
|
|
@@ -29913,7 +29982,8 @@ var init_worker_task = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
29913
29982
|
data.buildConfig,
|
|
29914
29983
|
data.manifestXML,
|
|
29915
29984
|
data.dependencyFiles,
|
|
29916
|
-
data.config
|
|
29985
|
+
data.config,
|
|
29986
|
+
data.key
|
|
29917
29987
|
);
|
|
29918
29988
|
},
|
|
29919
29989
|
optimizePrgAndDebug(data) {
|
package/build/optimizer.cjs
CHANGED
|
@@ -18,30 +18,30 @@ 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
|
-
buildConfigDescription: () =>
|
|
23
|
-
buildOptimizedProject: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_NGCEDNHJ.StateNodeAttributes,
|
|
22
|
+
buildConfigDescription: () => import_chunk_NGCEDNHJ.buildConfigDescription,
|
|
23
|
+
buildOptimizedProject: () => import_chunk_NGCEDNHJ.buildOptimizedProject,
|
|
24
24
|
copyRecursiveAsNeeded: () => import_chunk_OASVKTK5.copyRecursiveAsNeeded,
|
|
25
|
-
defaultConfig: () =>
|
|
26
|
-
display: () =>
|
|
27
|
-
generateOneConfig: () =>
|
|
28
|
-
generateOptimizedProject: () =>
|
|
29
|
-
getConfig: () =>
|
|
30
|
-
getFnMapAnalysis: () =>
|
|
31
|
-
getProjectAnalysis: () =>
|
|
32
|
-
get_jungle: () =>
|
|
33
|
-
isErrorWithLocation: () =>
|
|
34
|
-
launchSimulator: () =>
|
|
35
|
-
manifestProducts: () =>
|
|
36
|
-
mctree: () =>
|
|
37
|
-
simulateProgram: () =>
|
|
25
|
+
defaultConfig: () => import_chunk_NGCEDNHJ.defaultConfig,
|
|
26
|
+
display: () => import_chunk_NGCEDNHJ.display,
|
|
27
|
+
generateOneConfig: () => import_chunk_NGCEDNHJ.generateOneConfig,
|
|
28
|
+
generateOptimizedProject: () => import_chunk_NGCEDNHJ.generateOptimizedProject,
|
|
29
|
+
getConfig: () => import_chunk_NGCEDNHJ.getConfig,
|
|
30
|
+
getFnMapAnalysis: () => import_chunk_NGCEDNHJ.getFnMapAnalysis,
|
|
31
|
+
getProjectAnalysis: () => import_chunk_NGCEDNHJ.getProjectAnalysis,
|
|
32
|
+
get_jungle: () => import_chunk_NGCEDNHJ.get_jungle,
|
|
33
|
+
isErrorWithLocation: () => import_chunk_NGCEDNHJ.isErrorWithLocation,
|
|
34
|
+
launchSimulator: () => import_chunk_NGCEDNHJ.launchSimulator,
|
|
35
|
+
manifestProducts: () => import_chunk_NGCEDNHJ.manifestProducts,
|
|
36
|
+
mctree: () => import_chunk_NGCEDNHJ.mctree,
|
|
37
|
+
simulateProgram: () => import_chunk_NGCEDNHJ.simulateProgram
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(optimizer_exports);
|
|
40
|
-
var
|
|
40
|
+
var import_chunk_NGCEDNHJ = require("./chunk-NGCEDNHJ.cjs");
|
|
41
41
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
42
42
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
43
43
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
44
|
-
(0,
|
|
44
|
+
(0, import_chunk_NGCEDNHJ.init_optimizer)();
|
|
45
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
46
|
0 && (module.exports = {
|
|
47
47
|
StateNodeAttributes,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -18,25 +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_NGCEDNHJ.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_NGCEDNHJ.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_NGCEDNHJ.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_NGCEDNHJ.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_NGCEDNHJ.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_NGCEDNHJ.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_NGCEDNHJ.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_NGCEDNHJ.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_NGCEDNHJ.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_NGCEDNHJ.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_NGCEDNHJ.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_NGCEDNHJ.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_NGCEDNHJ = require("./chunk-NGCEDNHJ.cjs");
|
|
36
36
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
37
37
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
38
38
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
39
|
-
(0,
|
|
39
|
+
(0, import_chunk_NGCEDNHJ.init_sdk_util)();
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
SectionKinds,
|
package/build/src/optimizer.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export type Analysis = {
|
|
|
82
82
|
* @param {string[]} dependencyFiles
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
|
-
export declare function generateOneConfig(buildConfig: JungleQualifier, manifestXML: xmlUtil.Document, dependencyFiles: string[], config: BuildConfig): Promise<{
|
|
85
|
+
export declare function generateOneConfig(buildConfig: JungleQualifier, manifestXML: xmlUtil.Document, dependencyFiles: string[], config: BuildConfig, key: string): Promise<{
|
|
86
86
|
hasTests: boolean;
|
|
87
87
|
diagnostics: ProgramState["diagnostics"];
|
|
88
88
|
sdkVersion: number | undefined;
|
package/build/worker-thread.cjs
CHANGED
|
@@ -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
|
|
24
|
+
var import_chunk_NGCEDNHJ = require("./chunk-NGCEDNHJ.cjs");
|
|
25
25
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
26
26
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
27
27
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
28
28
|
var import_node_worker_threads = require("node:worker_threads");
|
|
29
29
|
var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
30
30
|
"src/worker-thread.ts"() {
|
|
31
|
-
(0,
|
|
31
|
+
(0, import_chunk_NGCEDNHJ.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,
|
|
34
|
+
return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_NGCEDNHJ.performTask)(task));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
package/package.json
CHANGED