nerdgram1337 1.5.1 → 1.6.1

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.
@@ -1925,6 +1925,24 @@ function escapeRegExp(value) {
1925
1925
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1926
1926
  }
1927
1927
 
1928
+ // server/src/warningMute.ts
1929
+ var DIRECTIVE = /^[ \t]*%%[ \t]*nerdgram:[ \t]*warnings[ \t]*=[ \t]*muted[ \t]*$/;
1930
+ function warningsMuted(source) {
1931
+ return splitSource(source).lines.some((line) => DIRECTIVE.test(line));
1932
+ }
1933
+ function omitMutedWarnings(source, diagnostics) {
1934
+ if (!warningsMuted(source)) return [...diagnostics];
1935
+ return diagnostics.filter((item) => item.severity !== "warning");
1936
+ }
1937
+ function splitSource(source) {
1938
+ const ending = source.includes("\r\n") ? "\r\n" : "\n";
1939
+ const trailing = source.endsWith("\n");
1940
+ if (source.length === 0) return { lines: [], ending, trailing: false };
1941
+ const parts = source.split(/\r?\n/);
1942
+ if (trailing) parts.pop();
1943
+ return { lines: parts, ending, trailing };
1944
+ }
1945
+
1928
1946
  // server/src/mermaidSyntax.ts
1929
1947
  async function mermaidSyntaxDiagnostic(source) {
1930
1948
  if (!source.trim()) return null;
@@ -1953,10 +1971,10 @@ async function mermaidSyntaxDiagnostic(source) {
1953
1971
  async function lintDiagramSource(source, options = {}) {
1954
1972
  const diagnostics = lintDiagram(source, options);
1955
1973
  const syntax = await mermaidSyntaxDiagnostic(source);
1956
- if (!syntax) return diagnostics;
1957
- return [...diagnostics, syntax].sort(
1974
+ const combined = !syntax ? diagnostics : [...diagnostics, syntax].sort(
1958
1975
  (a, b) => a.from - b.from || a.line - b.line || String(a.ruleId).localeCompare(String(b.ruleId))
1959
1976
  );
1977
+ return omitMutedWarnings(source, combined);
1960
1978
  }
1961
1979
  export {
1962
1980
  lintDiagramSource,
package/dist/cli.js CHANGED
@@ -116,7 +116,7 @@ function loadRender() {
116
116
  return renderModule;
117
117
  }
118
118
  async function loadLint() {
119
- return import("./chunk-FIAVRIHI.js");
119
+ return import("./chunk-7YIBJCTH.js");
120
120
  }
121
121
  async function templateCommand(parsed, io) {
122
122
  const sub = parsed.positionals[0] ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nerdgram1337",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "Command-line client for a local NerdGram1337 server",
5
5
  "type": "module",
6
6
  "license": "MIT",