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.
@@ -8053,8 +8053,8 @@ function parseNote(ln, state2) {
8053
8053
  throw new UsecaseParseError(`unterminated note block`, ln.line);
8054
8054
  }
8055
8055
  function defaultIdFor(name) {
8056
- const safe = name.replace(/[^A-Za-z0-9_]/g, "_");
8057
- return /^[A-Za-z_]/.test(safe) ? safe : "_" + safe;
8056
+ const safe = name.replace(/[^\p{L}\p{N}_]/gu, "_");
8057
+ return /^[\p{L}_]/u.test(safe) ? safe : "_" + safe;
8058
8058
  }
8059
8059
  function parseRelation(ln, state2) {
8060
8060
  const op = findRelOp(ln.text);
@@ -13444,7 +13444,33 @@ var KIND_ALIASES = {
13444
13444
  ips: "ids",
13445
13445
  decoder: "encoder",
13446
13446
  videowall: "monitor",
13447
- segment: "lan"
13447
+ segment: "lan",
13448
+ // Common everyday synonyms a model reaches for. A specific server role still
13449
+ // renders as a generic `server` (with its label) instead of hard-failing.
13450
+ webserver: "server",
13451
+ mailserver: "server",
13452
+ dns: "server",
13453
+ dhcp: "server",
13454
+ ntp: "server",
13455
+ database: "server",
13456
+ dbserver: "server",
13457
+ db: "server",
13458
+ vm: "server",
13459
+ host: "server",
13460
+ hypervisor: "server",
13461
+ activedirectory: "server",
13462
+ domaincontroller: "server",
13463
+ desktop: "pc",
13464
+ smartphone: "mobile",
13465
+ tablet: "mobile",
13466
+ accesspoint: "ap",
13467
+ wap: "ap",
13468
+ hub: "switch",
13469
+ bridge: "switch",
13470
+ l2switch: "switch",
13471
+ ngfw: "firewall",
13472
+ utm: "firewall",
13473
+ mfp: "printer"
13448
13474
  };
13449
13475
  var GROUP_KINDS = /* @__PURE__ */ new Set(["site", "building", "campus", "rack", "subnet", "vlan", "zone", "dmz"]);
13450
13476
  var GROUP_KIND_ALIAS = { building: "site", campus: "site" };
@@ -42796,6 +42822,24 @@ function normalizeHeader(text2, type) {
42796
42822
  }
42797
42823
  return text2;
42798
42824
  }
42825
+ function headerCandidates(type) {
42826
+ if (type === "erd") return ["erDiagram", "erd"];
42827
+ return [type];
42828
+ }
42829
+ function recoverHeader(plugin, prepared, forced) {
42830
+ if (!forced || !plugin.parse || plugin.detect(prepared)) return prepared;
42831
+ for (const hdr of headerCandidates(plugin.type)) {
42832
+ const candidate = `${hdr}
42833
+ ${prepared}`;
42834
+ if (!plugin.detect(candidate)) continue;
42835
+ try {
42836
+ plugin.parse(candidate);
42837
+ return candidate;
42838
+ } catch {
42839
+ }
42840
+ }
42841
+ return prepared;
42842
+ }
42799
42843
  function preprocess9(text2) {
42800
42844
  const { data, body: rawBody } = parseFrontmatter(stripCodeFences(text2));
42801
42845
  const body = stripComments(rawBody, UNIVERSAL_COMMENT_MARKERS);
@@ -42814,11 +42858,14 @@ function preprocess9(text2) {
42814
42858
  function parse(text2, config) {
42815
42859
  const prepared0 = preprocess9(text2);
42816
42860
  const plugin = detectPlugin(prepared0, config);
42817
- const prepared = normalizeHeader(prepared0, plugin.type);
42818
- if (plugin.parse) return plugin.parse(prepared);
42819
- throw new Error(
42820
- `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42821
- );
42861
+ if (!plugin.parse) {
42862
+ throw new Error(
42863
+ `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42864
+ );
42865
+ }
42866
+ const forced = config?.type != null && plugin.type === config.type;
42867
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42868
+ return plugin.parse(prepared);
42822
42869
  }
42823
42870
  function parseResult(text2, config) {
42824
42871
  let plugin;
@@ -42830,7 +42877,8 @@ function parseResult(text2, config) {
42830
42877
  `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42831
42878
  );
42832
42879
  }
42833
- const prepared = normalizeHeader(prepared0, plugin.type);
42880
+ const forced = config?.type != null && plugin.type === config.type;
42881
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42834
42882
  const ast = plugin.parse(prepared);
42835
42883
  const diagnostics = runLint(plugin, prepared);
42836
42884
  return {
@@ -42861,7 +42909,8 @@ function render(text2, config) {
42861
42909
  if (config?.mode === "preview") return renderResult(text2, config).svg;
42862
42910
  const prepared0 = preprocess9(text2);
42863
42911
  const plugin = detectPlugin(prepared0, config);
42864
- const prepared = normalizeHeader(prepared0, plugin.type);
42912
+ const forced = config?.type != null && plugin.type === config.type;
42913
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42865
42914
  return renderWithPlugin(prepared, plugin, config);
42866
42915
  }
42867
42916
  function renderResult(text2, config) {
@@ -42869,7 +42918,8 @@ function renderResult(text2, config) {
42869
42918
  try {
42870
42919
  const prepared0 = preprocess9(text2);
42871
42920
  plugin = detectPlugin(prepared0, config);
42872
- const prepared = normalizeHeader(prepared0, plugin.type);
42921
+ const forced = config?.type != null && plugin.type === config.type;
42922
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42873
42923
  const svg = renderWithPlugin(prepared, plugin, config);
42874
42924
  const diagnostics = runLint(plugin, prepared);
42875
42925
  return {
@@ -42907,5 +42957,5 @@ function renderWithPlugin(prepared, plugin, config) {
42907
42957
  }
42908
42958
 
42909
42959
  export { FLOORPLAN_SYMBOLS, GEOMETRY, bowtie2 as bowtie, causalloop, comparison, decisiontree, drawDeviceIcon, epc, eventtree, faulttree, floorplan, fmea, gitgraph, iconSize, idef0, markov, network, parse, parseResult, pert, petri, pid, playbook, prisma, rbd, render, renderEquip, renderPreview, renderResult, sequence, state, threatmodel, timeline, umlclass, usecase, welding };
42910
- //# sourceMappingURL=chunk-JG5CVYXC.js.map
42911
- //# sourceMappingURL=chunk-JG5CVYXC.js.map
42960
+ //# sourceMappingURL=chunk-F72IQZ6O.js.map
42961
+ //# sourceMappingURL=chunk-F72IQZ6O.js.map