schematex 0.9.16 → 0.9.18

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.
@@ -1654,7 +1654,7 @@ function parseNetlist(body, title2) {
1654
1654
  for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
1655
1655
  const raw = lines[lineIdx];
1656
1656
  if (/^\s*\*/.test(raw)) continue;
1657
- const stripped = raw.replace(/#.*$/, "").trim();
1657
+ const stripped = raw.replace(/[#;].*$/, "").trim();
1658
1658
  if (!stripped) continue;
1659
1659
  const tokens = tokenize(stripped);
1660
1660
  if (tokens.length < 2) {
@@ -2019,12 +2019,12 @@ function parseAttrs(rest) {
2019
2019
  }
2020
2020
  function parseCircuit(text2) {
2021
2021
  const rawLines = text2.split("\n");
2022
- const firstMeaningful = rawLines.map((l) => l.replace(/#.*$/, "").trim()).find((l) => l.length > 0) ?? "";
2022
+ const firstMeaningful = rawLines.map((l) => l.replace(/[#;].*$/, "").trim()).find((l) => l.length > 0) ?? "";
2023
2023
  if (/^circuit\b.*\bnetlist\s*$/i.test(firstMeaningful)) {
2024
2024
  const netlistTitle = matchQuotedTitle(firstMeaningful);
2025
2025
  let headerIdx = -1;
2026
2026
  for (let i = 0; i < rawLines.length; i++) {
2027
- const s = rawLines[i].replace(/#.*$/, "").trim();
2027
+ const s = rawLines[i].replace(/[#;].*$/, "").trim();
2028
2028
  if (s.length > 0) {
2029
2029
  headerIdx = i;
2030
2030
  break;
@@ -2042,7 +2042,7 @@ function parseCircuit(text2) {
2042
2042
  let pendingAt;
2043
2043
  const mkId = (prefix) => `${prefix}_${autoId++}`;
2044
2044
  for (const rawLine of lines) {
2045
- const stripped = rawLine.replace(/#.*$/, "").trim();
2045
+ const stripped = rawLine.replace(/[#;].*$/, "").trim();
2046
2046
  if (!stripped) continue;
2047
2047
  if (/^circuit\b/i.test(stripped)) {
2048
2048
  const t = matchQuotedTitle(stripped);
@@ -2141,7 +2141,9 @@ function parseCircuit(text2) {
2141
2141
  const typeStr = bareMatch[1];
2142
2142
  const norm = normalizeType(typeStr);
2143
2143
  if (!norm) {
2144
- continue;
2144
+ throw new CircuitParseError(
2145
+ `Unknown component type: "${typeStr}". For SPICE-style connectivity (Id net1 net2 [value]), start the diagram with the \`netlist\` header: circuit "..." netlist.`
2146
+ );
2145
2147
  }
2146
2148
  const rest = bareMatch[2] ?? "";
2147
2149
  const parsed = parseAttrs(rest);
@@ -2881,5 +2883,5 @@ var circuit = {
2881
2883
  };
2882
2884
 
2883
2885
  export { EXTRA_SYMBOLS, SYMBOLS, circuit, layoutCircuit, layoutCircuitNetlist, lintCircuit, parseCircuit, parseNetlist, renderCircuit };
2884
- //# sourceMappingURL=chunk-37WDY4G4.js.map
2885
- //# sourceMappingURL=chunk-37WDY4G4.js.map
2886
+ //# sourceMappingURL=chunk-FA6Y4QRS.js.map
2887
+ //# sourceMappingURL=chunk-FA6Y4QRS.js.map