@holo-js/cli 0.1.6 → 0.1.8

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.
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-57SJ566R.mjs";
4
4
  import {
5
5
  prepareProjectDiscovery
6
- } from "./chunk-UZTDQKIY.mjs";
6
+ } from "./chunk-D4NXGVV4.mjs";
7
7
  import {
8
8
  loadProjectConfig,
9
9
  resolveGeneratedSchemaPath
10
- } from "./chunk-5BLEC66P.mjs";
10
+ } from "./chunk-DFKX4YT4.mjs";
11
11
  import {
12
12
  loadGeneratedProjectRegistry
13
- } from "./chunk-MXKNQACM.mjs";
13
+ } from "./chunk-O6AXHL7Z.mjs";
14
14
  import {
15
15
  CLI_RUNTIME_ROOT,
16
16
  bundleProjectModule
@@ -566,11 +566,11 @@ function runRuntimeInvocation(command, args, options) {
566
566
  function getRuntimeFailureMessage(kind, result) {
567
567
  const stderr = result.stderr?.trim();
568
568
  if (stderr) {
569
- return stderr;
569
+ return formatRuntimeFailureText(stderr);
570
570
  }
571
571
  const stdout = result.stdout?.trim();
572
572
  if (stdout) {
573
- return stdout;
573
+ return formatRuntimeFailureText(stdout);
574
574
  }
575
575
  const errorCode = result.error && "code" in result.error ? result.error.code : void 0;
576
576
  if (typeof errorCode === "string" && errorCode.length > 0) {
@@ -578,6 +578,24 @@ function getRuntimeFailureMessage(kind, result) {
578
578
  }
579
579
  return `Runtime command "${kind}" failed.`;
580
580
  }
581
+ function stripRuntimeErrorPrefix(line) {
582
+ return line.replace(/^(?:[A-Za-z][\w.]*Error|Error):\s+/, "");
583
+ }
584
+ function isRuntimeErrorSourceLine(line) {
585
+ return line.startsWith("throw ") || line.startsWith("at ") || line === "^" || /^\^+$/.test(line);
586
+ }
587
+ function formatRuntimeFailureText(text) {
588
+ const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
589
+ const friendlyLine = lines.find((line) => line.includes("Unable to ") && !isRuntimeErrorSourceLine(line));
590
+ if (friendlyLine) {
591
+ return stripRuntimeErrorPrefix(friendlyLine);
592
+ }
593
+ const errorLine = lines.find((line) => /^(?:[A-Za-z][\w.]*Error|Error):\s+/.test(line));
594
+ if (errorLine) {
595
+ return stripRuntimeErrorPrefix(errorLine);
596
+ }
597
+ return lines[0] ?? text.trim();
598
+ }
581
599
  async function withRuntimeEnvironment(projectRoot, kind, options, callback) {
582
600
  if (kind === "seed") {
583
601
  const project = await loadProjectConfig(projectRoot, { required: true });