circuit-json-to-gerber 0.0.83 → 0.0.84

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.
@@ -1628,23 +1628,19 @@ function getAllTraceWidths(soup) {
1628
1628
  }
1629
1629
  }
1630
1630
  }
1631
- return {
1632
- top: Array.from(widths.top || []),
1633
- inner1: Array.from(widths.inner1 || []),
1634
- inner2: Array.from(widths.inner2 || []),
1635
- inner3: Array.from(widths.inner3 || []),
1636
- inner4: Array.from(widths.inner4 || []),
1637
- inner5: Array.from(widths.inner5 || []),
1638
- inner6: Array.from(widths.inner6 || []),
1639
- bottom: Array.from(widths.bottom || [])
1640
- };
1631
+ return Object.fromEntries(
1632
+ Object.entries(widths).map(([layer, layerWidths]) => [
1633
+ layer,
1634
+ Array.from(layerWidths)
1635
+ ])
1636
+ );
1641
1637
  }
1642
1638
 
1643
1639
  // src/gerber/convert-soup-to-gerber-commands/defineAperturesForLayer.ts
1644
1640
  var getLayerRefFromGerberLayerName = (glayer_name) => {
1645
1641
  if (glayer_name.startsWith("F_")) return "top";
1646
1642
  if (glayer_name.startsWith("B_")) return "bottom";
1647
- const innerLayerMatch = glayer_name.match(/^In([1-6])_/);
1643
+ const innerLayerMatch = glayer_name.match(/^In(\d+)_/);
1648
1644
  if (innerLayerMatch) return `inner${innerLayerMatch[1]}`;
1649
1645
  throw new Error(`Could not infer layer ref from ${glayer_name}`);
1650
1646
  };
@@ -1690,7 +1686,7 @@ function defineAperturesForLayer({
1690
1686
  );
1691
1687
  const traceWidths = getAllTraceWidths(circuitJson);
1692
1688
  const layerRef = getLayerRefFromGerberLayerName(glayer_name);
1693
- for (const width of traceWidths[layerRef]) {
1689
+ for (const width of traceWidths[layerRef] ?? []) {
1694
1690
  glayer.push(
1695
1691
  ...gerberBuilder().add("define_aperture_template", {
1696
1692
  aperture_number: getNextApertureNumber(),
@@ -2242,7 +2238,7 @@ var findApertureNumber = (glayer, search_params) => {
2242
2238
  // package.json
2243
2239
  var package_default = {
2244
2240
  name: "circuit-json-to-gerber",
2245
- version: "0.0.82",
2241
+ version: "0.0.83",
2246
2242
  main: "dist/index.js",
2247
2243
  type: "module",
2248
2244
  scripts: {
@@ -2267,13 +2263,13 @@ var package_default = {
2267
2263
  "@types/react-dom": "^19.1.5",
2268
2264
  archiver: "^7.0.1",
2269
2265
  "bun-match-svg": "^0.0.13",
2270
- "circuit-json": "^0.0.426",
2266
+ "circuit-json": "^0.0.450",
2271
2267
  commander: "^12.1.0",
2268
+ "format-si-unit": "^0.0.7",
2272
2269
  "gerber-to-svg": "^4.2.8",
2273
2270
  gerberts: "^0.0.3",
2274
2271
  jszip: "^3.10.1",
2275
2272
  "pcb-stackup": "^4.2.8",
2276
- "polygon-clipping": "^0.15.7",
2277
2273
  react: "^19.2.1",
2278
2274
  "react-dom": "^19.2.1",
2279
2275
  tscircuit: "^0.0.1776",
@@ -2287,6 +2283,7 @@ var package_default = {
2287
2283
  dependencies: {
2288
2284
  "@tscircuit/alphabet": "^0.0.25",
2289
2285
  "fast-json-stable-stringify": "^2.1.0",
2286
+ "polygon-clipping": "^0.15.7",
2290
2287
  "transformation-matrix": "^3.0.0"
2291
2288
  }
2292
2289
  };
@@ -2349,15 +2346,9 @@ var getCommandHeaders = (opts) => {
2349
2346
  };
2350
2347
 
2351
2348
  // src/gerber/convert-soup-to-gerber-commands/getGerberLayerName.ts
2352
- var layerRefToGerberPrefix = {
2349
+ var outerLayerRefToGerberPrefix = {
2353
2350
  top: "F_",
2354
- bottom: "B_",
2355
- inner1: "In1_",
2356
- inner2: "In2_",
2357
- inner3: "In3_",
2358
- inner4: "In4_",
2359
- inner5: "In5_",
2360
- inner6: "In6_"
2351
+ bottom: "B_"
2361
2352
  };
2362
2353
  var layerTypeToGerberSuffix = {
2363
2354
  copper: "Cu",
@@ -2372,7 +2363,8 @@ var getGerberLayerName = (layer_ref, layer_type) => {
2372
2363
  if (layer_ref.startsWith("inner") && layer_type !== "copper") {
2373
2364
  throw new Error(`Inner layer ${layer_ref} only supports copper gerbers`);
2374
2365
  }
2375
- return `${layerRefToGerberPrefix[layer_ref]}${layerTypeToGerberSuffix[layer_type]}`;
2366
+ const prefix = layer_ref.startsWith("inner") ? `In${layer_ref.slice("inner".length)}_` : outerLayerRefToGerberPrefix[layer_ref];
2367
+ return `${prefix}${layerTypeToGerberSuffix[layer_type]}`;
2376
2368
  };
2377
2369
 
2378
2370
  // src/gerber/convert-soup-to-gerber-commands/offsetPolygonOutline.ts
@@ -2983,7 +2975,7 @@ var emitEdgeCutRing = (gerberBuild, ring, mfy) => {
2983
2975
  var getLayerCount2 = (circuitJson) => {
2984
2976
  const board = circuitJson.find((element) => element.type === "pcb_board");
2985
2977
  const numLayers = board?.num_layers ?? 2;
2986
- return Math.max(2, Math.min(8, numLayers));
2978
+ return Math.max(2, Math.min(10, numLayers));
2987
2979
  };
2988
2980
  var getInnerLayerRefs = (layerCount) => Array.from({ length: layerCount - 2 }, (_, i) => `inner${i + 1}`);
2989
2981
  var getGerberInnerLayerName = (layerRef) => {
@@ -4120,4 +4112,4 @@ export {
4120
4112
  stringifyGerberCommands,
4121
4113
  convertSoupToGerberCommands
4122
4114
  };
4123
- //# sourceMappingURL=chunk-46NSLLUV.js.map
4115
+ //# sourceMappingURL=chunk-23TRHNW3.js.map