easyeda 0.0.315 → 0.0.316

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/main.cjs CHANGED
@@ -3528,7 +3528,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
3528
3528
  var package_default = {
3529
3529
  name: "easyeda",
3530
3530
  type: "module",
3531
- version: "0.0.314",
3531
+ version: "0.0.315",
3532
3532
  files: [
3533
3533
  "dist"
3534
3534
  ],
@@ -9848,14 +9848,32 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9848
9848
  if (pin) labels.push(normalizeSymbolName(pin.label));
9849
9849
  return labels;
9850
9850
  });
9851
- const normalizedPinLabels = normalizePinLabels(pinLabelSets);
9851
+ const padNumberKeys = pads.map((pad, index) => {
9852
+ const padNumber = String(pad.number ?? "").trim();
9853
+ return padNumber ? `number:${padNumber}` : `index:${index}`;
9854
+ });
9855
+ const uniquePinLabelSets = [];
9856
+ const uniquePinIndexByKey = /* @__PURE__ */ new Map();
9857
+ const uniquePinIndexByPad = padNumberKeys.map((key, padIndex) => {
9858
+ const existingIndex = uniquePinIndexByKey.get(key);
9859
+ if (existingIndex !== void 0) return existingIndex;
9860
+ const uniquePinIndex = uniquePinLabelSets.length;
9861
+ uniquePinIndexByKey.set(key, uniquePinIndex);
9862
+ uniquePinLabelSets.push(pinLabelSets[padIndex]);
9863
+ return uniquePinIndex;
9864
+ });
9865
+ const normalizedUniquePinLabels = normalizePinLabels(uniquePinLabelSets);
9866
+ const normalizedPinLabels = uniquePinIndexByPad.map(
9867
+ (uniquePinIndex) => normalizedUniquePinLabels[uniquePinIndex]
9868
+ );
9852
9869
  const normalizedPinLabelsByPin = Object.fromEntries(
9853
- normalizedPinLabels.map((labels) => {
9870
+ normalizedUniquePinLabels.map((labels) => {
9854
9871
  const pin = labels.find((label) => /^pin\d+$/i.test(label));
9855
9872
  return [pin, labels.filter((label) => label !== pin)];
9856
9873
  })
9857
9874
  );
9858
9875
  const polarizedPinMetadata = pads.length === 2 && (isDiodeCategoryComponent(easyEdaJson) || isLedCategoryComponent(easyEdaJson)) ? getPolarizedPinMetadata(normalizedPinLabelsByPin) : void 0;
9876
+ const emittedSourcePinIndexes = /* @__PURE__ */ new Set();
9859
9877
  pads.forEach((pad, index) => {
9860
9878
  const portHints = normalizedPinLabels[index];
9861
9879
  const pinNumber = Number.parseInt(
@@ -9863,14 +9881,18 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9863
9881
  );
9864
9882
  const canonicalPinName = `pin${pinNumber}`;
9865
9883
  const pcbPortHints = polarizedPinMetadata?.portHintsMap[canonicalPinName] ?? [canonicalPinName];
9866
- circuitElements.push({
9867
- type: "source_port",
9868
- source_port_id: `source_port_${index + 1}`,
9869
- source_component_id: "source_component_1",
9870
- name: `pin${pinNumber}`,
9871
- pin_number: pinNumber,
9872
- port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
9873
- });
9884
+ const uniquePinIndex = uniquePinIndexByPad[index];
9885
+ if (!emittedSourcePinIndexes.has(uniquePinIndex)) {
9886
+ emittedSourcePinIndexes.add(uniquePinIndex);
9887
+ circuitElements.push({
9888
+ type: "source_port",
9889
+ source_port_id: `source_port_${index + 1}`,
9890
+ source_component_id: "source_component_1",
9891
+ name: `pin${pinNumber}`,
9892
+ pin_number: pinNumber,
9893
+ port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
9894
+ });
9895
+ }
9874
9896
  if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
9875
9897
  const platedHoleId = pad.shape === "RECT" && pad.rotation !== void 0 ? `pcb_plated_hole_${index + 1}_rot${pad.rotation}` : `pcb_plated_hole_${index + 1}`;
9876
9898
  const commonPlatedHoleProps = {