altium-to-circuit-json 0.0.91 → 0.0.93

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.
package/dist/index.js CHANGED
@@ -2980,6 +2980,7 @@ function assignConvertedPortsToSymbolPorts({
2980
2980
 
2981
2981
  // lib/schematic/symbols/classifyComponent.ts
2982
2982
  function classifyComponent({
2983
+ description,
2983
2984
  designator,
2984
2985
  libraryReference
2985
2986
  }) {
@@ -3001,7 +3002,13 @@ function classifyComponent({
3001
3002
  return "capacitor";
3002
3003
  }
3003
3004
  if (prefix === "L" || lowerReference.includes("inductor")) return "inductor";
3004
- if (prefix === "D" || lowerReference.includes("diode")) return "diode";
3005
+ if (prefix === "D" || lowerReference.includes("diode")) {
3006
+ const [firstWord, secondWord, thirdWord] = (description ?? "").trim().toLowerCase().split(/\W+/u);
3007
+ if (firstWord === "led" && secondWord !== "driver" && secondWord !== "controller" || firstWord === "light" && secondWord === "emitting" && thirdWord === "diode") {
3008
+ return "led";
3009
+ }
3010
+ return "diode";
3011
+ }
3005
3012
  return "unknown";
3006
3013
  }
3007
3014
 
@@ -3081,11 +3088,16 @@ function isPolarizedCapacitor(libraryReference) {
3081
3088
 
3082
3089
  // lib/schematic/symbols/selectCircuitJsonSymbol.ts
3083
3090
  function selectCircuitJsonSymbol({
3091
+ description,
3084
3092
  designator,
3085
3093
  libraryReference,
3086
3094
  ports
3087
3095
  }) {
3088
- const classification = classifyComponent({ designator, libraryReference });
3096
+ const classification = classifyComponent({
3097
+ description,
3098
+ designator,
3099
+ libraryReference
3100
+ });
3089
3101
  let baseName;
3090
3102
  let candidateNames = [];
3091
3103
  if (classification === "testpoint" && ports.length === 1) {
@@ -3904,6 +3916,7 @@ function parseFiniteComponentRating({
3904
3916
 
3905
3917
  // lib/schematic/components/createSourceComponent.ts
3906
3918
  function createSourceComponent({
3919
+ description,
3907
3920
  displayText,
3908
3921
  designator,
3909
3922
  libraryReference,
@@ -3911,7 +3924,11 @@ function createSourceComponent({
3911
3924
  pinCount,
3912
3925
  sourceComponentId
3913
3926
  }) {
3914
- const classification = classifyComponent({ designator, libraryReference });
3927
+ const classification = classifyComponent({
3928
+ description,
3929
+ designator,
3930
+ libraryReference
3931
+ });
3915
3932
  const primaryComponentText = getPrimaryComponentText(displayText);
3916
3933
  const common = {
3917
3934
  type: "source_component",
@@ -4041,6 +4058,7 @@ function getComponentIdentity({
4041
4058
  );
4042
4059
  }
4043
4060
  return {
4061
+ description: componentRecord.getCaseInsensitive("COMPONENTDESCRIPTION"),
4044
4062
  designator,
4045
4063
  displayText,
4046
4064
  libraryReference,
@@ -4130,8 +4148,7 @@ function convertComponent({
4130
4148
  componentPorts.map(({ point }) => point)
4131
4149
  );
4132
4150
  const symbolSelection = selectCircuitJsonSymbol({
4133
- designator: identity.designator,
4134
- libraryReference: identity.libraryReference,
4151
+ ...identity,
4135
4152
  ports: componentPorts
4136
4153
  });
4137
4154
  const singleInputGateBody = symbolSelection ? void 0 : convertOwnedSingleInputGateBody(