@nodii/dev 0.6.99 → 0.6.100

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/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.99";
7
+ export const VERSION = "0.6.100";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/surface.js CHANGED
@@ -460,7 +460,7 @@ const JS_LITERALS = new Set(["true", "false", "null", "undefined", "this"]);
460
460
 
461
461
  function dataProps(views) {
462
462
  const data = new Map();
463
- const entry = (name) => data.get(name) ?? data.set(name, { attrs: new Set(), child: false, members: new Map() }).get(name);
463
+ const entry = (name) => data.get(name) ?? data.set(name, { attrs: new Set(), child: false, nested: false, members: new Map() }).get(name);
464
464
  for (const view of views) {
465
465
  view.uses = new Set();
466
466
  const body = view.body;
@@ -479,6 +479,14 @@ function dataProps(views) {
479
479
  entry(m[2]).child = true;
480
480
  view.uses.add(m[2]);
481
481
  }
482
+ // A value inside an object prop (`chip={{ label: chipLabel }}`, `points: series1Points`).
483
+ // Strings go first, so a colon in text or a class name is never read as one.
484
+ const noStrings = body.replace(/"(?:[^"\\\n]|\\.)*"|`[^`]*`/g, '""');
485
+ for (const m of noStrings.matchAll(/\b[A-Za-z_]\w*:\s*([a-z][A-Za-z0-9]*)(?=\s*[,}\]])/g)) {
486
+ if (JS_LITERALS.has(m[1])) continue;
487
+ entry(m[1]).nested = true;
488
+ view.uses.add(m[1]);
489
+ }
482
490
  }
483
491
  return data;
484
492
  }
@@ -497,7 +505,8 @@ function openingTag(body, at) {
497
505
  }
498
506
 
499
507
  const propType = (d) => {
500
- const parts = [...d.attrs, ...(d.child ? ["ReactNode"] : [])];
508
+ // A value nested in an object prop has no ComponentProps path the generator can name.
509
+ const parts = [...d.attrs, ...(d.child ? ["ReactNode"] : []), ...(d.nested ? ["any"] : [])];
501
510
  if (d.members.size) parts.push(`{ ${[...d.members.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([k, refs]) => `${k}: ${[...refs].join(" & ")}`).join("; ")} }`);
502
511
  return parts.join(" & ");
503
512
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.99",
3
+ "version": "0.6.100",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {