schematex 0.9.14 → 0.9.15

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.
@@ -8055,8 +8055,8 @@ function parseNote(ln, state2) {
8055
8055
  throw new UsecaseParseError(`unterminated note block`, ln.line);
8056
8056
  }
8057
8057
  function defaultIdFor(name) {
8058
- const safe = name.replace(/[^A-Za-z0-9_]/g, "_");
8059
- return /^[A-Za-z_]/.test(safe) ? safe : "_" + safe;
8058
+ const safe = name.replace(/[^\p{L}\p{N}_]/gu, "_");
8059
+ return /^[\p{L}_]/u.test(safe) ? safe : "_" + safe;
8060
8060
  }
8061
8061
  function parseRelation(ln, state2) {
8062
8062
  const op = findRelOp(ln.text);
@@ -13446,7 +13446,33 @@ var KIND_ALIASES = {
13446
13446
  ips: "ids",
13447
13447
  decoder: "encoder",
13448
13448
  videowall: "monitor",
13449
- segment: "lan"
13449
+ segment: "lan",
13450
+ // Common everyday synonyms a model reaches for. A specific server role still
13451
+ // renders as a generic `server` (with its label) instead of hard-failing.
13452
+ webserver: "server",
13453
+ mailserver: "server",
13454
+ dns: "server",
13455
+ dhcp: "server",
13456
+ ntp: "server",
13457
+ database: "server",
13458
+ dbserver: "server",
13459
+ db: "server",
13460
+ vm: "server",
13461
+ host: "server",
13462
+ hypervisor: "server",
13463
+ activedirectory: "server",
13464
+ domaincontroller: "server",
13465
+ desktop: "pc",
13466
+ smartphone: "mobile",
13467
+ tablet: "mobile",
13468
+ accesspoint: "ap",
13469
+ wap: "ap",
13470
+ hub: "switch",
13471
+ bridge: "switch",
13472
+ l2switch: "switch",
13473
+ ngfw: "firewall",
13474
+ utm: "firewall",
13475
+ mfp: "printer"
13450
13476
  };
13451
13477
  var GROUP_KINDS = /* @__PURE__ */ new Set(["site", "building", "campus", "rack", "subnet", "vlan", "zone", "dmz"]);
13452
13478
  var GROUP_KIND_ALIAS = { building: "site", campus: "site" };
@@ -42798,6 +42824,24 @@ function normalizeHeader(text2, type) {
42798
42824
  }
42799
42825
  return text2;
42800
42826
  }
42827
+ function headerCandidates(type) {
42828
+ if (type === "erd") return ["erDiagram", "erd"];
42829
+ return [type];
42830
+ }
42831
+ function recoverHeader(plugin, prepared, forced) {
42832
+ if (!forced || !plugin.parse || plugin.detect(prepared)) return prepared;
42833
+ for (const hdr of headerCandidates(plugin.type)) {
42834
+ const candidate = `${hdr}
42835
+ ${prepared}`;
42836
+ if (!plugin.detect(candidate)) continue;
42837
+ try {
42838
+ plugin.parse(candidate);
42839
+ return candidate;
42840
+ } catch {
42841
+ }
42842
+ }
42843
+ return prepared;
42844
+ }
42801
42845
  function preprocess9(text2) {
42802
42846
  const { data, body: rawBody } = chunk3TGOOZ36_cjs.parseFrontmatter(stripCodeFences(text2));
42803
42847
  const body = chunk3TGOOZ36_cjs.stripComments(rawBody, chunk3TGOOZ36_cjs.UNIVERSAL_COMMENT_MARKERS);
@@ -42816,11 +42860,14 @@ function preprocess9(text2) {
42816
42860
  function parse(text2, config) {
42817
42861
  const prepared0 = preprocess9(text2);
42818
42862
  const plugin = detectPlugin(prepared0, config);
42819
- const prepared = normalizeHeader(prepared0, plugin.type);
42820
- if (plugin.parse) return plugin.parse(prepared);
42821
- throw new Error(
42822
- `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42823
- );
42863
+ if (!plugin.parse) {
42864
+ throw new Error(
42865
+ `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42866
+ );
42867
+ }
42868
+ const forced = config?.type != null && plugin.type === config.type;
42869
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42870
+ return plugin.parse(prepared);
42824
42871
  }
42825
42872
  function parseResult(text2, config) {
42826
42873
  let plugin;
@@ -42832,7 +42879,8 @@ function parseResult(text2, config) {
42832
42879
  `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42833
42880
  );
42834
42881
  }
42835
- const prepared = normalizeHeader(prepared0, plugin.type);
42882
+ const forced = config?.type != null && plugin.type === config.type;
42883
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42836
42884
  const ast = plugin.parse(prepared);
42837
42885
  const diagnostics = runLint(plugin, prepared);
42838
42886
  return {
@@ -42863,7 +42911,8 @@ function render(text2, config) {
42863
42911
  if (config?.mode === "preview") return renderResult(text2, config).svg;
42864
42912
  const prepared0 = preprocess9(text2);
42865
42913
  const plugin = detectPlugin(prepared0, config);
42866
- const prepared = normalizeHeader(prepared0, plugin.type);
42914
+ const forced = config?.type != null && plugin.type === config.type;
42915
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42867
42916
  return renderWithPlugin(prepared, plugin, config);
42868
42917
  }
42869
42918
  function renderResult(text2, config) {
@@ -42871,7 +42920,8 @@ function renderResult(text2, config) {
42871
42920
  try {
42872
42921
  const prepared0 = preprocess9(text2);
42873
42922
  plugin = detectPlugin(prepared0, config);
42874
- const prepared = normalizeHeader(prepared0, plugin.type);
42923
+ const forced = config?.type != null && plugin.type === config.type;
42924
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42875
42925
  const svg = renderWithPlugin(prepared, plugin, config);
42876
42926
  const diagnostics = runLint(plugin, prepared);
42877
42927
  return {
@@ -42944,5 +42994,5 @@ exports.timeline = timeline;
42944
42994
  exports.umlclass = umlclass;
42945
42995
  exports.usecase = usecase;
42946
42996
  exports.welding = welding;
42947
- //# sourceMappingURL=chunk-V5TY3N2W.cjs.map
42948
- //# sourceMappingURL=chunk-V5TY3N2W.cjs.map
42997
+ //# sourceMappingURL=chunk-O4XRVW3R.cjs.map
42998
+ //# sourceMappingURL=chunk-O4XRVW3R.cjs.map