nerdgram1337 1.5.0 → 1.6.0

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.
@@ -376,6 +376,13 @@ function diagramInitConfig(source, fallbackTheme = FALLBACK_THEME) {
376
376
  init.fontFamily = fontFamily || DEFAULT_FONT_FAMILY;
377
377
  return init;
378
378
  }
379
+ var NODE_LABEL_WRAP_WIDTH = 480;
380
+ function withNodeLabelRoom(config) {
381
+ const current = config.flowchart;
382
+ const block = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
383
+ if (block.wrappingWidth != null) return config;
384
+ return { ...config, flowchart: { ...block, wrappingWidth: NODE_LABEL_WRAP_WIDTH } };
385
+ }
379
386
  function newlineOf(source) {
380
387
  return source.includes("\r\n") ? "\r\n" : "\n";
381
388
  }
@@ -636,6 +643,7 @@ export {
636
643
  parseDiagram,
637
644
  diagramConfigKey,
638
645
  diagramInitConfig,
646
+ withNodeLabelRoom,
639
647
  applyDiagramPatch,
640
648
  literalLocator,
641
649
  searchMatchLabel,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readFile,
3
3
  writeFile
4
- } from "./chunk-MKB7YAGA.js";
4
+ } from "./chunk-JL7RYIQE.js";
5
5
  import {
6
6
  REPO_ROOT,
7
7
  ensureDataRoot,
@@ -11,13 +11,13 @@ import {
11
11
  resolveAvailablePath,
12
12
  resolveSafePath,
13
13
  toRelativePath
14
- } from "./chunk-ULY5YEBR.js";
14
+ } from "./chunk-KA5X3YY6.js";
15
15
  import "./chunk-5C6VO4LC.js";
16
16
  import {
17
17
  applyDiagramPatch,
18
18
  diagramConfigKey,
19
19
  parseDiagram
20
- } from "./chunk-AFGGIQ22.js";
20
+ } from "./chunk-6LCHDAAN.js";
21
21
 
22
22
  // server/src/templates.ts
23
23
  import fs from "node:fs/promises";
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  locateParseError
3
- } from "./chunk-54BVSMKR.js";
3
+ } from "./chunk-WCRNLGMN.js";
4
4
  import {
5
5
  httpFail,
6
6
  sanitizeThumbnailSvg
7
- } from "./chunk-ULY5YEBR.js";
7
+ } from "./chunk-KA5X3YY6.js";
8
8
  import {
9
- diagramInitConfig
10
- } from "./chunk-AFGGIQ22.js";
9
+ diagramInitConfig,
10
+ withNodeLabelRoom
11
+ } from "./chunk-6LCHDAAN.js";
11
12
 
12
13
  // server/src/renderDiagram.ts
13
14
  import { createRequire } from "node:module";
@@ -209,7 +210,7 @@ function plainError(err) {
209
210
  return message.replace(/\s+/g, " ").trim().slice(0, 400) || "Mermaid could not render that diagram.";
210
211
  }
211
212
  async function draw(page, source, background) {
212
- const init = diagramInitConfig(source);
213
+ const init = withNodeLabelRoom(diagramInitConfig(source));
213
214
  init.startOnLoad = false;
214
215
  init.securityLevel = "strict";
215
216
  init.suppressErrorRendering = true;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isMermaidEnvironmentError,
3
3
  locateParseError
4
- } from "./chunk-54BVSMKR.js";
4
+ } from "./chunk-WCRNLGMN.js";
5
5
  import {
6
6
  diagramTargetExists,
7
7
  isDiagramLink,
@@ -17,7 +17,7 @@ import {
17
17
  diagramConfigKey,
18
18
  matchFrontMatter,
19
19
  parseDiagram
20
- } from "./chunk-AFGGIQ22.js";
20
+ } from "./chunk-6LCHDAAN.js";
21
21
 
22
22
  // server/src/mermaidSyntax.ts
23
23
  import mermaid from "mermaid";
@@ -22,7 +22,7 @@ import {
22
22
  safeStorageKey,
23
23
  textFiles,
24
24
  toRelativePath
25
- } from "./chunk-ULY5YEBR.js";
25
+ } from "./chunk-KA5X3YY6.js";
26
26
 
27
27
  // server/src/fsStore.ts
28
28
  import fs2 from "node:fs/promises";
@@ -1469,7 +1469,7 @@ async function writeFile(relativePath, content, options = {}) {
1469
1469
  await atomicWriteText(abs, content);
1470
1470
  await dropThumbnail(relative);
1471
1471
  const stat = await fs2.stat(abs);
1472
- const search = await import("./chunk-FIQWTTCY.js");
1472
+ const search = await import("./chunk-LYMG57VV.js");
1473
1473
  await search.rememberSearchEntry(relative, content, stat.mtimeMs, stat.size);
1474
1474
  await noteDiagramSighting({ path: relative, hash: hashContent(content) });
1475
1475
  noteSync({ kind: "content", summary: `Update ${relative}` });
@@ -1482,7 +1482,7 @@ async function writeFile(relativePath, content, options = {}) {
1482
1482
  };
1483
1483
  }
1484
1484
  function noteSync(change) {
1485
- void import("./chunk-ORJTKOL4.js").then((mod) => mod.noteLocalChange(change)).catch(() => {
1485
+ void import("./chunk-LXSDAIF4.js").then((mod) => mod.noteLocalChange(change)).catch(() => {
1486
1486
  console.error("GitHub sync could not record a local change");
1487
1487
  });
1488
1488
  }
@@ -1,12 +1,12 @@
1
- import "./chunk-MKB7YAGA.js";
1
+ import "./chunk-JL7RYIQE.js";
2
2
  import {
3
3
  ensureDataRoot,
4
4
  getMetaPath,
5
5
  httpFail,
6
6
  isDataFileName
7
- } from "./chunk-ULY5YEBR.js";
7
+ } from "./chunk-KA5X3YY6.js";
8
8
  import "./chunk-5C6VO4LC.js";
9
- import "./chunk-AFGGIQ22.js";
9
+ import "./chunk-6LCHDAAN.js";
10
10
 
11
11
  // server/src/sync/engine.ts
12
12
  import fsp2 from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildTree,
3
3
  readFile
4
- } from "./chunk-MKB7YAGA.js";
4
+ } from "./chunk-JL7RYIQE.js";
5
5
  import {
6
6
  atomicWriteJson,
7
7
  getDataRoot,
@@ -9,14 +9,14 @@ import {
9
9
  httpFail,
10
10
  readJsonFile,
11
11
  rewriteMovedPath
12
- } from "./chunk-ULY5YEBR.js";
12
+ } from "./chunk-KA5X3YY6.js";
13
13
  import "./chunk-5C6VO4LC.js";
14
14
  import {
15
15
  literalLocator,
16
16
  matchDiagramSearch,
17
17
  parseDiagram,
18
18
  searchMatchLabel
19
- } from "./chunk-AFGGIQ22.js";
19
+ } from "./chunk-6LCHDAAN.js";
20
20
 
21
21
  // server/src/search.ts
22
22
  import path from "node:path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  matchFrontMatter
3
- } from "./chunk-AFGGIQ22.js";
3
+ } from "./chunk-6LCHDAAN.js";
4
4
 
5
5
  // server/src/parseError.ts
6
6
  function locateParseError(error, source) {
package/dist/cli.js CHANGED
@@ -112,16 +112,16 @@ not changed. --undo restores that replace and skips a file edited since.
112
112
  `;
113
113
  var renderModule = null;
114
114
  function loadRender() {
115
- renderModule ??= import("./chunk-WORJPG5T.js");
115
+ renderModule ??= import("./chunk-BCO66AYP.js");
116
116
  return renderModule;
117
117
  }
118
118
  async function loadLint() {
119
- return import("./chunk-XJTF2GUE.js");
119
+ return import("./chunk-FIAVRIHI.js");
120
120
  }
121
121
  async function templateCommand(parsed, io) {
122
122
  const sub = parsed.positionals[0] ?? "";
123
123
  const target = parsed.positionals[1] ?? "";
124
- const templates = await import("./chunk-M434Z7CG.js");
124
+ const templates = await import("./chunk-AWVTRON2.js");
125
125
  try {
126
126
  if (sub === "save") {
127
127
  if (!target) throw new CliError("Usage: nerdgram template save <diagram> [--name name] [--replace]");
@@ -166,6 +166,13 @@ var CliError = class extends Error {
166
166
  this.details = details;
167
167
  }
168
168
  };
169
+ function failureStatus(err) {
170
+ if (err instanceof CliError && typeof err.status === "number") return err.status;
171
+ if (err && typeof err === "object" && "status" in err && typeof err.status === "number") {
172
+ return err.status;
173
+ }
174
+ return "error";
175
+ }
169
176
  function formatRowIssues(errors) {
170
177
  if (!Array.isArray(errors)) return [];
171
178
  const lines = [];
@@ -848,11 +855,10 @@ async function main(argv, io = {}) {
848
855
  }
849
856
  } catch (err) {
850
857
  const message = err instanceof Error ? err.message : String(err);
851
- const status = err instanceof CliError ? err.status : void 0;
852
858
  if (isJson(parsed.flags)) {
853
859
  const errors = err instanceof CliError && Array.isArray(err.details?.errors) ? err.details.errors : void 0;
854
860
  streams.stdout(
855
- `${JSON.stringify({ ok: false, error: message, status: status ?? null, ...errors ? { errors } : {} })}
861
+ `${JSON.stringify({ ok: false, error: message, status: failureStatus(err), ...errors ? { errors } : {} })}
856
862
  `
857
863
  );
858
864
  } else streams.stderr(`${message}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nerdgram1337",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Command-line client for a local NerdGram1337 server",
5
5
  "type": "module",
6
6
  "license": "MIT",
File without changes