@markw65/monkeyc-optimizer 1.0.3 → 1.0.4
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 +6 -0
- package/build/api.cjs +1 -0
- package/build/optimizer.cjs +7 -2
- package/build/util.cjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,4 +23,10 @@ Initial release
|
|
|
23
23
|
- Split the build into release and debug, so we can exclude code based on (:release) and (:debug)
|
|
24
24
|
- Optimize away `if (constant)`, `while (false)` and `constant ? E1 : E2`. Convert `do BODY while(false)` to `BODY`
|
|
25
25
|
|
|
26
|
+
### 1.0.4
|
|
27
|
+
|
|
28
|
+
- Fix a bug resulting in a failure to fully optimize constants initialized by constant conditional expressions
|
|
29
|
+
- Make the generated .cjs files work better with es modules (vscode doesn't work with es modules, so prettier-extension-monkeyc doesn't care - but for other projects importing this package it improves the behavior)
|
|
30
|
+
- Generate separate debug/release jungle files.
|
|
31
|
+
|
|
26
32
|
---
|
package/build/api.cjs
CHANGED
package/build/optimizer.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
0 && (module.exports = {copyRecursiveAsNeeded,launchSimulator,defaultConfig,buildOptimizedProject,generateOptimizedProject,generateApiMirTests});
|
|
1
2
|
/******/ (() => { // webpackBootstrap
|
|
2
3
|
/******/ var __webpack_modules__ = ({
|
|
3
4
|
|
|
@@ -8153,7 +8154,8 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
|
|
|
8153
8154
|
case "IfStatement":
|
|
8154
8155
|
if (typeof node.test === "boolean") {
|
|
8155
8156
|
const rep = node.test ? node.consequent : node.alternate;
|
|
8156
|
-
|
|
8157
|
+
if (!rep) return false;
|
|
8158
|
+
replace(node, rep);
|
|
8157
8159
|
}
|
|
8158
8160
|
break;
|
|
8159
8161
|
case "WhileStatement":
|
|
@@ -8428,7 +8430,10 @@ async function generateOptimizedProject(options) {
|
|
|
8428
8430
|
}
|
|
8429
8431
|
});
|
|
8430
8432
|
|
|
8431
|
-
const jungleFiles = external_path_namespaceObject.join(
|
|
8433
|
+
const jungleFiles = external_path_namespaceObject.join(
|
|
8434
|
+
jungle_dir,
|
|
8435
|
+
`${config.releaseBuild ? "release" : "debug"}.jungle`
|
|
8436
|
+
);
|
|
8432
8437
|
promises.push(promises_namespaceObject.writeFile(jungleFiles, parts.join("\n")));
|
|
8433
8438
|
await Promise.all(promises);
|
|
8434
8439
|
return { jungleFiles, program: external_path_namespaceObject.basename(external_path_namespaceObject.dirname(manifest)) };
|
package/build/util.cjs
CHANGED