@vessel-dsp/compiler 0.18.0 → 0.19.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.
Files changed (53) hide show
  1. package/dist/compile.d.ts.map +1 -1
  2. package/dist/compile.js +67 -24
  3. package/dist/compile.js.map +1 -1
  4. package/dist/device-laws.d.ts +12 -0
  5. package/dist/device-laws.d.ts.map +1 -1
  6. package/dist/device-laws.js +108 -4
  7. package/dist/device-laws.js.map +1 -1
  8. package/dist/fixtures/circuits.d.ts +22 -0
  9. package/dist/fixtures/circuits.d.ts.map +1 -1
  10. package/dist/fixtures/circuits.js +54 -0
  11. package/dist/fixtures/circuits.js.map +1 -1
  12. package/dist/latch-seed.d.ts +7 -6
  13. package/dist/latch-seed.d.ts.map +1 -1
  14. package/dist/latch-seed.js +199 -31
  15. package/dist/latch-seed.js.map +1 -1
  16. package/dist/link.d.ts.map +1 -1
  17. package/dist/link.js +4 -3
  18. package/dist/link.js.map +1 -1
  19. package/dist/lower.d.ts.map +1 -1
  20. package/dist/lower.js +155 -0
  21. package/dist/lower.js.map +1 -1
  22. package/dist/netlist.d.ts.map +1 -1
  23. package/dist/netlist.js +43 -1
  24. package/dist/netlist.js.map +1 -1
  25. package/dist/part-catalog.d.ts +21 -0
  26. package/dist/part-catalog.d.ts.map +1 -1
  27. package/dist/part-catalog.js +770 -21
  28. package/dist/part-catalog.js.map +1 -1
  29. package/dist/partition.d.ts.map +1 -1
  30. package/dist/partition.js +5 -0
  31. package/dist/partition.js.map +1 -1
  32. package/dist/registry-data/index.d.ts +1 -0
  33. package/dist/registry-data/index.d.ts.map +1 -1
  34. package/dist/registry-data/index.js +3 -0
  35. package/dist/registry-data/index.js.map +1 -1
  36. package/dist/registry-data/poweramp.d.ts +10 -0
  37. package/dist/registry-data/poweramp.d.ts.map +1 -0
  38. package/dist/registry-data/poweramp.js +191 -0
  39. package/dist/registry-data/poweramp.js.map +1 -0
  40. package/dist/registry-data/schema.d.ts +3 -1
  41. package/dist/registry-data/schema.d.ts.map +1 -1
  42. package/dist/registry-data/schema.js +28 -2
  43. package/dist/registry-data/schema.js.map +1 -1
  44. package/dist/registry.d.ts +89 -1
  45. package/dist/registry.d.ts.map +1 -1
  46. package/dist/registry.js +148 -0
  47. package/dist/registry.js.map +1 -1
  48. package/dist/types.d.ts +126 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/unverified-pinout.d.ts.map +1 -1
  51. package/dist/unverified-pinout.js +8 -1
  52. package/dist/unverified-pinout.js.map +1 -1
  53. package/package.json +2 -2
package/dist/netlist.js CHANGED
@@ -15,7 +15,7 @@
15
15
  // absent; geometry resolves only what neither encoding states. Geometry is used to
16
16
  // *resolve* nodes and is then discarded -- no coordinate survives into the Netlist, so no
17
17
  // later stage can accidentally derive connectivity from one.
18
- import { componentDevices, deviceTerminalRoles, parseInterchangeYamlWithTopology, } from "@vessel-dsp/core";
18
+ import { TAPER_TABLE_PROPERTY_KEY, componentDevices, deviceTerminalRoles, parseInterchangeYamlWithTopology, taperTableFieldsOf, } from "@vessel-dsp/core";
19
19
  import { load as loadYaml } from "js-yaml";
20
20
  import { StageRefusal } from "./errors.js";
21
21
  import { emptyRegistry, foldToken, registryEntryFor } from "./registry.js";
@@ -570,6 +570,7 @@ function voltagePortRails(components, devices, nodeOf) {
570
570
  : null,
571
571
  terminalRoles: [terminalRoleToken(String(terminal.name))],
572
572
  declaredTerminalRoles: [declaredRole(terminal)],
573
+ terminalPinNumbers: [terminalPinNumber(String(terminal.name))],
573
574
  declaredWindings: null,
574
575
  },
575
576
  });
@@ -871,6 +872,7 @@ export function readNetlist(source, options) {
871
872
  : null,
872
873
  terminalRoles: terminals.map((terminal) => terminalRoleToken(String(terminal.name))),
873
874
  declaredTerminalRoles: roles,
875
+ terminalPinNumbers: terminals.map((terminal) => terminalPinNumber(String(terminal.name))),
874
876
  declaredWindings: declaredWindings(component, terminals),
875
877
  });
876
878
  // **A package that states its own devices is split here, from the source.** A dual op-amp
@@ -1114,6 +1116,31 @@ export function readNetlist(source, options) {
1114
1116
  "linear. An audio pot rendered linear is audible across the whole sweep.",
1115
1117
  });
1116
1118
  }
1119
+ // A declared measured table wins over the taper kind above. The kind stays on the
1120
+ // control as the maker's letter; the table is the law every consumer executes.
1121
+ // An invalid table refuses the document by name (stage 1): falling back to the
1122
+ // kind, or to linear, would play a curve the source did not state.
1123
+ let taperTable;
1124
+ if (owner !== undefined) {
1125
+ const raw = owner.properties[TAPER_TABLE_PROPERTY_KEY];
1126
+ if (raw !== undefined) {
1127
+ try {
1128
+ const fields = taperTableFieldsOf({ TaperTable: raw });
1129
+ if (fields.taperTable !== undefined) {
1130
+ taperTable = {
1131
+ points: fields.taperTable.points.map((point) => ({
1132
+ position: point.position,
1133
+ fraction: point.fraction,
1134
+ })),
1135
+ source: fields.taperTable.source,
1136
+ };
1137
+ }
1138
+ }
1139
+ catch (error) {
1140
+ throw new NetlistError(`component ${owner.id}: ${error instanceof Error ? error.message : String(error)}`, String(owner.id), error);
1141
+ }
1142
+ }
1143
+ }
1117
1144
  const discretePositions = discretePositionsForControl(id, owner, document, declaredDiscretePositions);
1118
1145
  // Only for a control a chip reads (scanned or tapped): a jack you tap into is not a
1119
1146
  // knob-style panel control, so its label and role come from its own declaration. Every
@@ -1176,6 +1203,7 @@ export function readNetlist(source, options) {
1176
1203
  return {
1177
1204
  id,
1178
1205
  taper: declaredTapers.get(id) ?? componentTaper?.taper ?? "linear",
1206
+ ...(taperTable !== undefined ? { taperTable } : {}),
1179
1207
  defaultPosition,
1180
1208
  positions: discretePositions,
1181
1209
  role: declaredRoles.get(id) ??
@@ -4392,6 +4420,18 @@ function terminalRoleToken(name) {
4392
4420
  }
4393
4421
  return folded.replace(/^pin\d+/u, "");
4394
4422
  }
4423
+ /**
4424
+ * A terminal's package pin number, or null where its name is not one.
4425
+ *
4426
+ * Whole digit strings only, compared whole downstream: `"1"` is pin 1 and `"pin1"`,
4427
+ * `"1OUT"`, `""` are not pins (null). The one reading of a digit string is its number --
4428
+ * no fold, no role inference -- which is what keeps this on the right side of the rule
4429
+ * against reading authored prose.
4430
+ */
4431
+ function terminalPinNumber(name) {
4432
+ const trimmed = name.trim();
4433
+ return /^\d+$/u.test(trimmed) ? trimmed : null;
4434
+ }
4395
4435
  /**
4396
4436
  * The taper a control declares for itself, or null when it declares none.
4397
4437
  *
@@ -5112,6 +5152,7 @@ function outputJackLoads(document, devices) {
5112
5152
  declaredType: null,
5113
5153
  terminalRoles: [null, null],
5114
5154
  declaredTerminalRoles: [null, null],
5155
+ terminalPinNumbers: [null, null],
5115
5156
  declaredWindings: null,
5116
5157
  },
5117
5158
  });
@@ -5301,6 +5342,7 @@ function controllerPinDevice(pin, controls) {
5301
5342
  declaredType: null,
5302
5343
  terminalRoles: ["common", ...throws.map(() => "throw")],
5303
5344
  declaredTerminalRoles: ["common", ...throws.map(() => "throw")],
5345
+ terminalPinNumbers: [null, ...throws.map(() => null)],
5304
5346
  declaredWindings: null,
5305
5347
  },
5306
5348
  };