synthesisui 0.16.190 → 0.16.191

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/index.js CHANGED
@@ -643,6 +643,33 @@ async function recordRun(command, started, ok, error, bytes) {
643
643
  const root = resolve(typeof parseFlags(process.argv.slice(2)).flags.dir === "string"
644
644
  ? parseFlags(process.argv.slice(2)).flags.dir
645
645
  : process.cwd());
646
+ /**
647
+ * ONDE, DENTRO DO NOSSO CÓDIGO, e é o que separa uma queda consertável de uma inútil.
648
+ *
649
+ * `Cannot read properties of undefined` sem lugar nenhum não se conserta daqui - a única saída
650
+ * seria pedir para a pessoa reproduzir, que é exatamente o que não pode acontecer (dono, 09/08:
651
+ * *"não quero pedir para o usuário rodar alguma coisa porque a gente não pegou"*).
652
+ *
653
+ * O primeiro quadro da pilha que aponta para o NOSSO pacote resolve isso, e ele não é dado dele:
654
+ * `index.js:1234` é o nosso bundle. O diretório - que é o cache de npx na máquina dele - fica de
655
+ * fora, e um quadro que não seja nosso é descartado em vez de viajar.
656
+ */
657
+ const frame = (() => {
658
+ const stack = error instanceof Error ? (error.stack ?? "") : "";
659
+ for (const line of stack.split("\n").slice(1)) {
660
+ const at = /\(?([^()\s]+\.js):(\d+):(\d+)\)?\s*$/.exec(line.trim());
661
+ if (!at)
662
+ continue;
663
+ const file = at[1].split("/").pop() ?? "";
664
+ /** Só o nosso bundle e os nossos módulos: um quadro do Node ou de outro pacote não é nosso. */
665
+ if (!file || /node:/.test(at[1]))
666
+ continue;
667
+ if (!at[1].includes("synthesisui") && !at[1].endsWith("/dist/index.js"))
668
+ continue;
669
+ return `${file}:${at[2]}`;
670
+ }
671
+ return "";
672
+ })();
646
673
  const message = scrub(error instanceof Error ? error.message : error ? String(error) : "");
647
674
  await appendEvent(root, {
648
675
  kind: "run",
@@ -653,6 +680,7 @@ async function recordRun(command, started, ok, error, bytes) {
653
680
  /** Só a primeira linha, cortada: uma stack carrega caminhos do projeto de alguém. */
654
681
  ...(message ? { error: message.split("\n")[0].slice(0, 200) } : {}),
655
682
  ...(typeof bytes === "number" && bytes > 0 ? { bytes } : {}),
683
+ ...(frame ? { where: frame } : {}),
656
684
  });
657
685
  }
658
686
  catch {
@@ -55,6 +55,7 @@ export async function repoStateOf(projectRoot, slug, cli) {
55
55
  ...(typeof e.ms === "number" ? { ms: Math.round(e.ms) } : {}),
56
56
  ...(e.error ? { error: String(e.error).slice(0, 200) } : {}),
57
57
  ...(typeof e.bytes === "number" ? { bytes: Math.round(e.bytes) } : {}),
58
+ ...(e.where ? { where: String(e.where).slice(0, 60) } : {}),
58
59
  }));
59
60
  const doctor = events
60
61
  .filter((e) => e.kind === "doctor" && e.at)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.190",
3
+ "version": "0.16.191",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {