@markw65/monkeyc-optimizer 1.0.4 → 1.0.6

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 CHANGED
@@ -29,4 +29,13 @@ Initial release
29
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
30
  - Generate separate debug/release jungle files.
31
31
 
32
+ ### 1.0.5
33
+
34
+ - Bump to version 1.0.11 of `@markw65/prettier-plugin-monkeyc` to fix an ObjectLiteral parsing issue.
35
+
36
+ ### 1.0.6
37
+
38
+ - Bump to version 1.0.12 of `@markw65/prettier-plugin-monkeyc` to fix multiple parser bugs
39
+ - Add lots of open source projects as tests. For now, just verify that optimizing the sources succeeds, not that the generated source is actually correct.
40
+
32
41
  ---
@@ -7440,6 +7440,7 @@ function resolve_node(state, node) {
7440
7440
  }
7441
7441
 
7442
7442
  function resolve_filename(literal, default_source) {
7443
+ if (typeof literal === "string") return literal;
7443
7444
  const root = external_path_namespaceObject.dirname(literal.source || default_source);
7444
7445
  return external_path_namespaceObject.resolve(root, literal.value);
7445
7446
  }
@@ -7480,10 +7481,14 @@ async function resolve_literals(qualifier, default_source) {
7480
7481
  await resolve_one_file_list(qualifier, "resourcePath");
7481
7482
  await resolve_one_file_list(qualifier, "barrelPath");
7482
7483
  const lang = qualifier["lang"];
7483
- await Promise.all(
7484
- Object.keys(lang).map((key) => resolve_one_file_list(lang, key))
7485
- );
7486
- if (Object.keys(lang).length === 0) delete qualifier["lang"];
7484
+ if (lang) {
7485
+ await Promise.all(
7486
+ Object.keys(lang).map((key) => resolve_one_file_list(lang, key))
7487
+ );
7488
+ if (Object.keys(lang).length === 0) delete qualifier["lang"];
7489
+ } else {
7490
+ delete qualifier["lang"];
7491
+ }
7487
7492
 
7488
7493
  const resolve_literal_list = (base, name) => {
7489
7494
  const literals = base[name];
@@ -7635,7 +7640,7 @@ const prettier_plugin_monkeyc_namespaceObject = require("@markw65/prettier-plugi
7635
7640
 
7636
7641
  function processImports(allImports, lookup) {
7637
7642
  allImports.forEach(({ node, stack }) => {
7638
- const [name, module] = lookup(node.id, node.as && node.as.id.name, stack);
7643
+ const [name, module] = lookup(node.id, node.as && node.as.name, stack);
7639
7644
  if (name && module) {
7640
7645
  const [parent] = stack.slice(-1);
7641
7646
  if (!parent.decls) parent.decls = {};
@@ -8122,6 +8127,8 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
8122
8127
  state.exposed[node.name] = true;
8123
8128
  }
8124
8129
  }
8130
+ // Don't optimize the property.
8131
+ return ["object"];
8125
8132
  }
8126
8133
  break;
8127
8134
  case "FunctionDeclaration": {
@@ -8369,6 +8376,9 @@ async function generateOptimizedProject(options) {
8369
8376
  if (!(0,external_api_cjs_namespaceObject.hasProperty)(buildConfigs, key)) {
8370
8377
  p.group.dir = key;
8371
8378
  buildConfigs[key] = null;
8379
+ if (p.group.optimizerConfig["excludeAnnotations"] == null) {
8380
+ p.group.optimizerConfig["excludeAnnotations"] = [];
8381
+ }
8372
8382
  // Note that we exclude (:debug) in release builds, and we
8373
8383
  // exclude (:release) in debug builds. This isn't backwards!
8374
8384
  p.group.optimizerConfig["excludeAnnotations"].push(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "exports": {
@@ -23,7 +23,7 @@
23
23
  "author": "markw65",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@markw65/prettier-plugin-monkeyc": "^1.0.10"
26
+ "@markw65/prettier-plugin-monkeyc": "^1.0.12"
27
27
  },
28
28
  "devDependencies": {
29
29
  "eslint": "^8.12.0",