easyeda 0.0.18 → 0.0.19

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/cli/main.cjs CHANGED
@@ -29173,7 +29173,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
29173
29173
  var package_default = {
29174
29174
  name: "easyeda",
29175
29175
  type: "module",
29176
- version: "0.0.17",
29176
+ version: "0.0.18",
29177
29177
  files: ["dist"],
29178
29178
  repository: {
29179
29179
  type: "git",
@@ -29608,7 +29608,8 @@ var convertToTypescriptComponent = ({
29608
29608
  soup,
29609
29609
  easyeda: easyEdaJson
29610
29610
  }) => {
29611
- const pn = easyEdaJson.lcsc.number;
29611
+ const rawPn = easyEdaJson.dataStr.head.c_para["Manufacturer Part"];
29612
+ const pn = normalizeManufacturerPartNumber(rawPn);
29612
29613
  const [cad_component2] = (0, import_soup_util2.su)(soup).cad_component.list();
29613
29614
  const smtpads = (0, import_soup_util2.su)(soup).pcb_smtpad.list();
29614
29615
  const plated_holes = (0, import_soup_util2.su)(soup).pcb_plated_hole.list();
@@ -29638,6 +29639,14 @@ var convertToTypescriptComponent = ({
29638
29639
  easyEdaJson
29639
29640
  });
29640
29641
  };
29642
+ function normalizeManufacturerPartNumber(partNumber) {
29643
+ let normalized = partNumber.replace(/-/g, "_");
29644
+ normalized = normalized.replace(/[^a-zA-Z0-9_$]/g, "");
29645
+ if (/^\d/.test(normalized)) {
29646
+ normalized = "A" + normalized;
29647
+ }
29648
+ return normalized;
29649
+ }
29641
29650
 
29642
29651
  // cli/main.ts
29643
29652
  var path = __toESM(require("path"), 1);