@tscircuit/cli 0.1.2232 → 0.1.2233

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.js CHANGED
@@ -154298,7 +154298,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
154298
154298
  // lib/getVersion.ts
154299
154299
  import { createRequire as createRequire2 } from "node:module";
154300
154300
  // package.json
154301
- var version = "0.1.2231";
154301
+ var version = "0.1.2232";
154302
154302
  var package_default = {
154303
154303
  name: "@tscircuit/cli",
154304
154304
  version,
@@ -154322,7 +154322,7 @@ var package_default = {
154322
154322
  "@tscircuit/eval": "0.0.1402",
154323
154323
  "@tscircuit/fake-snippets": "^0.0.182",
154324
154324
  "@tscircuit/file-server": "^0.0.32",
154325
- "@tscircuit/footprinter": "^0.0.426",
154325
+ "@tscircuit/footprinter": "^0.0.430",
154326
154326
  "@tscircuit/image-utils": "^0.0.8",
154327
154327
  "@tscircuit/krt-wasm": "^0.1.6",
154328
154328
  "@tscircuit/math-utils": "0.0.36",
@@ -154348,7 +154348,7 @@ var package_default = {
154348
154348
  "circuit-json-to-bom-csv": "^0.0.19",
154349
154349
  "circuit-json-to-connectivity-map": "^0.0.32",
154350
154350
  "circuit-json-to-fdm-component-box": "^0.0.2",
154351
- "circuit-json-to-footprinter": "^0.0.58",
154351
+ "circuit-json-to-footprinter": "^0.0.59",
154352
154352
  "circuit-json-to-gerber": "^0.0.105",
154353
154353
  "circuit-json-to-kicad": "0.0.230",
154354
154354
  "circuit-json-to-pnp-csv": "^0.0.18",
@@ -337889,7 +337889,7 @@ var convertKicadFootprintToTsx = async ({
337889
337889
  console.log(kleur_default.green(`Converted ${outputPath}`));
337890
337890
  };
337891
337891
 
337892
- // node_modules/circuit-json-to-footprinter/dist/chunk-VEAX3CQP.js
337892
+ // node_modules/circuit-json-to-footprinter/dist/chunk-K4WFTP36.js
337893
337893
  import {
337894
337894
  getBoundsCenter,
337895
337895
  getBoundsFromPoints as getBoundsFromPoints4
@@ -340635,7 +340635,7 @@ var getManifoldModule = async () => {
340635
340635
  return manifoldModulePromise;
340636
340636
  };
340637
340637
 
340638
- // node_modules/circuit-json-to-footprinter/dist/chunk-VEAX3CQP.js
340638
+ // node_modules/circuit-json-to-footprinter/dist/chunk-K4WFTP36.js
340639
340639
  import { getBoundsCenter as getBoundsCenter2, isPointInsidePolygon as isPointInsidePolygon3 } from "@tscircuit/math-utils";
340640
340640
  var HOLE_SHAPE_KIND = {
340641
340641
  circle: "circle",
@@ -341045,6 +341045,7 @@ var getNumericPinNumbers = (pad) => [
341045
341045
  return match?.[1] ? [Number.parseInt(match[1], 10)] : [];
341046
341046
  }))
341047
341047
  ];
341048
+ var getBallCoordinates = (pad) => (pad?.element.port_hints ?? []).filter((hint) => /^[A-Z]+[1-9]\d*$/.test(hint));
341048
341049
  var matchPadsByPosition = (leftPads, rightPads) => {
341049
341050
  const availableRight = new Set(rightPads.map((_, index) => index));
341050
341051
  const pairs = [];
@@ -341079,10 +341080,14 @@ var comparePinHints = (left, right) => {
341079
341080
  for (const [leftPad, rightPad] of pairs) {
341080
341081
  const leftPinNumbers = getNumericPinNumbers(leftPad);
341081
341082
  const rightPinNumbers = getNumericPinNumbers(rightPad);
341082
- if (leftPinNumbers.length === 0 && rightPinNumbers.length === 0)
341083
+ const leftBalls = getBallCoordinates(leftPad);
341084
+ const rightBalls = getBallCoordinates(rightPad);
341085
+ if (leftPinNumbers.length === 0 && rightPinNumbers.length === 0 && leftBalls.length === 0 && rightBalls.length === 0)
341083
341086
  continue;
341084
341087
  comparedPinCount += 1;
341085
- if (leftPinNumbers.some((pinNumber) => rightPinNumbers.includes(pinNumber))) {
341088
+ const hasNumericPair = leftPinNumbers.length > 0 && rightPinNumbers.length > 0;
341089
+ const hasBallPair = leftBalls.length > 0 && rightBalls.length > 0;
341090
+ if ((hasNumericPair || leftPinNumbers.length === 0 && rightPinNumbers.length === 0 && hasBallPair) && (!hasNumericPair || leftPinNumbers.some((pinNumber) => rightPinNumbers.includes(pinNumber))) && (!hasBallPair || leftBalls.some((ball) => rightBalls.includes(ball)))) {
341086
341091
  matchedPinCount += 1;
341087
341092
  continue;
341088
341093
  }
@@ -342999,36 +343004,66 @@ var getSot223Seed = (target) => {
342999
343004
  }
343000
343005
  return;
343001
343006
  };
343002
- var getBgaGridSeed = (target) => {
343007
+ var getBgaGridSeeds = (target) => {
343003
343008
  const pads = getPadGeometries(target);
343004
- if (pads.length < 4 || pads.some(({ copper, drill, element }) => element.type !== "pcb_smtpad" || drill || copper.shape !== "rect")) {
343005
- return;
343009
+ if (pads.length < 4 || pads.some(({ copper, drill, element }) => element.type !== "pcb_smtpad" || drill || copper.shape !== "rect" && copper.shape !== "circle")) {
343010
+ return [];
343006
343011
  }
343007
343012
  const bounds = pads.map(({ copper }) => getPadBounds3(copper));
343008
343013
  const pad = median(bounds.map(({ width, height }) => (width + height) / 2));
343009
343014
  const tolerance = Math.max(0.005, pad * 0.08);
343010
343015
  if (bounds.some(({ width, height }) => Math.abs(width - height) > tolerance || Math.abs(width - pad) > tolerance || Math.abs(height - pad) > tolerance)) {
343011
- return;
343016
+ return [];
343012
343017
  }
343013
343018
  const columns = clusterCoordinates(pads.map(({ copper }) => copper.x), tolerance);
343014
343019
  const rows = clusterCoordinates(pads.map(({ copper }) => copper.y), tolerance);
343015
- if (columns.length < 2 || rows.length < 2 || columns.length * rows.length !== pads.length) {
343016
- return;
343020
+ if (columns.length < 2 || rows.length < 2 || columns.length * rows.length < pads.length) {
343021
+ return [];
343017
343022
  }
343018
343023
  const columnPitches = columns.slice(1).map((coordinate, index) => coordinate - columns[index]);
343019
343024
  const rowPitches = rows.slice(1).map((coordinate, index) => coordinate - rows[index]);
343020
- const pitch = median([...columnPitches, ...rowPitches]);
343025
+ const pitch = median([
343026
+ (columns.at(-1) - columns[0]) / (columns.length - 1),
343027
+ (rows.at(-1) - rows[0]) / (rows.length - 1)
343028
+ ]);
343021
343029
  if (pitch <= pad || [...columnPitches, ...rowPitches].some((candidate) => Math.abs(candidate - pitch) > tolerance)) {
343022
- return;
343030
+ return [];
343023
343031
  }
343024
- for (const column of columns) {
343025
- for (const row of rows) {
343026
- if (pads.filter(({ copper }) => Math.abs(copper.x - column) <= tolerance && Math.abs(copper.y - row) <= tolerance).length !== 1) {
343027
- return;
343032
+ const occupied = /* @__PURE__ */ new Set;
343033
+ for (const { copper } of pads) {
343034
+ const x = columns.findIndex((column) => Math.abs(copper.x - column) <= tolerance);
343035
+ const y = rows.findIndex((row) => Math.abs(copper.y - row) <= tolerance);
343036
+ const position = y * columns.length + x;
343037
+ if (x < 0 || y < 0 || occupied.has(position))
343038
+ return [];
343039
+ occupied.add(position);
343040
+ }
343041
+ const shapes = new Set(pads.map(({ copper }) => copper.shape));
343042
+ if (shapes.size !== 1)
343043
+ return [];
343044
+ const base = `bga${pads.length}_grid${columns.length}x${rows.length}_p${formatPreciseLength(pitch)}_pad${formatPreciseLength(pad)}`;
343045
+ const padModifier = shapes.has("rect") ? "_rectpads" : "";
343046
+ const seeds = [];
343047
+ for (const origin of ["tl", "bl", "tr", "br"]) {
343048
+ const missing = [];
343049
+ for (let y = 0;y < rows.length; y++) {
343050
+ for (let x = 0;x < columns.length; x++) {
343051
+ if (occupied.has(y * columns.length + x))
343052
+ continue;
343053
+ const pinX = origin.endsWith("r") ? columns.length - 1 - x : x;
343054
+ const pinY = origin.startsWith("b") ? rows.length - 1 - y : y;
343055
+ missing.push(pinY * columns.length + pinX + 1);
343028
343056
  }
343029
343057
  }
343058
+ missing.sort((left, right) => left - right);
343059
+ const mask = missing.length ? `_missing(${missing.join(",")})` : "";
343060
+ const seed = `${base}${mask}_${origin}origin${padModifier}`;
343061
+ seeds.push(seed);
343062
+ for (const numbering of ["rowmajor", "columnmajor", "ballcoords"]) {
343063
+ seeds.push(`${seed}_pinnumbering(${numbering})`);
343064
+ }
343030
343065
  }
343031
- return `bga${pads.length}_grid${columns.length}x${rows.length}_p${formatPreciseLength(pitch)}_pad${formatPreciseLength(pad)}_rectpads`;
343066
+ return seeds;
343032
343067
  };
343033
343068
  var getStaggeredSmdPinHeaderSeed = (target) => {
343034
343069
  const description = `${target.title} ${target.subtitle} ${target.sourceHints?.join(" ") ?? ""}`.toLowerCase();
@@ -343189,9 +343224,8 @@ var generateSeeds = (target, analysis) => {
343189
343224
  if (family !== "usbcmidmount")
343190
343225
  seeds.add(family);
343191
343226
  }
343192
- const bgaGridSeed = getBgaGridSeed(target);
343193
- if (bgaGridSeed)
343194
- seeds.add(bgaGridSeed);
343227
+ for (const seed of getBgaGridSeeds(target))
343228
+ seeds.add(seed);
343195
343229
  const staggeredSmdPinHeaderSeed = getStaggeredSmdPinHeaderSeed(target);
343196
343230
  if (staggeredSmdPinHeaderSeed)
343197
343231
  seeds.add(staggeredSmdPinHeaderSeed);
@@ -343696,7 +343730,7 @@ var selectSeedsToOptimize = (candidates, analysis, target) => {
343696
343730
  return [...selected.values()].slice(0, MAX_OPTIMIZED_SEEDS);
343697
343731
  };
343698
343732
  var findActiveParameters = (seed, analysis) => {
343699
- if (seed.family === "fpc" || seed.family === "jst" && (seed.footprinterString.includes("_smd") || seed.footprinterString.includes("_zh"))) {
343733
+ if (seed.family === "bga" && seed.footprinterString.includes("_pinnumbering(") || seed.family === "fpc" || seed.family === "jst" && (seed.footprinterString.includes("_smd") || seed.footprinterString.includes("_zh"))) {
343700
343734
  return [];
343701
343735
  }
343702
343736
  const active = [];
package/dist/lib/index.js CHANGED
@@ -69109,7 +69109,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
69109
69109
  }));
69110
69110
  };
69111
69111
  // package.json
69112
- var version = "0.1.2231";
69112
+ var version = "0.1.2232";
69113
69113
  var package_default = {
69114
69114
  name: "@tscircuit/cli",
69115
69115
  version,
@@ -69133,7 +69133,7 @@ var package_default = {
69133
69133
  "@tscircuit/eval": "0.0.1402",
69134
69134
  "@tscircuit/fake-snippets": "^0.0.182",
69135
69135
  "@tscircuit/file-server": "^0.0.32",
69136
- "@tscircuit/footprinter": "^0.0.426",
69136
+ "@tscircuit/footprinter": "^0.0.430",
69137
69137
  "@tscircuit/image-utils": "^0.0.8",
69138
69138
  "@tscircuit/krt-wasm": "^0.1.6",
69139
69139
  "@tscircuit/math-utils": "0.0.36",
@@ -69159,7 +69159,7 @@ var package_default = {
69159
69159
  "circuit-json-to-bom-csv": "^0.0.19",
69160
69160
  "circuit-json-to-connectivity-map": "^0.0.32",
69161
69161
  "circuit-json-to-fdm-component-box": "^0.0.2",
69162
- "circuit-json-to-footprinter": "^0.0.58",
69162
+ "circuit-json-to-footprinter": "^0.0.59",
69163
69163
  "circuit-json-to-gerber": "^0.0.105",
69164
69164
  "circuit-json-to-kicad": "0.0.230",
69165
69165
  "circuit-json-to-pnp-csv": "^0.0.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2232",
3
+ "version": "0.1.2233",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"
@@ -21,7 +21,7 @@
21
21
  "@tscircuit/eval": "0.0.1402",
22
22
  "@tscircuit/fake-snippets": "^0.0.182",
23
23
  "@tscircuit/file-server": "^0.0.32",
24
- "@tscircuit/footprinter": "^0.0.426",
24
+ "@tscircuit/footprinter": "^0.0.430",
25
25
  "@tscircuit/image-utils": "^0.0.8",
26
26
  "@tscircuit/krt-wasm": "^0.1.6",
27
27
  "@tscircuit/math-utils": "0.0.36",
@@ -47,7 +47,7 @@
47
47
  "circuit-json-to-bom-csv": "^0.0.19",
48
48
  "circuit-json-to-connectivity-map": "^0.0.32",
49
49
  "circuit-json-to-fdm-component-box": "^0.0.2",
50
- "circuit-json-to-footprinter": "^0.0.58",
50
+ "circuit-json-to-footprinter": "^0.0.59",
51
51
  "circuit-json-to-gerber": "^0.0.105",
52
52
  "circuit-json-to-kicad": "0.0.230",
53
53
  "circuit-json-to-pnp-csv": "^0.0.18",