easyeda 0.0.18 → 0.0.20

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
@@ -28913,7 +28913,10 @@ var ShapeItemSchema = import_zod.z.object({
28913
28913
  }
28914
28914
  case "SOLIDREGION": {
28915
28915
  const [layermask, , pathData, fillStyle, id] = shape.data.split("~");
28916
- const points = pathData.match(/[ML] ?([\d.]+[ ,][\d.]+)/g).map((point) => point.slice(2).split(/[ ,]/).map(Number));
28916
+ const points = pathData.match(/[ML] ?(-?[\d.]+)[ ,](-?[\d.]+)/g)?.map((point) => {
28917
+ const [, x, y] = point.match(/[ML]? ?(-?[\d.]+)[ ,](-?[\d.]+)/) || [];
28918
+ return [Number(x), Number(y)];
28919
+ }) || [];
28917
28920
  return SolidRegionSchema.parse({
28918
28921
  type: "SOLIDREGION",
28919
28922
  layermask: Number(layermask),
@@ -29173,7 +29176,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
29173
29176
  var package_default = {
29174
29177
  name: "easyeda",
29175
29178
  type: "module",
29176
- version: "0.0.17",
29179
+ version: "0.0.19",
29177
29180
  files: ["dist"],
29178
29181
  repository: {
29179
29182
  type: "git",
@@ -29608,7 +29611,8 @@ var convertToTypescriptComponent = ({
29608
29611
  soup,
29609
29612
  easyeda: easyEdaJson
29610
29613
  }) => {
29611
- const pn = easyEdaJson.lcsc.number;
29614
+ const rawPn = easyEdaJson.dataStr.head.c_para["Manufacturer Part"];
29615
+ const pn = normalizeManufacturerPartNumber(rawPn);
29612
29616
  const [cad_component2] = (0, import_soup_util2.su)(soup).cad_component.list();
29613
29617
  const smtpads = (0, import_soup_util2.su)(soup).pcb_smtpad.list();
29614
29618
  const plated_holes = (0, import_soup_util2.su)(soup).pcb_plated_hole.list();
@@ -29638,6 +29642,14 @@ var convertToTypescriptComponent = ({
29638
29642
  easyEdaJson
29639
29643
  });
29640
29644
  };
29645
+ function normalizeManufacturerPartNumber(partNumber) {
29646
+ let normalized = partNumber.replace(/-/g, "_");
29647
+ normalized = normalized.replace(/[^a-zA-Z0-9_$]/g, "");
29648
+ if (/^\d/.test(normalized)) {
29649
+ normalized = "A" + normalized;
29650
+ }
29651
+ return normalized;
29652
+ }
29641
29653
 
29642
29654
  // cli/main.ts
29643
29655
  var path = __toESM(require("path"), 1);