circuit-json-to-gerber 0.0.83 → 0.0.85

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 tscircuit Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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,8 @@ 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.84",
2242
+ license: "MIT",
2246
2243
  main: "dist/index.js",
2247
2244
  type: "module",
2248
2245
  scripts: {
@@ -2267,13 +2264,13 @@ var package_default = {
2267
2264
  "@types/react-dom": "^19.1.5",
2268
2265
  archiver: "^7.0.1",
2269
2266
  "bun-match-svg": "^0.0.13",
2270
- "circuit-json": "^0.0.426",
2267
+ "circuit-json": "^0.0.450",
2271
2268
  commander: "^12.1.0",
2269
+ "format-si-unit": "^0.0.7",
2272
2270
  "gerber-to-svg": "^4.2.8",
2273
2271
  gerberts: "^0.0.3",
2274
2272
  jszip: "^3.10.1",
2275
2273
  "pcb-stackup": "^4.2.8",
2276
- "polygon-clipping": "^0.15.7",
2277
2274
  react: "^19.2.1",
2278
2275
  "react-dom": "^19.2.1",
2279
2276
  tscircuit: "^0.0.1776",
@@ -2287,6 +2284,7 @@ var package_default = {
2287
2284
  dependencies: {
2288
2285
  "@tscircuit/alphabet": "^0.0.25",
2289
2286
  "fast-json-stable-stringify": "^2.1.0",
2287
+ "polygon-clipping": "^0.15.7",
2290
2288
  "transformation-matrix": "^3.0.0"
2291
2289
  }
2292
2290
  };
@@ -2349,15 +2347,9 @@ var getCommandHeaders = (opts) => {
2349
2347
  };
2350
2348
 
2351
2349
  // src/gerber/convert-soup-to-gerber-commands/getGerberLayerName.ts
2352
- var layerRefToGerberPrefix = {
2350
+ var outerLayerRefToGerberPrefix = {
2353
2351
  top: "F_",
2354
- bottom: "B_",
2355
- inner1: "In1_",
2356
- inner2: "In2_",
2357
- inner3: "In3_",
2358
- inner4: "In4_",
2359
- inner5: "In5_",
2360
- inner6: "In6_"
2352
+ bottom: "B_"
2361
2353
  };
2362
2354
  var layerTypeToGerberSuffix = {
2363
2355
  copper: "Cu",
@@ -2372,7 +2364,8 @@ var getGerberLayerName = (layer_ref, layer_type) => {
2372
2364
  if (layer_ref.startsWith("inner") && layer_type !== "copper") {
2373
2365
  throw new Error(`Inner layer ${layer_ref} only supports copper gerbers`);
2374
2366
  }
2375
- return `${layerRefToGerberPrefix[layer_ref]}${layerTypeToGerberSuffix[layer_type]}`;
2367
+ const prefix = layer_ref.startsWith("inner") ? `In${layer_ref.slice("inner".length)}_` : outerLayerRefToGerberPrefix[layer_ref];
2368
+ return `${prefix}${layerTypeToGerberSuffix[layer_type]}`;
2376
2369
  };
2377
2370
 
2378
2371
  // src/gerber/convert-soup-to-gerber-commands/offsetPolygonOutline.ts
@@ -2983,7 +2976,7 @@ var emitEdgeCutRing = (gerberBuild, ring, mfy) => {
2983
2976
  var getLayerCount2 = (circuitJson) => {
2984
2977
  const board = circuitJson.find((element) => element.type === "pcb_board");
2985
2978
  const numLayers = board?.num_layers ?? 2;
2986
- return Math.max(2, Math.min(8, numLayers));
2979
+ return Math.max(2, Math.min(10, numLayers));
2987
2980
  };
2988
2981
  var getInnerLayerRefs = (layerCount) => Array.from({ length: layerCount - 2 }, (_, i) => `inner${i + 1}`);
2989
2982
  var getGerberInnerLayerName = (layerRef) => {
@@ -4120,4 +4113,4 @@ export {
4120
4113
  stringifyGerberCommands,
4121
4114
  convertSoupToGerberCommands
4122
4115
  };
4123
- //# sourceMappingURL=chunk-46NSLLUV.js.map
4116
+ //# sourceMappingURL=chunk-2INVOBQL.js.map