@tscircuit/footprinter 0.0.23 → 0.0.24
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/package.json +4 -1
- package/.github/workflows/release.yml +0 -19
- package/ava.config.js +0 -5
- package/biome.json +0 -15
- package/src/fn/bga.ts +0 -138
- package/src/fn/cap.ts +0 -7
- package/src/fn/diode.ts +0 -8
- package/src/fn/dip.ts +0 -118
- package/src/fn/led.ts +0 -6
- package/src/fn/mlp.ts +0 -13
- package/src/fn/qfn.ts +0 -10
- package/src/fn/qfp.ts +0 -19
- package/src/fn/quad.ts +0 -285
- package/src/fn/res.ts +0 -6
- package/src/fn/soic.ts +0 -106
- package/src/footprinter.ts +0 -131
- package/src/helpers/get-quad-pin-map.ts +0 -106
- package/src/helpers/is-not-null.ts +0 -3
- package/src/helpers/passive-fn.ts +0 -175
- package/src/helpers/platedhole.ts +0 -21
- package/src/helpers/rectpad.ts +0 -22
- package/src/helpers/u-curve.ts +0 -6
- package/src/helpers/zod/ALPHABET.ts +0 -1
- package/src/helpers/zod/dim-2d.ts +0 -17
- package/src/helpers/zod/function-call.ts +0 -16
- package/src/helpers/zod/now-defined.ts +0 -2
- package/src/helpers/zod/pin-order-specifier.ts +0 -13
- package/src/index.ts +0 -1
- package/tests/bga.test.ts +0 -49
- package/tests/cap.test.ts +0 -30
- package/tests/dip.test.ts +0 -45
- package/tests/fixtures/get-test-fixture.ts +0 -20
- package/tests/fixtures/index.ts +0 -32
- package/tests/mlp.test.ts +0 -10
- package/tests/qfn.test.ts +0 -10
- package/tests/qfp.test.ts +0 -18
- package/tests/quad.test.ts +0 -24
- package/tests/res.test.ts +0 -11
- package/tests/slop/slop1.test.ts +0 -46
- package/tests/soic.test.ts +0 -11
- package/tsconfig.json +0 -26
package/tests/cap.test.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { fp } from "../src/footprinter"
|
|
3
|
-
import { AnySoupElement } from "@tscircuit/soup"
|
|
4
|
-
import { toPinPositionString } from "./fixtures"
|
|
5
|
-
|
|
6
|
-
test("cap footprint", (t) => {
|
|
7
|
-
const soup = fp().cap().imperial("0402").soup()
|
|
8
|
-
const ps = toPinPositionString(soup)
|
|
9
|
-
|
|
10
|
-
t.is(
|
|
11
|
-
ps,
|
|
12
|
-
`
|
|
13
|
-
1 : -0.50 0.00
|
|
14
|
-
2 : 0.50 0.00
|
|
15
|
-
`.trim()
|
|
16
|
-
)
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
test("cap_imperial0402", (t) => {
|
|
20
|
-
const soup = fp.string("cap_imperial0402").soup()
|
|
21
|
-
const ps = toPinPositionString(soup)
|
|
22
|
-
|
|
23
|
-
t.is(
|
|
24
|
-
ps,
|
|
25
|
-
`
|
|
26
|
-
1 : -0.50 0.00
|
|
27
|
-
2 : 0.50 0.00
|
|
28
|
-
`.trim()
|
|
29
|
-
)
|
|
30
|
-
})
|
package/tests/dip.test.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { fp } from "../src/footprinter"
|
|
3
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
4
|
-
import { getTestFixture, toPinPositionString } from "./fixtures"
|
|
5
|
-
|
|
6
|
-
test("dip params", (t) => {
|
|
7
|
-
t.deepEqual(fp().dip(4).w(7.62).params(), {
|
|
8
|
-
dip: true,
|
|
9
|
-
num_pins: 4,
|
|
10
|
-
w: 7.62,
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
test("dip footprint", (t) => {
|
|
15
|
-
const soup = fp().dip(4).w(4).p(2).soup()
|
|
16
|
-
const ps = toPinPositionString(soup)
|
|
17
|
-
|
|
18
|
-
t.is(
|
|
19
|
-
ps,
|
|
20
|
-
`
|
|
21
|
-
1 : -2.00 1.00
|
|
22
|
-
2 : -2.00 -1.00
|
|
23
|
-
3 : 2.00 -1.00
|
|
24
|
-
4 : 2.00 1.00
|
|
25
|
-
`.trim()
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test("dip4_w3.00mm", async (t) => {
|
|
30
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
31
|
-
const soup = fp.string("dip4_w3.00mm").soup()
|
|
32
|
-
const ps = toPinPositionString(soup)
|
|
33
|
-
|
|
34
|
-
t.is(
|
|
35
|
-
ps,
|
|
36
|
-
`
|
|
37
|
-
1 : -1.50 1.27
|
|
38
|
-
2 : -1.50 -1.27
|
|
39
|
-
3 : 1.50 -1.27
|
|
40
|
-
4 : 1.50 1.27
|
|
41
|
-
`.trim()
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
await logSoup(soup)
|
|
45
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from "ava"
|
|
2
|
-
import { fp } from "../../src"
|
|
3
|
-
import { logSoup } from "@tscircuit/log-soup"
|
|
4
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
5
|
-
|
|
6
|
-
export const getTestFixture = async (t: ExecutionContext) => {
|
|
7
|
-
return {
|
|
8
|
-
fp,
|
|
9
|
-
logSoup: (soup: AnySoupElement[]) => {
|
|
10
|
-
if (process.env.CI) return
|
|
11
|
-
if (process.env.FULL_RUN) return
|
|
12
|
-
return logSoup(`footprinter: ${t.title}`, soup)
|
|
13
|
-
},
|
|
14
|
-
logSoupWithPrefix: (prefix: string, soup: AnySoupElement[]) => {
|
|
15
|
-
if (process.env.CI) return
|
|
16
|
-
if (process.env.FULL_RUN) return
|
|
17
|
-
return logSoup(`footprinter: ${t.title} ${prefix}`, soup)
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
}
|
package/tests/fixtures/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
2
|
-
|
|
3
|
-
export { getTestFixture } from "./get-test-fixture"
|
|
4
|
-
|
|
5
|
-
export const toPinPositionString = (soup: AnySoupElement[]) => {
|
|
6
|
-
return soup
|
|
7
|
-
.map((e: AnySoupElement) => {
|
|
8
|
-
if (e.type === "pcb_plated_hole") {
|
|
9
|
-
return {
|
|
10
|
-
x: e.x,
|
|
11
|
-
y: e.y,
|
|
12
|
-
pn: e.port_hints?.[0],
|
|
13
|
-
}
|
|
14
|
-
} else if (e.type === "pcb_smtpad") {
|
|
15
|
-
return {
|
|
16
|
-
x: e.x,
|
|
17
|
-
y: e.y,
|
|
18
|
-
pn: e.port_hints?.[0],
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// TODO other types
|
|
22
|
-
})
|
|
23
|
-
.filter(Boolean)
|
|
24
|
-
.sort((a: any, b: any) => a.pn - b.pn)
|
|
25
|
-
.map(
|
|
26
|
-
(e: any) =>
|
|
27
|
-
`${e.pn.padEnd(2)}: ${e.x.toFixed(2).padStart(5)} ${e.y
|
|
28
|
-
.toFixed(2)
|
|
29
|
-
.padStart(5)}`
|
|
30
|
-
)
|
|
31
|
-
.join("\n")
|
|
32
|
-
}
|
package/tests/mlp.test.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture, toPinPositionString } from "./fixtures"
|
|
3
|
-
|
|
4
|
-
test("mlp16_w4_h4_p0.5mm", async (t) => {
|
|
5
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
6
|
-
const soup = fp.string("mlp16_w4_h4_p0.5mm").soup()
|
|
7
|
-
|
|
8
|
-
await logSoup(soup)
|
|
9
|
-
t.pass()
|
|
10
|
-
})
|
package/tests/qfn.test.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture, toPinPositionString } from "./fixtures"
|
|
3
|
-
|
|
4
|
-
test("qfn16_w4_h4_p0.65mm", async (t) => {
|
|
5
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
6
|
-
const soup = fp.string("qfn16_w4_h4_p0.65mm").soup()
|
|
7
|
-
|
|
8
|
-
await logSoup(soup)
|
|
9
|
-
t.pass()
|
|
10
|
-
})
|
package/tests/qfp.test.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture, toPinPositionString } from "./fixtures"
|
|
3
|
-
|
|
4
|
-
test("qfp48_w14_p1mm", async (t) => {
|
|
5
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
6
|
-
const soup = fp.string("qfp48_w14_p1mm").soup()
|
|
7
|
-
|
|
8
|
-
await logSoup(soup)
|
|
9
|
-
t.pass()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
test("qfp48_w14_p1mm_startingpin(topside,leftpin)", async (t) => {
|
|
13
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
14
|
-
const soup = fp.string("qfp48_w14_p1mm_startingpin(topside,leftpin)").soup()
|
|
15
|
-
|
|
16
|
-
await logSoup(soup)
|
|
17
|
-
t.pass()
|
|
18
|
-
})
|
package/tests/quad.test.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { fp } from "../src/footprinter"
|
|
3
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
4
|
-
import { getTestFixture, toPinPositionString } from "./fixtures"
|
|
5
|
-
|
|
6
|
-
test("quad16_w4_l4_p0.4_pw0.25_pl0.4", async (t) => {
|
|
7
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
8
|
-
const soup = fp.string("quad16_w4_l4_p0.4_pw0.25_pl0.4").soup()
|
|
9
|
-
|
|
10
|
-
await logSoup(soup)
|
|
11
|
-
t.pass()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
test("quad16_w4_l4_p0.4_pw0.25_pl0.4_thermalpad_startingpin(bottomside,leftpin)", async (t) => {
|
|
15
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
16
|
-
const soup = fp
|
|
17
|
-
.string(
|
|
18
|
-
"quad16_w4_l4_p0.4_pw0.25_pl0.4_thermalpad_startingpin(bottomside,leftpin)"
|
|
19
|
-
)
|
|
20
|
-
.soup()
|
|
21
|
-
|
|
22
|
-
await logSoup(soup)
|
|
23
|
-
t.pass()
|
|
24
|
-
})
|
package/tests/res.test.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture } from "tests/fixtures/get-test-fixture"
|
|
3
|
-
import { su } from "@tscircuit/soup-util"
|
|
4
|
-
|
|
5
|
-
test("res_imperial0402", async (t) => {
|
|
6
|
-
const { fp } = await getTestFixture(t)
|
|
7
|
-
const soup = fp.string("res_imperial0402").soup()
|
|
8
|
-
|
|
9
|
-
t.is(su(soup).pcb_smtpad.list().length, 2)
|
|
10
|
-
t.is(su(soup).pcb_plated_hole.list().length, 0)
|
|
11
|
-
})
|
package/tests/slop/slop1.test.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture } from "../fixtures"
|
|
3
|
-
import type { AnySoupElement } from "@tscircuit/soup"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Slop is an underdefined definition.
|
|
7
|
-
*/
|
|
8
|
-
export const SLOP_LIST = [
|
|
9
|
-
"dip3",
|
|
10
|
-
"bga64",
|
|
11
|
-
"bga48",
|
|
12
|
-
"bga48_grid8x8",
|
|
13
|
-
"bga48_p2_pad0.2",
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
test("slop1", async (t) => {
|
|
17
|
-
const { fp, logSoupWithPrefix } = await getTestFixture(t)
|
|
18
|
-
|
|
19
|
-
const soups: AnySoupElement[][] = []
|
|
20
|
-
const failures: Array<{
|
|
21
|
-
slop_string: string
|
|
22
|
-
error: any
|
|
23
|
-
}> = []
|
|
24
|
-
|
|
25
|
-
for (const slop of SLOP_LIST) {
|
|
26
|
-
try {
|
|
27
|
-
const soup = fp.string(slop).soup()
|
|
28
|
-
soups.push(soup)
|
|
29
|
-
if (slop === SLOP_LIST[SLOP_LIST.length - 1]) {
|
|
30
|
-
await logSoupWithPrefix(slop, soup)
|
|
31
|
-
}
|
|
32
|
-
} catch (e: any) {
|
|
33
|
-
failures.push({
|
|
34
|
-
slop_string: slop,
|
|
35
|
-
error: e,
|
|
36
|
-
})
|
|
37
|
-
throw e
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (failures.length > 0) {
|
|
42
|
-
t.fail(`Failures:\n${failures.map((f) => f.slop_string).join("\n")}`)
|
|
43
|
-
} else {
|
|
44
|
-
t.pass()
|
|
45
|
-
}
|
|
46
|
-
})
|
package/tests/soic.test.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import test from "ava"
|
|
2
|
-
import { getTestFixture } from "tests/fixtures/get-test-fixture"
|
|
3
|
-
import { su } from "@tscircuit/soup-util"
|
|
4
|
-
|
|
5
|
-
test("soic8_w5.3mm_p1.27mm", async (t) => {
|
|
6
|
-
const { fp, logSoup } = await getTestFixture(t)
|
|
7
|
-
const soup = fp.string("soic8_w5.3mm_p1.27mm").soup()
|
|
8
|
-
|
|
9
|
-
t.is(su(soup).pcb_plated_hole.list().length, 8)
|
|
10
|
-
await logSoup(soup)
|
|
11
|
-
})
|
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
// Base Options recommended for all projects
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"skipLibCheck": true,
|
|
6
|
-
"target": "es2022",
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"baseUrl": ".",
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"moduleDetection": "force",
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
// Enable strict type checking so you can catch bugs early
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noImplicitAny": false,
|
|
16
|
-
"noUncheckedIndexedAccess": true,
|
|
17
|
-
"noImplicitOverride": true,
|
|
18
|
-
// We are not transpiling, so preserve our source code and do not emit files
|
|
19
|
-
"module": "preserve",
|
|
20
|
-
"noEmit": true,
|
|
21
|
-
"lib": ["es2022"]
|
|
22
|
-
},
|
|
23
|
-
// Include the necessary files for your project
|
|
24
|
-
"include": ["**/*.ts", "**/*.tsx"],
|
|
25
|
-
"exclude": ["node_modules"]
|
|
26
|
-
}
|