@tscircuit/cli 0.1.724 → 0.1.725
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/main.js +410 -604
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74123,7 +74123,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74123
74123
|
import { execSync as execSync2 } from "node:child_process";
|
|
74124
74124
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74125
74125
|
// package.json
|
|
74126
|
-
var version = "0.1.
|
|
74126
|
+
var version = "0.1.724";
|
|
74127
74127
|
var package_default = {
|
|
74128
74128
|
name: "@tscircuit/cli",
|
|
74129
74129
|
version,
|
|
@@ -80270,8 +80270,8 @@ Successfully cloned to:`));
|
|
|
80270
80270
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
80271
80271
|
|
|
80272
80272
|
// lib/shared/export-snippet.ts
|
|
80273
|
-
import
|
|
80274
|
-
import
|
|
80273
|
+
import fs28 from "node:fs";
|
|
80274
|
+
import path30 from "node:path";
|
|
80275
80275
|
import { promisify as promisify3 } from "node:util";
|
|
80276
80276
|
|
|
80277
80277
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -84246,162 +84246,8 @@ async function generateCircuitJson({
|
|
|
84246
84246
|
};
|
|
84247
84247
|
}
|
|
84248
84248
|
|
|
84249
|
-
// cli/build/generate-kicad-footprint-library.ts
|
|
84250
|
-
import fs28 from "node:fs";
|
|
84251
|
-
import path30 from "node:path";
|
|
84252
|
-
import {
|
|
84253
|
-
At as At3,
|
|
84254
|
-
KicadPcb as KicadPcb3,
|
|
84255
|
-
parseKicadSexpr as parseKicadSexpr3,
|
|
84256
|
-
FootprintModel as FootprintModel3
|
|
84257
|
-
} from "kicadts";
|
|
84258
|
-
var sanitizeLibraryAndFootprintName = (libraryLink) => {
|
|
84259
|
-
if (!libraryLink) {
|
|
84260
|
-
return {
|
|
84261
|
-
libraryName: "generated",
|
|
84262
|
-
footprintName: "footprint"
|
|
84263
|
-
};
|
|
84264
|
-
}
|
|
84265
|
-
if (!libraryLink.includes(":")) {
|
|
84266
|
-
return {
|
|
84267
|
-
libraryName: "generated",
|
|
84268
|
-
footprintName: libraryLink.replace(/[\\\/]/g, "-") || "footprint"
|
|
84269
|
-
};
|
|
84270
|
-
}
|
|
84271
|
-
const [rawLibraryName, rawFootprintName] = libraryLink.split(":", 2);
|
|
84272
|
-
const libraryName = rawLibraryName?.replace(/[\\\/]/g, "-").trim() || "generated";
|
|
84273
|
-
const footprintName = rawFootprintName?.replace(/[\\\/]/g, "-").trim() || "footprint";
|
|
84274
|
-
return {
|
|
84275
|
-
libraryName,
|
|
84276
|
-
footprintName
|
|
84277
|
-
};
|
|
84278
|
-
};
|
|
84279
|
-
var sanitizeFootprint = (footprint, outputLibraryName) => {
|
|
84280
|
-
const { libraryName, footprintName } = sanitizeLibraryAndFootprintName(footprint.libraryLink);
|
|
84281
|
-
const targetLibraryName = outputLibraryName || libraryName;
|
|
84282
|
-
footprint.libraryLink = footprintName;
|
|
84283
|
-
footprint.position = At3.from([0, 0, 0]);
|
|
84284
|
-
footprint.locked = false;
|
|
84285
|
-
footprint.placed = false;
|
|
84286
|
-
footprint.uuid = undefined;
|
|
84287
|
-
footprint.path = undefined;
|
|
84288
|
-
footprint.sheetfile = undefined;
|
|
84289
|
-
footprint.sheetname = undefined;
|
|
84290
|
-
footprint.properties = [];
|
|
84291
|
-
const texts = footprint.fpTexts ?? [];
|
|
84292
|
-
for (const text of texts) {
|
|
84293
|
-
text.uuid = undefined;
|
|
84294
|
-
if (text.type === "reference") {
|
|
84295
|
-
text.text = "REF**";
|
|
84296
|
-
} else if (text.type === "value" && text.text.trim().length === 0) {
|
|
84297
|
-
text.text = footprintName;
|
|
84298
|
-
}
|
|
84299
|
-
}
|
|
84300
|
-
footprint.fpTexts = texts;
|
|
84301
|
-
const pads = footprint.fpPads ?? [];
|
|
84302
|
-
for (const pad of pads) {
|
|
84303
|
-
pad.uuid = undefined;
|
|
84304
|
-
pad.net = undefined;
|
|
84305
|
-
}
|
|
84306
|
-
footprint.fpPads = pads;
|
|
84307
|
-
const models = footprint.models ?? [];
|
|
84308
|
-
const updatedModels = [];
|
|
84309
|
-
const modelFiles = [];
|
|
84310
|
-
for (const model of models) {
|
|
84311
|
-
if (model.path) {
|
|
84312
|
-
const modelFilename = path30.basename(model.path);
|
|
84313
|
-
const newPath = `\${KIPRJMOD}/${targetLibraryName}.3dshapes/${modelFilename}`;
|
|
84314
|
-
const newModel = new FootprintModel3(newPath);
|
|
84315
|
-
if (model.offset)
|
|
84316
|
-
newModel.offset = model.offset;
|
|
84317
|
-
if (model.scale)
|
|
84318
|
-
newModel.scale = model.scale;
|
|
84319
|
-
if (model.rotate)
|
|
84320
|
-
newModel.rotate = model.rotate;
|
|
84321
|
-
updatedModels.push(newModel);
|
|
84322
|
-
modelFiles.push(model.path);
|
|
84323
|
-
}
|
|
84324
|
-
}
|
|
84325
|
-
footprint.models = updatedModels;
|
|
84326
|
-
return {
|
|
84327
|
-
libraryName,
|
|
84328
|
-
footprintName,
|
|
84329
|
-
content: footprint.getString(),
|
|
84330
|
-
modelFiles
|
|
84331
|
-
};
|
|
84332
|
-
};
|
|
84333
|
-
var generateKicadFootprintLibrary = async ({
|
|
84334
|
-
projects,
|
|
84335
|
-
distDir
|
|
84336
|
-
}) => {
|
|
84337
|
-
const libraryRoot = path30.join(distDir, "kicad-footprints");
|
|
84338
|
-
fs28.mkdirSync(libraryRoot, { recursive: true });
|
|
84339
|
-
const uniqueFootprints = new Map;
|
|
84340
|
-
for (const project of projects) {
|
|
84341
|
-
try {
|
|
84342
|
-
const parsed = parseKicadSexpr3(project.pcbContent);
|
|
84343
|
-
const pcb = parsed.find((node) => node instanceof KicadPcb3);
|
|
84344
|
-
if (!pcb)
|
|
84345
|
-
continue;
|
|
84346
|
-
const footprints = pcb.footprints ?? [];
|
|
84347
|
-
for (const footprint of footprints) {
|
|
84348
|
-
const sanitized = sanitizeFootprint(footprint);
|
|
84349
|
-
const key = `${sanitized.libraryName}::${sanitized.footprintName}`;
|
|
84350
|
-
if (!uniqueFootprints.has(key)) {
|
|
84351
|
-
uniqueFootprints.set(key, sanitized);
|
|
84352
|
-
}
|
|
84353
|
-
}
|
|
84354
|
-
} catch (error) {
|
|
84355
|
-
console.warn(`Failed to parse KiCad PCB content for footprint extraction from ${project.sourcePath}:`, error);
|
|
84356
|
-
}
|
|
84357
|
-
}
|
|
84358
|
-
const libraryNames = new Set;
|
|
84359
|
-
for (const entry of uniqueFootprints.values()) {
|
|
84360
|
-
libraryNames.add(entry.libraryName);
|
|
84361
|
-
const libraryDir = path30.join(libraryRoot, `${entry.libraryName}.pretty`);
|
|
84362
|
-
fs28.mkdirSync(libraryDir, { recursive: true });
|
|
84363
|
-
const footprintPath = path30.join(libraryDir, `${entry.footprintName}.kicad_mod`);
|
|
84364
|
-
fs28.writeFileSync(footprintPath, `${entry.content}
|
|
84365
|
-
`);
|
|
84366
|
-
}
|
|
84367
|
-
if (libraryNames.size > 0) {
|
|
84368
|
-
const libTableEntries = Array.from(libraryNames).sort().map((name) => ` (lib (name ${name}) (type KiCad) (uri \${KIPRJMOD}/kicad-footprints/${name}.pretty) (options "") (descr "Generated by tsci build"))`);
|
|
84369
|
-
const libTableContent = `(fp_lib_table
|
|
84370
|
-
${libTableEntries.join(`
|
|
84371
|
-
`)}
|
|
84372
|
-
)
|
|
84373
|
-
`;
|
|
84374
|
-
fs28.writeFileSync(path30.join(libraryRoot, "fp-lib-table"), libTableContent);
|
|
84375
|
-
}
|
|
84376
|
-
};
|
|
84377
|
-
var extractFootprintsFromPcb = (pcbContent, outputLibraryName) => {
|
|
84378
|
-
const uniqueFootprints = new Map;
|
|
84379
|
-
try {
|
|
84380
|
-
const parsed = parseKicadSexpr3(pcbContent);
|
|
84381
|
-
const pcb = parsed.find((node) => node instanceof KicadPcb3);
|
|
84382
|
-
if (!pcb)
|
|
84383
|
-
return [];
|
|
84384
|
-
const footprints = pcb.footprints ?? [];
|
|
84385
|
-
for (const footprint of footprints) {
|
|
84386
|
-
const sanitized = sanitizeFootprint(footprint, outputLibraryName);
|
|
84387
|
-
const key = `${sanitized.libraryName}::${sanitized.footprintName}`;
|
|
84388
|
-
if (!uniqueFootprints.has(key)) {
|
|
84389
|
-
uniqueFootprints.set(key, {
|
|
84390
|
-
libraryName: sanitized.libraryName,
|
|
84391
|
-
footprintName: sanitized.footprintName,
|
|
84392
|
-
content: sanitized.content,
|
|
84393
|
-
modelFiles: sanitized.modelFiles
|
|
84394
|
-
});
|
|
84395
|
-
}
|
|
84396
|
-
}
|
|
84397
|
-
} catch (error) {
|
|
84398
|
-
console.warn("Failed to parse KiCad PCB content for footprint extraction:", error);
|
|
84399
|
-
}
|
|
84400
|
-
return Array.from(uniqueFootprints.values());
|
|
84401
|
-
};
|
|
84402
|
-
|
|
84403
84249
|
// lib/shared/export-snippet.ts
|
|
84404
|
-
var writeFileAsync = promisify3(
|
|
84250
|
+
var writeFileAsync = promisify3(fs28.writeFile);
|
|
84405
84251
|
var ALLOWED_EXPORT_FORMATS = [
|
|
84406
84252
|
"json",
|
|
84407
84253
|
"circuit-json",
|
|
@@ -84415,7 +84261,6 @@ var ALLOWED_EXPORT_FORMATS = [
|
|
|
84415
84261
|
"kicad_sch",
|
|
84416
84262
|
"kicad_pcb",
|
|
84417
84263
|
"kicad_zip",
|
|
84418
|
-
"kicad-footprint-library",
|
|
84419
84264
|
"kicad-library"
|
|
84420
84265
|
];
|
|
84421
84266
|
var OUTPUT_EXTENSIONS = {
|
|
@@ -84431,7 +84276,6 @@ var OUTPUT_EXTENSIONS = {
|
|
|
84431
84276
|
kicad_sch: ".kicad_sch",
|
|
84432
84277
|
kicad_pcb: ".kicad_pcb",
|
|
84433
84278
|
kicad_zip: "-kicad.zip",
|
|
84434
|
-
"kicad-footprint-library": "-footprints.zip",
|
|
84435
84279
|
"kicad-library": ""
|
|
84436
84280
|
};
|
|
84437
84281
|
var exportSnippet = async ({
|
|
@@ -84448,10 +84292,10 @@ var exportSnippet = async ({
|
|
|
84448
84292
|
onError(`Invalid format: ${format}`);
|
|
84449
84293
|
return onExit(1);
|
|
84450
84294
|
}
|
|
84451
|
-
const projectDir =
|
|
84452
|
-
const outputBaseName =
|
|
84295
|
+
const projectDir = path30.dirname(filePath);
|
|
84296
|
+
const outputBaseName = path30.basename(filePath).replace(/\.[^.]+$/, "");
|
|
84453
84297
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
84454
|
-
const outputDestination =
|
|
84298
|
+
const outputDestination = path30.join(projectDir, outputPath ?? outputFileName);
|
|
84455
84299
|
const circuitData = await generateCircuitJson({
|
|
84456
84300
|
filePath,
|
|
84457
84301
|
saveToFile: format === "circuit-json",
|
|
@@ -84509,33 +84353,6 @@ var exportSnippet = async ({
|
|
|
84509
84353
|
outputContent = await zip.generateAsync({ type: "nodebuffer" });
|
|
84510
84354
|
break;
|
|
84511
84355
|
}
|
|
84512
|
-
case "kicad-footprint-library": {
|
|
84513
|
-
const pcbConverter = new CircuitJsonToKicadPcbConverter(circuitData.circuitJson);
|
|
84514
|
-
pcbConverter.runUntilFinished();
|
|
84515
|
-
const pcbContent = pcbConverter.getOutputString();
|
|
84516
|
-
const footprintEntries = extractFootprintsFromPcb(pcbContent);
|
|
84517
|
-
const zip = new import_jszip2.default;
|
|
84518
|
-
const libraryNames = new Set;
|
|
84519
|
-
for (const entry of footprintEntries) {
|
|
84520
|
-
libraryNames.add(entry.libraryName);
|
|
84521
|
-
const libraryFolder = zip.folder(`${entry.libraryName}.pretty`);
|
|
84522
|
-
if (libraryFolder) {
|
|
84523
|
-
libraryFolder.file(`${entry.footprintName}.kicad_mod`, `${entry.content}
|
|
84524
|
-
`);
|
|
84525
|
-
}
|
|
84526
|
-
}
|
|
84527
|
-
if (libraryNames.size > 0) {
|
|
84528
|
-
const libTableEntries = Array.from(libraryNames).sort().map((name) => ` (lib (name ${name}) (type KiCad) (uri \${KIPRJMOD}/${name}.pretty) (options "") (descr "Generated by tsci export"))`);
|
|
84529
|
-
const libTableContent = `(fp_lib_table
|
|
84530
|
-
${libTableEntries.join(`
|
|
84531
|
-
`)}
|
|
84532
|
-
)
|
|
84533
|
-
`;
|
|
84534
|
-
zip.file("fp-lib-table", libTableContent);
|
|
84535
|
-
}
|
|
84536
|
-
outputContent = await zip.generateAsync({ type: "nodebuffer" });
|
|
84537
|
-
break;
|
|
84538
|
-
}
|
|
84539
84356
|
case "kicad-library": {
|
|
84540
84357
|
const libraryName = outputBaseName;
|
|
84541
84358
|
const fpLibName = outputBaseName;
|
|
@@ -84546,26 +84363,26 @@ ${libTableEntries.join(`
|
|
|
84546
84363
|
libConverter.runUntilFinished();
|
|
84547
84364
|
const libOutput = libConverter.getOutput();
|
|
84548
84365
|
const libDir = outputDestination;
|
|
84549
|
-
|
|
84550
|
-
|
|
84551
|
-
const fpDir =
|
|
84552
|
-
|
|
84366
|
+
fs28.mkdirSync(libDir, { recursive: true });
|
|
84367
|
+
fs28.writeFileSync(path30.join(libDir, `${libraryName}.kicad_sym`), libOutput.kicadSymString);
|
|
84368
|
+
const fpDir = path30.join(libDir, `${fpLibName}.pretty`);
|
|
84369
|
+
fs28.mkdirSync(fpDir, { recursive: true });
|
|
84553
84370
|
for (const fp of libOutput.footprints) {
|
|
84554
|
-
|
|
84371
|
+
fs28.writeFileSync(path30.join(fpDir, `${fp.footprintName}.kicad_mod`), `${fp.kicadModString}
|
|
84555
84372
|
`);
|
|
84556
84373
|
}
|
|
84557
84374
|
if (libOutput.model3dSourcePaths.length > 0) {
|
|
84558
|
-
const shapesDir =
|
|
84559
|
-
|
|
84375
|
+
const shapesDir = path30.join(libDir, `${fpLibName}.3dshapes`);
|
|
84376
|
+
fs28.mkdirSync(shapesDir, { recursive: true });
|
|
84560
84377
|
for (const modelPath of libOutput.model3dSourcePaths) {
|
|
84561
|
-
if (
|
|
84562
|
-
const filename =
|
|
84563
|
-
|
|
84378
|
+
if (fs28.existsSync(modelPath)) {
|
|
84379
|
+
const filename = path30.basename(modelPath);
|
|
84380
|
+
fs28.copyFileSync(modelPath, path30.join(shapesDir, filename));
|
|
84564
84381
|
}
|
|
84565
84382
|
}
|
|
84566
84383
|
}
|
|
84567
|
-
|
|
84568
|
-
|
|
84384
|
+
fs28.writeFileSync(path30.join(libDir, "fp-lib-table"), libOutput.fpLibTableString);
|
|
84385
|
+
fs28.writeFileSync(path30.join(libDir, "sym-lib-table"), libOutput.symLibTableString);
|
|
84569
84386
|
outputContent = "";
|
|
84570
84387
|
if (writeFile) {
|
|
84571
84388
|
onSuccess({ outputDestination: libDir, outputContent: "" });
|
|
@@ -84700,12 +84517,12 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
84700
84517
|
};
|
|
84701
84518
|
|
|
84702
84519
|
// lib/eecircuit-engine/run-simulation.ts
|
|
84703
|
-
import { promises as
|
|
84704
|
-
import
|
|
84520
|
+
import { promises as fs29, existsSync as existsSync12 } from "node:fs";
|
|
84521
|
+
import path31 from "node:path";
|
|
84705
84522
|
import os4 from "node:os";
|
|
84706
84523
|
var sim = null;
|
|
84707
84524
|
var fetchSimulation = async () => {
|
|
84708
|
-
const tempFilePath =
|
|
84525
|
+
const tempFilePath = path31.join(os4.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
84709
84526
|
if (!existsSync12(tempFilePath)) {
|
|
84710
84527
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
84711
84528
|
const response = await fetch(url);
|
|
@@ -84713,7 +84530,7 @@ var fetchSimulation = async () => {
|
|
|
84713
84530
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
84714
84531
|
}
|
|
84715
84532
|
const scriptContent = await response.text();
|
|
84716
|
-
await
|
|
84533
|
+
await fs29.writeFile(tempFilePath, scriptContent);
|
|
84717
84534
|
}
|
|
84718
84535
|
const module2 = await import(tempFilePath);
|
|
84719
84536
|
return module2.Simulation;
|
|
@@ -84802,8 +84619,8 @@ var resultToCsv = (result) => {
|
|
|
84802
84619
|
};
|
|
84803
84620
|
|
|
84804
84621
|
// cli/export/register.ts
|
|
84805
|
-
import
|
|
84806
|
-
import { promises as
|
|
84622
|
+
import path32 from "node:path";
|
|
84623
|
+
import { promises as fs30 } from "node:fs";
|
|
84807
84624
|
var registerExport = (program3) => {
|
|
84808
84625
|
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
84809
84626
|
const formatOption = options.format ?? "json";
|
|
@@ -84815,12 +84632,12 @@ var registerExport = (program3) => {
|
|
|
84815
84632
|
});
|
|
84816
84633
|
if (circuitJson) {
|
|
84817
84634
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
84818
|
-
const outputSpicePath = options.output ??
|
|
84819
|
-
await
|
|
84635
|
+
const outputSpicePath = options.output ?? path32.join(path32.dirname(file), `${path32.basename(file, path32.extname(file))}.spice.cir`);
|
|
84636
|
+
await fs30.writeFile(outputSpicePath, spiceString);
|
|
84820
84637
|
const { result } = await runSimulation(spiceString);
|
|
84821
84638
|
const csvContent = resultToCsv(result);
|
|
84822
84639
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
84823
|
-
await
|
|
84640
|
+
await fs30.writeFile(outputCsvPath, csvContent);
|
|
84824
84641
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
84825
84642
|
}
|
|
84826
84643
|
process.exit(0);
|
|
@@ -85045,14 +84862,14 @@ class KeyStore {
|
|
|
85045
84862
|
}
|
|
85046
84863
|
}
|
|
85047
84864
|
function createKey(key) {
|
|
85048
|
-
let
|
|
84865
|
+
let path33 = null;
|
|
85049
84866
|
let id = null;
|
|
85050
84867
|
let src = null;
|
|
85051
84868
|
let weight = 1;
|
|
85052
84869
|
let getFn = null;
|
|
85053
84870
|
if (isString2(key) || isArray(key)) {
|
|
85054
84871
|
src = key;
|
|
85055
|
-
|
|
84872
|
+
path33 = createKeyPath(key);
|
|
85056
84873
|
id = createKeyId(key);
|
|
85057
84874
|
} else {
|
|
85058
84875
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -85066,11 +84883,11 @@ function createKey(key) {
|
|
|
85066
84883
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
85067
84884
|
}
|
|
85068
84885
|
}
|
|
85069
|
-
|
|
84886
|
+
path33 = createKeyPath(name);
|
|
85070
84887
|
id = createKeyId(name);
|
|
85071
84888
|
getFn = key.getFn;
|
|
85072
84889
|
}
|
|
85073
|
-
return { path:
|
|
84890
|
+
return { path: path33, id, weight, src, getFn };
|
|
85074
84891
|
}
|
|
85075
84892
|
function createKeyPath(key) {
|
|
85076
84893
|
return isArray(key) ? key : key.split(".");
|
|
@@ -85078,34 +84895,34 @@ function createKeyPath(key) {
|
|
|
85078
84895
|
function createKeyId(key) {
|
|
85079
84896
|
return isArray(key) ? key.join(".") : key;
|
|
85080
84897
|
}
|
|
85081
|
-
function get(obj,
|
|
84898
|
+
function get(obj, path33) {
|
|
85082
84899
|
let list = [];
|
|
85083
84900
|
let arr = false;
|
|
85084
|
-
const deepGet = (obj2,
|
|
84901
|
+
const deepGet = (obj2, path34, index) => {
|
|
85085
84902
|
if (!isDefined(obj2)) {
|
|
85086
84903
|
return;
|
|
85087
84904
|
}
|
|
85088
|
-
if (!
|
|
84905
|
+
if (!path34[index]) {
|
|
85089
84906
|
list.push(obj2);
|
|
85090
84907
|
} else {
|
|
85091
|
-
let key =
|
|
84908
|
+
let key = path34[index];
|
|
85092
84909
|
const value = obj2[key];
|
|
85093
84910
|
if (!isDefined(value)) {
|
|
85094
84911
|
return;
|
|
85095
84912
|
}
|
|
85096
|
-
if (index ===
|
|
84913
|
+
if (index === path34.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
85097
84914
|
list.push(toString(value));
|
|
85098
84915
|
} else if (isArray(value)) {
|
|
85099
84916
|
arr = true;
|
|
85100
84917
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
85101
|
-
deepGet(value[i],
|
|
84918
|
+
deepGet(value[i], path34, index + 1);
|
|
85102
84919
|
}
|
|
85103
|
-
} else if (
|
|
85104
|
-
deepGet(value,
|
|
84920
|
+
} else if (path34.length) {
|
|
84921
|
+
deepGet(value, path34, index + 1);
|
|
85105
84922
|
}
|
|
85106
84923
|
}
|
|
85107
84924
|
};
|
|
85108
|
-
deepGet(obj, isString2(
|
|
84925
|
+
deepGet(obj, isString2(path33) ? path33.split(".") : path33, 0);
|
|
85109
84926
|
return arr ? list : list[0];
|
|
85110
84927
|
}
|
|
85111
84928
|
var MatchOptions = {
|
|
@@ -86297,8 +86114,8 @@ var registerSearch = (program3) => {
|
|
|
86297
86114
|
}
|
|
86298
86115
|
if (kicadResults.length) {
|
|
86299
86116
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
86300
|
-
kicadResults.forEach((
|
|
86301
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
86117
|
+
kicadResults.forEach((path33, idx) => {
|
|
86118
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path33.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
86302
86119
|
});
|
|
86303
86120
|
}
|
|
86304
86121
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -91261,12 +91078,12 @@ var { paths: Ac, texts: ov, bounds: Le, refblocks: $y, circles: Pc } = R;
|
|
|
91261
91078
|
var My = e({ primitives: [...Object.values(Ac), ...Object.values(Pc), { type: "text", text: "{REF}", x: 0.15, y: -0.2894553499999995 }, { type: "text", text: "{VAL}", x: -0.15, y: -0.2894553499999995 }], ports: [{ ...$y.left1, labels: ["1"] }, { ...$y.right1, labels: ["2"] }], size: { width: Le.width, height: Le.height }, center: { x: Le.centerX, y: Le.centerY } }).rotateRightFacingSymbol("up").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_left").changeTextAnchor("{VAL}", "middle_left").build();
|
|
91262
91079
|
var Cy = { paths: { path11: { type: "path", points: [{ x: -0.53, y: 0 }, { x: -0.3, y: 0 }], color: "primary", fill: false }, path12: { type: "path", points: [{ x: 0.29, y: 0 }, { x: 0.53, y: 0 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: -0.18, y: -0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.01, y: 0.43 }, left1: { type: "text", text: "Hz", x: 0, y: -0.04 } }, refblocks: { left1: { x: -0.54, y: 0 }, right1: { x: 0.54, y: 0 } }, bounds: { minX: -0.53, maxX: 0.53, minY: 0, maxY: 0, width: 1.06, height: 1, centerX: 0, centerY: 0 }, circles: { path1: { type: "circle", x: -0.01, y: -0.01, radius: 0.29, color: "primary", fill: false } } };
|
|
91263
91080
|
var { paths: Fc, texts: Rc, bounds: Ve, refblocks: Ny, circles: Tc } = Cy;
|
|
91264
|
-
var
|
|
91265
|
-
var { 5: Ec, ...Yc } =
|
|
91081
|
+
var At3 = s({ primitives: [...Object.values(Fc), ...Object.values(Tc), { type: "text", text: "{REF}", x: 0, y: -0.3594553499999995, anchor: "middle_top" }, { type: "text", text: "{VAL}", x: 0, y: 0.35, anchor: "middle_bottom" }, { ...Rc.left1, x: 0, y: 0.01, anchor: "center", fontSize: 0.2 }], ports: [{ ...Ny.left1, labels: ["1"] }, { ...Ny.right1, labels: ["2"] }], size: { width: Ve.width, height: Ve.height }, center: { x: Ve.centerX, y: Ve.centerY } });
|
|
91082
|
+
var { 5: Ec, ...Yc } = At3.primitives;
|
|
91266
91083
|
function Xc(t2) {
|
|
91267
91084
|
return typeof t2 == "object";
|
|
91268
91085
|
}
|
|
91269
|
-
var Iy = r({ ...
|
|
91086
|
+
var Iy = r({ ...At3, primitives: Object.values(Yc).filter(Xc) });
|
|
91270
91087
|
var By = { ...Iy, primitives: [...Iy.primitives, Ec] };
|
|
91271
91088
|
var qy = { paths: { path10: { type: "path", points: [{ x: -0.53, y: 0.04 }, { x: 0.53, y: 0.04 }], color: "primary", fill: false }, path14: { type: "path", points: [{ x: 0, y: 0.17 }, { x: 0.27, y: 0.17 }, { x: 0.27, y: -0.1 }, { x: -0.26, y: -0.1 }, { x: -0.26, y: 0.17 }, { x: 0, y: 0.17 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: -0.01, y: 0.24 }, bottom1: { type: "text", text: "{VAL}", x: -0.17, y: -0.24 } }, refblocks: { left1: { x: -0.53, y: 0.04 }, right1: { x: 0.53, y: 0.04 } }, bounds: { minX: -0.56, maxX: 0.56, minY: -0.24, maxY: 0.24, width: 1.13, height: 0.47, centerX: 0, centerY: 0 }, circles: {} };
|
|
91272
91089
|
var { paths: Vc, texts: jc, bounds: je, refblocks: Dy } = qy;
|
|
@@ -91477,7 +91294,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
91477
91294
|
var U = e({ primitives: [...Object.values(Ad)], ports: [{ ...Pd.left1, labels: ["1"] }], center: { x: ss.centerX, y: ss.centerY } }).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).build();
|
|
91478
91295
|
var ms = r(U, "down");
|
|
91479
91296
|
var ns = r(U, "left");
|
|
91480
|
-
var
|
|
91297
|
+
var fs31 = r(U, "up");
|
|
91481
91298
|
var g = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, "path40-0": { type: "path", points: [{ x: 0.07, y: 0.27 }, { x: 0.07, y: -0.28 }], color: "primary", fill: false }, "path40-0-5": { type: "path", points: [{ x: 0.28, y: 0.24 }, { x: 0.08, y: 0.11 }], color: "primary", fill: false }, "path40-0-5-0": { type: "path", points: [{ x: 0.29, y: -0.24 }, { x: 0.09, y: -0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: 0.25 }, { x: 0.29, y: 0.54 }], color: "primary", fill: false }, "path12-1-5-3": { type: "path", points: [{ x: 0.29, y: -0.54 }, { x: 0.29, y: -0.25 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.19, y: -0.1 }, { x: 0.12, y: -0.2 }, { x: 0.22, y: -0.2 }, { x: 0.19, y: -0.1 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.08, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.07, y: -0.41 } }, refblocks: { top1: { x: 0.29, y: 0.55 }, bottom1: { x: 0.29, y: -0.55 }, left1: { x: -0.4, y: 0 } }, bounds: { minX: -0.43, maxX: 0.43, minY: -0.58, maxY: 0.58, width: 0.85, height: 1.16, centerX: 0, centerY: 0 }, circles: { "path1-0": { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
91482
91299
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
91483
91300
|
var hs = e({ primitives: [...Object.values(Fd), ...Object.values(Rd), { type: "text", text: "{REF}", x: -0.1, y: 0.3094553499999995 }, { type: "text", text: "{VAL}", x: -0.1, y: -0.3094553499999995 }], ports: [{ ...Mo.top1, labels: ["1", "collector"] }, { ...Mo.bottom1, labels: ["2", "emitter"] }, { ...Mo.left1, labels: ["3", "base"] }], size: { width: e0.width, height: e0.height }, center: { x: e0.centerX, y: e0.centerY } }).rotateRightFacingSymbol("right").changeTextAnchor("{REF}", "middle_right").changeTextAnchor("{VAL}", "middle_right").build();
|
|
@@ -92046,7 +91863,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
92046
91863
|
sb.anchor = "middle_left";
|
|
92047
91864
|
mb.anchor = "middle_right";
|
|
92048
91865
|
var B1 = Cl;
|
|
92049
|
-
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz:
|
|
91866
|
+
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At3, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os5, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs31, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
|
|
92050
91867
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
92051
91868
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
92052
91869
|
lineThickness = 0
|
|
@@ -94076,11 +93893,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
94076
93893
|
fiber = fiber.next, id2--;
|
|
94077
93894
|
return fiber;
|
|
94078
93895
|
}
|
|
94079
|
-
function copyWithSetImpl(obj,
|
|
94080
|
-
if (index >=
|
|
93896
|
+
function copyWithSetImpl(obj, path33, index, value) {
|
|
93897
|
+
if (index >= path33.length)
|
|
94081
93898
|
return value;
|
|
94082
|
-
var key =
|
|
94083
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
93899
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93900
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index + 1, value);
|
|
94084
93901
|
return updated;
|
|
94085
93902
|
}
|
|
94086
93903
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -94100,11 +93917,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
94100
93917
|
index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
|
|
94101
93918
|
return updated;
|
|
94102
93919
|
}
|
|
94103
|
-
function copyWithDeleteImpl(obj,
|
|
94104
|
-
var key =
|
|
94105
|
-
if (index + 1 ===
|
|
93920
|
+
function copyWithDeleteImpl(obj, path33, index) {
|
|
93921
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93922
|
+
if (index + 1 === path33.length)
|
|
94106
93923
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
94107
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
93924
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index + 1);
|
|
94108
93925
|
return updated;
|
|
94109
93926
|
}
|
|
94110
93927
|
function shouldSuspendImpl() {
|
|
@@ -103135,29 +102952,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
103135
102952
|
var didWarnAboutNestedUpdates = false;
|
|
103136
102953
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
103137
102954
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
103138
|
-
overrideHookState = function(fiber, id2,
|
|
102955
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
103139
102956
|
id2 = findHook(fiber, id2);
|
|
103140
|
-
id2 !== null && (
|
|
102957
|
+
id2 !== null && (path33 = copyWithSetImpl(id2.memoizedState, path33, 0, value), id2.memoizedState = path33, id2.baseState = path33, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path33 = enqueueConcurrentRenderForLane(fiber, 2), path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2));
|
|
103141
102958
|
};
|
|
103142
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
102959
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
103143
102960
|
id2 = findHook(fiber, id2);
|
|
103144
|
-
id2 !== null && (
|
|
102961
|
+
id2 !== null && (path33 = copyWithDeleteImpl(id2.memoizedState, path33, 0), id2.memoizedState = path33, id2.baseState = path33, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path33 = enqueueConcurrentRenderForLane(fiber, 2), path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2));
|
|
103145
102962
|
};
|
|
103146
102963
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
103147
102964
|
id2 = findHook(fiber, id2);
|
|
103148
102965
|
id2 !== null && (oldPath = copyWithRename(id2.memoizedState, oldPath, newPath), id2.memoizedState = oldPath, id2.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
|
|
103149
102966
|
};
|
|
103150
|
-
overrideProps = function(fiber,
|
|
103151
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
102967
|
+
overrideProps = function(fiber, path33, value) {
|
|
102968
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path33, 0, value);
|
|
103152
102969
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
103153
|
-
|
|
103154
|
-
|
|
102970
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102971
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
103155
102972
|
};
|
|
103156
|
-
overridePropsDeletePath = function(fiber,
|
|
103157
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
102973
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
102974
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path33, 0);
|
|
103158
102975
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
103159
|
-
|
|
103160
|
-
|
|
102976
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102977
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
103161
102978
|
};
|
|
103162
102979
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
103163
102980
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -118494,10 +118311,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118494
118311
|
var setErrorHandler = null;
|
|
118495
118312
|
var setSuspenseHandler = null;
|
|
118496
118313
|
{
|
|
118497
|
-
var copyWithDeleteImpl = function(obj,
|
|
118498
|
-
var key =
|
|
118314
|
+
var copyWithDeleteImpl = function(obj, path33, index2) {
|
|
118315
|
+
var key = path33[index2];
|
|
118499
118316
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118500
|
-
if (index2 + 1 ===
|
|
118317
|
+
if (index2 + 1 === path33.length) {
|
|
118501
118318
|
if (isArray2(updated)) {
|
|
118502
118319
|
updated.splice(key, 1);
|
|
118503
118320
|
} else {
|
|
@@ -118505,11 +118322,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118505
118322
|
}
|
|
118506
118323
|
return updated;
|
|
118507
118324
|
}
|
|
118508
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
118325
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index2 + 1);
|
|
118509
118326
|
return updated;
|
|
118510
118327
|
};
|
|
118511
|
-
var copyWithDelete = function(obj,
|
|
118512
|
-
return copyWithDeleteImpl(obj,
|
|
118328
|
+
var copyWithDelete = function(obj, path33) {
|
|
118329
|
+
return copyWithDeleteImpl(obj, path33, 0);
|
|
118513
118330
|
};
|
|
118514
118331
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
118515
118332
|
var oldKey = oldPath[index2];
|
|
@@ -118541,17 +118358,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118541
118358
|
}
|
|
118542
118359
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
118543
118360
|
};
|
|
118544
|
-
var copyWithSetImpl = function(obj,
|
|
118545
|
-
if (index2 >=
|
|
118361
|
+
var copyWithSetImpl = function(obj, path33, index2, value) {
|
|
118362
|
+
if (index2 >= path33.length) {
|
|
118546
118363
|
return value;
|
|
118547
118364
|
}
|
|
118548
|
-
var key =
|
|
118365
|
+
var key = path33[index2];
|
|
118549
118366
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118550
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
118367
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index2 + 1, value);
|
|
118551
118368
|
return updated;
|
|
118552
118369
|
};
|
|
118553
|
-
var copyWithSet = function(obj,
|
|
118554
|
-
return copyWithSetImpl(obj,
|
|
118370
|
+
var copyWithSet = function(obj, path33, value) {
|
|
118371
|
+
return copyWithSetImpl(obj, path33, 0, value);
|
|
118555
118372
|
};
|
|
118556
118373
|
var findHook = function(fiber, id2) {
|
|
118557
118374
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -118561,10 +118378,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118561
118378
|
}
|
|
118562
118379
|
return currentHook2;
|
|
118563
118380
|
};
|
|
118564
|
-
overrideHookState = function(fiber, id2,
|
|
118381
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
118565
118382
|
var hook = findHook(fiber, id2);
|
|
118566
118383
|
if (hook !== null) {
|
|
118567
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
118384
|
+
var newState = copyWithSet(hook.memoizedState, path33, value);
|
|
118568
118385
|
hook.memoizedState = newState;
|
|
118569
118386
|
hook.baseState = newState;
|
|
118570
118387
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118574,10 +118391,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118574
118391
|
}
|
|
118575
118392
|
}
|
|
118576
118393
|
};
|
|
118577
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
118394
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
118578
118395
|
var hook = findHook(fiber, id2);
|
|
118579
118396
|
if (hook !== null) {
|
|
118580
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
118397
|
+
var newState = copyWithDelete(hook.memoizedState, path33);
|
|
118581
118398
|
hook.memoizedState = newState;
|
|
118582
118399
|
hook.baseState = newState;
|
|
118583
118400
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118600,8 +118417,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118600
118417
|
}
|
|
118601
118418
|
}
|
|
118602
118419
|
};
|
|
118603
|
-
overrideProps = function(fiber,
|
|
118604
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
118420
|
+
overrideProps = function(fiber, path33, value) {
|
|
118421
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path33, value);
|
|
118605
118422
|
if (fiber.alternate) {
|
|
118606
118423
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118607
118424
|
}
|
|
@@ -118610,8 +118427,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118610
118427
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
118611
118428
|
}
|
|
118612
118429
|
};
|
|
118613
|
-
overridePropsDeletePath = function(fiber,
|
|
118614
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
118430
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
118431
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path33);
|
|
118615
118432
|
if (fiber.alternate) {
|
|
118616
118433
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118617
118434
|
}
|
|
@@ -124662,7 +124479,7 @@ var parsePin = (pinString) => {
|
|
|
124662
124479
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
124663
124480
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
124664
124481
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
124665
|
-
const
|
|
124482
|
+
const path33 = pathMatch ? pathMatch[1] : "";
|
|
124666
124483
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
124667
124484
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
124668
124485
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -124676,7 +124493,7 @@ var parsePin = (pinString) => {
|
|
|
124676
124493
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
124677
124494
|
label,
|
|
124678
124495
|
labelColor,
|
|
124679
|
-
path:
|
|
124496
|
+
path: path33,
|
|
124680
124497
|
arrow
|
|
124681
124498
|
};
|
|
124682
124499
|
};
|
|
@@ -125116,15 +124933,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
125116
124933
|
}
|
|
125117
124934
|
}
|
|
125118
124935
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
125119
|
-
const
|
|
124936
|
+
const path33 = [];
|
|
125120
124937
|
for (let i = 0;i <= numPoints; i++) {
|
|
125121
124938
|
const t3 = i / numPoints;
|
|
125122
124939
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
125123
124940
|
const x = centerX + radius * Math.cos(angle2);
|
|
125124
124941
|
const y = centerY + radius * Math.sin(angle2);
|
|
125125
|
-
|
|
124942
|
+
path33.push({ x, y });
|
|
125126
124943
|
}
|
|
125127
|
-
return
|
|
124944
|
+
return path33;
|
|
125128
124945
|
}
|
|
125129
124946
|
var __defProp4 = Object.defineProperty;
|
|
125130
124947
|
var __export22 = (target, all) => {
|
|
@@ -126542,7 +126359,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
126542
126359
|
};
|
|
126543
126360
|
};
|
|
126544
126361
|
var silkscreenPin = ({
|
|
126545
|
-
fs:
|
|
126362
|
+
fs: fs32,
|
|
126546
126363
|
pn: pn2,
|
|
126547
126364
|
anchor_x,
|
|
126548
126365
|
anchor_y,
|
|
@@ -126585,7 +126402,7 @@ var silkscreenPin = ({
|
|
|
126585
126402
|
type: "pcb_silkscreen_text",
|
|
126586
126403
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
126587
126404
|
font: "tscircuit2024",
|
|
126588
|
-
font_size:
|
|
126405
|
+
font_size: fs32,
|
|
126589
126406
|
pcb_component_id: "pcb_component_1",
|
|
126590
126407
|
text: `{PIN${pn2}}`,
|
|
126591
126408
|
layer,
|
|
@@ -134201,17 +134018,17 @@ var ObstacleList = class {
|
|
|
134201
134018
|
return obstacles;
|
|
134202
134019
|
}
|
|
134203
134020
|
};
|
|
134204
|
-
function removePathLoops(
|
|
134205
|
-
if (
|
|
134206
|
-
return
|
|
134207
|
-
const result = [{ ...
|
|
134208
|
-
let currentLayer =
|
|
134209
|
-
for (let i = 1;i <
|
|
134210
|
-
const currentSegment = { start:
|
|
134211
|
-
const isVia =
|
|
134212
|
-
if (
|
|
134213
|
-
result.push({ ...
|
|
134214
|
-
currentLayer =
|
|
134021
|
+
function removePathLoops(path33) {
|
|
134022
|
+
if (path33.length < 4)
|
|
134023
|
+
return path33;
|
|
134024
|
+
const result = [{ ...path33[0] }];
|
|
134025
|
+
let currentLayer = path33[0].layer;
|
|
134026
|
+
for (let i = 1;i < path33.length; i++) {
|
|
134027
|
+
const currentSegment = { start: path33[i - 1], end: path33[i] };
|
|
134028
|
+
const isVia = path33[i].route_type === "via" || path33[i - 1].route_type === "via";
|
|
134029
|
+
if (path33[i].layer !== currentLayer || isVia) {
|
|
134030
|
+
result.push({ ...path33[i] });
|
|
134031
|
+
currentLayer = path33[i].layer;
|
|
134215
134032
|
continue;
|
|
134216
134033
|
}
|
|
134217
134034
|
let intersectionFound = false;
|
|
@@ -134240,8 +134057,8 @@ function removePathLoops(path34) {
|
|
|
134240
134057
|
result.push(intersectionPoint);
|
|
134241
134058
|
}
|
|
134242
134059
|
const lastPoint = result[result.length - 1];
|
|
134243
|
-
if (lastPoint.x !==
|
|
134244
|
-
result.push(
|
|
134060
|
+
if (lastPoint.x !== path33[i].x || lastPoint.y !== path33[i].y) {
|
|
134061
|
+
result.push(path33[i]);
|
|
134245
134062
|
}
|
|
134246
134063
|
}
|
|
134247
134064
|
return result;
|
|
@@ -134730,10 +134547,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134730
134547
|
});
|
|
134731
134548
|
}
|
|
134732
134549
|
if (current2.parent) {
|
|
134733
|
-
const
|
|
134550
|
+
const path33 = [];
|
|
134734
134551
|
let p = current2;
|
|
134735
134552
|
while (p) {
|
|
134736
|
-
|
|
134553
|
+
path33.unshift(p);
|
|
134737
134554
|
p = p.parent;
|
|
134738
134555
|
}
|
|
134739
134556
|
debugSolution.push({
|
|
@@ -134741,7 +134558,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134741
134558
|
pcb_component_id: "",
|
|
134742
134559
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
134743
134560
|
layer: "top",
|
|
134744
|
-
route:
|
|
134561
|
+
route: path33,
|
|
134745
134562
|
stroke_width: 0.01
|
|
134746
134563
|
});
|
|
134747
134564
|
}
|
|
@@ -139663,13 +139480,13 @@ var RBush = class {
|
|
|
139663
139480
|
return this;
|
|
139664
139481
|
let node = this.data;
|
|
139665
139482
|
const bbox = this.toBBox(item);
|
|
139666
|
-
const
|
|
139483
|
+
const path33 = [];
|
|
139667
139484
|
const indexes = [];
|
|
139668
139485
|
let i, parent, goingUp;
|
|
139669
|
-
while (node ||
|
|
139486
|
+
while (node || path33.length) {
|
|
139670
139487
|
if (!node) {
|
|
139671
|
-
node =
|
|
139672
|
-
parent =
|
|
139488
|
+
node = path33.pop();
|
|
139489
|
+
parent = path33[path33.length - 1];
|
|
139673
139490
|
i = indexes.pop();
|
|
139674
139491
|
goingUp = true;
|
|
139675
139492
|
}
|
|
@@ -139677,13 +139494,13 @@ var RBush = class {
|
|
|
139677
139494
|
const index = findItem(item, node.children, equalsFn);
|
|
139678
139495
|
if (index !== -1) {
|
|
139679
139496
|
node.children.splice(index, 1);
|
|
139680
|
-
|
|
139681
|
-
this._condense(
|
|
139497
|
+
path33.push(node);
|
|
139498
|
+
this._condense(path33);
|
|
139682
139499
|
return this;
|
|
139683
139500
|
}
|
|
139684
139501
|
}
|
|
139685
139502
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
139686
|
-
|
|
139503
|
+
path33.push(node);
|
|
139687
139504
|
indexes.push(i);
|
|
139688
139505
|
i = 0;
|
|
139689
139506
|
parent = node;
|
|
@@ -139754,10 +139571,10 @@ var RBush = class {
|
|
|
139754
139571
|
calcBBox(node, this.toBBox);
|
|
139755
139572
|
return node;
|
|
139756
139573
|
}
|
|
139757
|
-
_chooseSubtree(bbox, node, level,
|
|
139574
|
+
_chooseSubtree(bbox, node, level, path33) {
|
|
139758
139575
|
while (true) {
|
|
139759
|
-
|
|
139760
|
-
if (node.leaf ||
|
|
139576
|
+
path33.push(node);
|
|
139577
|
+
if (node.leaf || path33.length - 1 === level)
|
|
139761
139578
|
break;
|
|
139762
139579
|
let minArea = Infinity;
|
|
139763
139580
|
let minEnlargement = Infinity;
|
|
@@ -139866,21 +139683,21 @@ var RBush = class {
|
|
|
139866
139683
|
}
|
|
139867
139684
|
return margin;
|
|
139868
139685
|
}
|
|
139869
|
-
_adjustParentBBoxes(bbox,
|
|
139686
|
+
_adjustParentBBoxes(bbox, path33, level) {
|
|
139870
139687
|
for (let i = level;i >= 0; i--) {
|
|
139871
|
-
extend(
|
|
139688
|
+
extend(path33[i], bbox);
|
|
139872
139689
|
}
|
|
139873
139690
|
}
|
|
139874
|
-
_condense(
|
|
139875
|
-
for (let i =
|
|
139876
|
-
if (
|
|
139691
|
+
_condense(path33) {
|
|
139692
|
+
for (let i = path33.length - 1, siblings;i >= 0; i--) {
|
|
139693
|
+
if (path33[i].children.length === 0) {
|
|
139877
139694
|
if (i > 0) {
|
|
139878
|
-
siblings =
|
|
139879
|
-
siblings.splice(siblings.indexOf(
|
|
139695
|
+
siblings = path33[i - 1].children;
|
|
139696
|
+
siblings.splice(siblings.indexOf(path33[i]), 1);
|
|
139880
139697
|
} else
|
|
139881
139698
|
this.clear();
|
|
139882
139699
|
} else
|
|
139883
|
-
calcBBox(
|
|
139700
|
+
calcBBox(path33[i], this.toBBox);
|
|
139884
139701
|
}
|
|
139885
139702
|
}
|
|
139886
139703
|
};
|
|
@@ -141025,7 +140842,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141025
140842
|
this.capacityPaths = capacityPaths;
|
|
141026
140843
|
this.colorMap = colorMap ?? {};
|
|
141027
140844
|
this.unprocessedNodeIds = [
|
|
141028
|
-
...new Set(capacityPaths.flatMap((
|
|
140845
|
+
...new Set(capacityPaths.flatMap((path33) => path33.nodeIds))
|
|
141029
140846
|
];
|
|
141030
140847
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
141031
140848
|
}
|
|
@@ -141036,17 +140853,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141036
140853
|
return;
|
|
141037
140854
|
}
|
|
141038
140855
|
const pathsGoingThroughNode = [];
|
|
141039
|
-
for (const
|
|
141040
|
-
const indexOfNodeInPath =
|
|
140856
|
+
for (const path33 of this.capacityPaths) {
|
|
140857
|
+
const indexOfNodeInPath = path33.nodeIds.indexOf(nodeId);
|
|
141041
140858
|
if (indexOfNodeInPath !== -1) {
|
|
141042
|
-
pathsGoingThroughNode.push({ path:
|
|
140859
|
+
pathsGoingThroughNode.push({ path: path33, indexOfNodeInPath });
|
|
141043
140860
|
}
|
|
141044
140861
|
}
|
|
141045
140862
|
const node = this.nodeMap.get(nodeId);
|
|
141046
140863
|
const nodePortSegments = [];
|
|
141047
|
-
for (const { path:
|
|
141048
|
-
const entryNodeId =
|
|
141049
|
-
const exitNodeId =
|
|
140864
|
+
for (const { path: path33, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
140865
|
+
const entryNodeId = path33.nodeIds[indexOfNodeInPath - 1];
|
|
140866
|
+
const exitNodeId = path33.nodeIds[indexOfNodeInPath + 1];
|
|
141050
140867
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
141051
140868
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
141052
140869
|
if (!adjNode)
|
|
@@ -141059,7 +140876,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141059
140876
|
capacityMeshNodeId: nodeId,
|
|
141060
140877
|
start: segment2.start,
|
|
141061
140878
|
end: segment2.end,
|
|
141062
|
-
connectionNames: [
|
|
140879
|
+
connectionNames: [path33.connectionName],
|
|
141063
140880
|
availableZ: mutuallyAvailableZ
|
|
141064
140881
|
};
|
|
141065
140882
|
nodePortSegments.push(portSegment);
|
|
@@ -141865,37 +141682,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
141865
141682
|
return neighbors;
|
|
141866
141683
|
}
|
|
141867
141684
|
getNodePath(node) {
|
|
141868
|
-
const
|
|
141685
|
+
const path33 = [];
|
|
141869
141686
|
while (node) {
|
|
141870
|
-
|
|
141687
|
+
path33.push(node);
|
|
141871
141688
|
node = node.parent;
|
|
141872
141689
|
}
|
|
141873
|
-
return
|
|
141690
|
+
return path33;
|
|
141874
141691
|
}
|
|
141875
141692
|
getViasInNodePath(node) {
|
|
141876
|
-
const
|
|
141693
|
+
const path33 = this.getNodePath(node);
|
|
141877
141694
|
const vias = [];
|
|
141878
|
-
for (let i = 0;i <
|
|
141879
|
-
if (
|
|
141880
|
-
vias.push({ x:
|
|
141695
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141696
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141697
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141881
141698
|
}
|
|
141882
141699
|
}
|
|
141883
141700
|
return vias;
|
|
141884
141701
|
}
|
|
141885
141702
|
setSolvedPath(node) {
|
|
141886
|
-
const
|
|
141887
|
-
|
|
141703
|
+
const path33 = this.getNodePath(node);
|
|
141704
|
+
path33.reverse();
|
|
141888
141705
|
const vias = [];
|
|
141889
|
-
for (let i = 0;i <
|
|
141890
|
-
if (
|
|
141891
|
-
vias.push({ x:
|
|
141706
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141707
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141708
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141892
141709
|
}
|
|
141893
141710
|
}
|
|
141894
141711
|
this.solvedPath = {
|
|
141895
141712
|
connectionName: this.connectionName,
|
|
141896
141713
|
traceThickness: this.traceThickness,
|
|
141897
141714
|
viaDiameter: this.viaDiameter,
|
|
141898
|
-
route:
|
|
141715
|
+
route: path33.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
141899
141716
|
vias
|
|
141900
141717
|
};
|
|
141901
141718
|
}
|
|
@@ -142703,12 +142520,12 @@ function computeDumbbellPaths({
|
|
|
142703
142520
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
142704
142521
|
};
|
|
142705
142522
|
};
|
|
142706
|
-
const subdivideOptimalPath = (
|
|
142707
|
-
if (
|
|
142708
|
-
return
|
|
142709
|
-
const result = [
|
|
142710
|
-
for (let i = 0;i <
|
|
142711
|
-
const segment2 = { start:
|
|
142523
|
+
const subdivideOptimalPath = (path33, numSubdivisions) => {
|
|
142524
|
+
if (path33.length < 2)
|
|
142525
|
+
return path33;
|
|
142526
|
+
const result = [path33[0]];
|
|
142527
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142528
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
142712
142529
|
const segmentMidpoint = {
|
|
142713
142530
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
142714
142531
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -142770,7 +142587,7 @@ function computeDumbbellPaths({
|
|
|
142770
142587
|
}
|
|
142771
142588
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
142772
142589
|
}
|
|
142773
|
-
result.push(
|
|
142590
|
+
result.push(path33[i + 1]);
|
|
142774
142591
|
}
|
|
142775
142592
|
if (result.length > 1) {
|
|
142776
142593
|
const filteredResult = [result[0]];
|
|
@@ -143005,13 +142822,13 @@ function computeDumbbellPaths({
|
|
|
143005
142822
|
].map((l, index) => ({ ...l, index }));
|
|
143006
142823
|
};
|
|
143007
142824
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
143008
|
-
const
|
|
143009
|
-
if (
|
|
143010
|
-
return
|
|
142825
|
+
const path33 = jLine.points;
|
|
142826
|
+
if (path33.length < 2)
|
|
142827
|
+
return path33;
|
|
143011
142828
|
const minDistThreshold = r3 + m2;
|
|
143012
|
-
const result = [
|
|
143013
|
-
for (let i = 0;i <
|
|
143014
|
-
const segment2 = { start:
|
|
142829
|
+
const result = [path33[0]];
|
|
142830
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142831
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
143015
142832
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
143016
142833
|
if (distToOpposite < minDistThreshold) {
|
|
143017
142834
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -143080,26 +142897,26 @@ function computeDumbbellPaths({
|
|
|
143080
142897
|
return { index: 0, path: [] };
|
|
143081
142898
|
}
|
|
143082
142899
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
143083
|
-
const
|
|
143084
|
-
const firstPoint =
|
|
143085
|
-
const dist3 = distance3(firstPoint,
|
|
143086
|
-
const dist4 = distance3(firstPoint,
|
|
142900
|
+
const path33 = [...optimalPath2.path];
|
|
142901
|
+
const firstPoint = path33[0];
|
|
142902
|
+
const dist3 = distance3(firstPoint, path33[2]);
|
|
142903
|
+
const dist4 = distance3(firstPoint, path33[3]);
|
|
143087
142904
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
143088
|
-
if (dist3 < distance3(firstPoint,
|
|
143089
|
-
|
|
142905
|
+
if (dist3 < distance3(firstPoint, path33[1]) || dist4 < distance3(firstPoint, path33[1])) {
|
|
142906
|
+
path33.splice(1, closerIdx - 1);
|
|
143090
142907
|
}
|
|
143091
|
-
const lastPoint =
|
|
143092
|
-
const distM3 = distance3(lastPoint,
|
|
143093
|
-
const distM4 = distance3(lastPoint,
|
|
143094
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
143095
|
-
if (distM3 < distance3(lastPoint,
|
|
143096
|
-
|
|
142908
|
+
const lastPoint = path33[path33.length - 1];
|
|
142909
|
+
const distM3 = distance3(lastPoint, path33[path33.length - 3]);
|
|
142910
|
+
const distM4 = distance3(lastPoint, path33[path33.length - 4]);
|
|
142911
|
+
const closerLastIdx = distM3 < distM4 ? path33.length - 3 : path33.length - 4;
|
|
142912
|
+
if (distM3 < distance3(lastPoint, path33[path33.length - 2]) || distM4 < distance3(lastPoint, path33[path33.length - 2])) {
|
|
142913
|
+
path33.splice(closerLastIdx + 1, path33.length - closerLastIdx - 2);
|
|
143097
142914
|
}
|
|
143098
142915
|
return {
|
|
143099
142916
|
index: optimalPath2.index,
|
|
143100
|
-
path:
|
|
143101
|
-
startsAt:
|
|
143102
|
-
goesTo:
|
|
142917
|
+
path: path33,
|
|
142918
|
+
startsAt: path33[0] === C2 ? "C" : "D",
|
|
142919
|
+
goesTo: path33[path33.length - 1] === C2 ? "C" : "D"
|
|
143103
142920
|
};
|
|
143104
142921
|
};
|
|
143105
142922
|
const optimalPath = findOptimalPath();
|
|
@@ -144519,9 +144336,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144519
144336
|
let closestIntersection = null;
|
|
144520
144337
|
let intersectedSegmentZ = null;
|
|
144521
144338
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
144522
|
-
for (const
|
|
144523
|
-
for (let i = 0;i <
|
|
144524
|
-
const segment2 = [
|
|
144339
|
+
for (const path33 of pathMap.values()) {
|
|
144340
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144341
|
+
const segment2 = [path33[i], path33[i + 1]];
|
|
144525
144342
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
144526
144343
|
continue;
|
|
144527
144344
|
}
|
|
@@ -144651,11 +144468,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144651
144468
|
});
|
|
144652
144469
|
}
|
|
144653
144470
|
const drawPath = (pathMap, labelPrefix) => {
|
|
144654
|
-
for (const [connectionName,
|
|
144471
|
+
for (const [connectionName, path33] of pathMap.entries()) {
|
|
144655
144472
|
const color = colorMap[connectionName] ?? "black";
|
|
144656
|
-
for (let i = 0;i <
|
|
144657
|
-
const p12 =
|
|
144658
|
-
const p2 =
|
|
144473
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144474
|
+
const p12 = path33[i];
|
|
144475
|
+
const p2 = path33[i + 1];
|
|
144659
144476
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
144660
144477
|
graphics.circles.push({
|
|
144661
144478
|
center: { x: p12.x, y: p12.y },
|
|
@@ -145253,10 +145070,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
145253
145070
|
const allSegments = [];
|
|
145254
145071
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
145255
145072
|
for (const polyLine of polyLines) {
|
|
145256
|
-
const
|
|
145257
|
-
for (let i = 0;i <
|
|
145258
|
-
const p12 =
|
|
145259
|
-
const p2 =
|
|
145073
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
145074
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
145075
|
+
const p12 = path33[i];
|
|
145076
|
+
const p2 = path33[i + 1];
|
|
145260
145077
|
const layer = p12.z2;
|
|
145261
145078
|
allSegments.push({
|
|
145262
145079
|
start: { x: p12.x, y: p12.y },
|
|
@@ -145274,7 +145091,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
145274
145091
|
}
|
|
145275
145092
|
}
|
|
145276
145093
|
}
|
|
145277
|
-
const lastPoint =
|
|
145094
|
+
const lastPoint = path33[path33.length - 1];
|
|
145278
145095
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
145279
145096
|
const key = pointKey2(lastPoint);
|
|
145280
145097
|
if (!viaPoints.has(key)) {
|
|
@@ -145573,14 +145390,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
145573
145390
|
const polyLineVias = [];
|
|
145574
145391
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145575
145392
|
const polyLine = polyLines[i];
|
|
145576
|
-
const
|
|
145393
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
145577
145394
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
145578
|
-
for (let i22 = 0;i22 <
|
|
145579
|
-
const segment2 = [
|
|
145395
|
+
for (let i22 = 0;i22 < path33.length - 1; i22++) {
|
|
145396
|
+
const segment2 = [path33[i22], path33[i22 + 1]];
|
|
145580
145397
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
145581
145398
|
}
|
|
145582
145399
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
145583
|
-
polyLineVias.push(
|
|
145400
|
+
polyLineVias.push(path33.filter((p) => p.z1 !== p.z2));
|
|
145584
145401
|
}
|
|
145585
145402
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145586
145403
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -147009,7 +146826,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
147009
146826
|
if (this.failedSolvers.length > 0) {
|
|
147010
146827
|
this.solved = false;
|
|
147011
146828
|
this.failed = true;
|
|
147012
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
146829
|
+
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs32) => fs32.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
|
|
147013
146830
|
return;
|
|
147014
146831
|
}
|
|
147015
146832
|
this.solved = true;
|
|
@@ -149790,13 +149607,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149790
149607
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
149791
149608
|
}
|
|
149792
149609
|
getBacktrackedPath(candidate) {
|
|
149793
|
-
const
|
|
149610
|
+
const path33 = [];
|
|
149794
149611
|
let currentCandidate = candidate;
|
|
149795
149612
|
while (currentCandidate) {
|
|
149796
|
-
|
|
149613
|
+
path33.push(currentCandidate.node);
|
|
149797
149614
|
currentCandidate = currentCandidate.prevCandidate;
|
|
149798
149615
|
}
|
|
149799
|
-
return
|
|
149616
|
+
return path33;
|
|
149800
149617
|
}
|
|
149801
149618
|
getNeighboringNodes(node) {
|
|
149802
149619
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -149804,12 +149621,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149804
149621
|
getCapacityPaths() {
|
|
149805
149622
|
const capacityPaths = [];
|
|
149806
149623
|
for (const connection of this.connectionsWithNodes) {
|
|
149807
|
-
const
|
|
149808
|
-
if (
|
|
149624
|
+
const path33 = connection.path;
|
|
149625
|
+
if (path33) {
|
|
149809
149626
|
capacityPaths.push({
|
|
149810
149627
|
capacityPathId: connection.connection.name,
|
|
149811
149628
|
connectionName: connection.connection.name,
|
|
149812
|
-
nodeIds:
|
|
149629
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
149813
149630
|
});
|
|
149814
149631
|
}
|
|
149815
149632
|
}
|
|
@@ -150494,10 +150311,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150494
150311
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
150495
150312
|
}
|
|
150496
150313
|
getBacktrackedPath(candidate) {
|
|
150497
|
-
const
|
|
150314
|
+
const path33 = [];
|
|
150498
150315
|
let currentCandidate = candidate;
|
|
150499
150316
|
while (currentCandidate) {
|
|
150500
|
-
|
|
150317
|
+
path33.push(currentCandidate.node);
|
|
150501
150318
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
150502
150319
|
currentCandidate = currentCandidate.prevCandidate;
|
|
150503
150320
|
} else {
|
|
@@ -150505,7 +150322,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150505
150322
|
break;
|
|
150506
150323
|
}
|
|
150507
150324
|
}
|
|
150508
|
-
return
|
|
150325
|
+
return path33.reverse();
|
|
150509
150326
|
}
|
|
150510
150327
|
getNeighboringNodes(node) {
|
|
150511
150328
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -150520,8 +150337,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150520
150337
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
150521
150338
|
return true;
|
|
150522
150339
|
}
|
|
150523
|
-
reduceCapacityAlongPath(
|
|
150524
|
-
for (const pathNode of
|
|
150340
|
+
reduceCapacityAlongPath(path33) {
|
|
150341
|
+
for (const pathNode of path33) {
|
|
150525
150342
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
150526
150343
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
150527
150344
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -150650,9 +150467,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150650
150467
|
this.queuedNodes = null;
|
|
150651
150468
|
}
|
|
150652
150469
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
150653
|
-
const
|
|
150654
|
-
currentTerminal.path =
|
|
150655
|
-
this.reduceCapacityAlongPath(
|
|
150470
|
+
const path33 = this.getBacktrackedPath(currentCandidate);
|
|
150471
|
+
currentTerminal.path = path33;
|
|
150472
|
+
this.reduceCapacityAlongPath(path33);
|
|
150656
150473
|
this.currentConnectionIndex++;
|
|
150657
150474
|
this.candidates = null;
|
|
150658
150475
|
this.visitedNodes = null;
|
|
@@ -150701,10 +150518,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150701
150518
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
150702
150519
|
topCandidates.forEach((candidate, index) => {
|
|
150703
150520
|
const opacity = 0.8 * (1 - index / 5);
|
|
150704
|
-
const
|
|
150705
|
-
if (
|
|
150521
|
+
const path33 = this.getBacktrackedPath(candidate);
|
|
150522
|
+
if (path33.length > 0) {
|
|
150706
150523
|
baseGraphics.lines.push({
|
|
150707
|
-
points:
|
|
150524
|
+
points: path33.map(({ center: { x, y } }) => ({ x, y })),
|
|
150708
150525
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
150709
150526
|
strokeWidth: 0.05
|
|
150710
150527
|
});
|
|
@@ -151393,12 +151210,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
151393
151210
|
getCapacityPaths() {
|
|
151394
151211
|
const capacityPaths = [];
|
|
151395
151212
|
for (const connection of this.connectionsWithNodes) {
|
|
151396
|
-
const
|
|
151397
|
-
if (
|
|
151213
|
+
const path33 = connection.path;
|
|
151214
|
+
if (path33) {
|
|
151398
151215
|
capacityPaths.push({
|
|
151399
151216
|
capacityPathId: connection.connection.name,
|
|
151400
151217
|
connectionName: connection.connection.name,
|
|
151401
|
-
nodeIds:
|
|
151218
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
151402
151219
|
});
|
|
151403
151220
|
}
|
|
151404
151221
|
}
|
|
@@ -152419,22 +152236,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
152419
152236
|
return null;
|
|
152420
152237
|
}
|
|
152421
152238
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
152422
|
-
for (const
|
|
152423
|
-
const fullPath =
|
|
152239
|
+
for (const path33 of possiblePaths) {
|
|
152240
|
+
const fullPath = path33.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
152424
152241
|
if (this.isValidPath(fullPath)) {
|
|
152425
152242
|
return fullPath;
|
|
152426
152243
|
}
|
|
152427
152244
|
}
|
|
152428
152245
|
return null;
|
|
152429
152246
|
}
|
|
152430
|
-
addPathToResult(
|
|
152431
|
-
if (
|
|
152247
|
+
addPathToResult(path33) {
|
|
152248
|
+
if (path33.length === 0)
|
|
152432
152249
|
return;
|
|
152433
|
-
for (let i = 0;i <
|
|
152434
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
152250
|
+
for (let i = 0;i < path33.length; i++) {
|
|
152251
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path33[i])) {
|
|
152435
152252
|
continue;
|
|
152436
152253
|
}
|
|
152437
|
-
this.newRoute.push(
|
|
152254
|
+
this.newRoute.push(path33[i]);
|
|
152438
152255
|
}
|
|
152439
152256
|
this.currentStepSize = this.maxStepSize;
|
|
152440
152257
|
}
|
|
@@ -175367,7 +175184,7 @@ __export3(components_exports, {
|
|
|
175367
175184
|
Diode: () => Diode,
|
|
175368
175185
|
FabricationNotePath: () => FabricationNotePath,
|
|
175369
175186
|
FabricationNoteText: () => FabricationNoteText,
|
|
175370
|
-
Footprint: () =>
|
|
175187
|
+
Footprint: () => Footprint2,
|
|
175371
175188
|
Fuse: () => Fuse2,
|
|
175372
175189
|
Group: () => Group,
|
|
175373
175190
|
Hole: () => Hole,
|
|
@@ -178482,7 +178299,7 @@ var getAllDimensionsForSchematicBox = (params2) => {
|
|
|
178482
178299
|
};
|
|
178483
178300
|
};
|
|
178484
178301
|
var debug222 = (0, import_debug92.default)("tscircuit:core:footprint");
|
|
178485
|
-
var
|
|
178302
|
+
var Footprint2 = class extends PrimitiveComponent2 {
|
|
178486
178303
|
get config() {
|
|
178487
178304
|
return {
|
|
178488
178305
|
componentName: "Footprint",
|
|
@@ -179841,7 +179658,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179841
179658
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
179842
179659
|
const start = portsWithPosition[i];
|
|
179843
179660
|
const end = portsWithPosition[i + 1];
|
|
179844
|
-
const
|
|
179661
|
+
const path33 = calculateElbow({
|
|
179845
179662
|
x: start.position.x,
|
|
179846
179663
|
y: start.position.y,
|
|
179847
179664
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -179850,8 +179667,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179850
179667
|
y: end.position.y,
|
|
179851
179668
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
179852
179669
|
});
|
|
179853
|
-
for (let j4 = 0;j4 <
|
|
179854
|
-
elbowEdges.push({ from:
|
|
179670
|
+
for (let j4 = 0;j4 < path33.length - 1; j4++) {
|
|
179671
|
+
elbowEdges.push({ from: path33[j4], to: path33[j4 + 1] });
|
|
179855
179672
|
}
|
|
179856
179673
|
}
|
|
179857
179674
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -186039,8 +185856,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
186039
185856
|
*/
|
|
186040
185857
|
|
|
186041
185858
|
// lib/import/import-component-from-jlcpcb.ts
|
|
186042
|
-
import
|
|
186043
|
-
import
|
|
185859
|
+
import fs32 from "node:fs/promises";
|
|
185860
|
+
import path33 from "node:path";
|
|
186044
185861
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
186045
185862
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
186046
185863
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -186048,10 +185865,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
186048
185865
|
if (!fileName) {
|
|
186049
185866
|
throw new Error("Could not determine file name of converted component");
|
|
186050
185867
|
}
|
|
186051
|
-
const importsDir =
|
|
186052
|
-
await
|
|
186053
|
-
const filePath =
|
|
186054
|
-
await
|
|
185868
|
+
const importsDir = path33.join(projectDir, "imports");
|
|
185869
|
+
await fs32.mkdir(importsDir, { recursive: true });
|
|
185870
|
+
const filePath = path33.join(importsDir, `${fileName}.tsx`);
|
|
185871
|
+
await fs32.writeFile(filePath, tsx);
|
|
186055
185872
|
return { filePath };
|
|
186056
185873
|
};
|
|
186057
185874
|
|
|
@@ -187416,12 +187233,12 @@ var registerRemove = (program3) => {
|
|
|
187416
187233
|
};
|
|
187417
187234
|
|
|
187418
187235
|
// cli/build/register.ts
|
|
187419
|
-
import
|
|
187420
|
-
import
|
|
187236
|
+
import path42 from "node:path";
|
|
187237
|
+
import fs41 from "node:fs";
|
|
187421
187238
|
|
|
187422
187239
|
// cli/build/build-file.ts
|
|
187423
|
-
import
|
|
187424
|
-
import
|
|
187240
|
+
import path34 from "node:path";
|
|
187241
|
+
import fs33 from "node:fs";
|
|
187425
187242
|
|
|
187426
187243
|
// lib/shared/circuit-json-diagnostics.ts
|
|
187427
187244
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -187483,9 +187300,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
187483
187300
|
filePath: input,
|
|
187484
187301
|
platformConfig: completePlatformConfig
|
|
187485
187302
|
});
|
|
187486
|
-
|
|
187487
|
-
|
|
187488
|
-
console.log(`Circuit JSON written to ${
|
|
187303
|
+
fs33.mkdirSync(path34.dirname(output), { recursive: true });
|
|
187304
|
+
fs33.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
187305
|
+
console.log(`Circuit JSON written to ${path34.relative(projectDir, output)}`);
|
|
187489
187306
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
187490
187307
|
if (!options?.ignoreWarnings) {
|
|
187491
187308
|
for (const warn of warnings) {
|
|
@@ -187524,7 +187341,7 @@ var logTsxExtensionHint = (error, entryFilePath) => {
|
|
|
187524
187341
|
const isAggregateError = error instanceof AggregateError || String(error).includes("AggregateError");
|
|
187525
187342
|
if (!isTsEntry || !isAggregateError)
|
|
187526
187343
|
return;
|
|
187527
|
-
const entryFileName =
|
|
187344
|
+
const entryFileName = path34.basename(entryFilePath);
|
|
187528
187345
|
console.error([
|
|
187529
187346
|
"",
|
|
187530
187347
|
`It looks like "${entryFileName}" is a ".ts" file. tscircuit component files must use the ".tsx" extension.`,
|
|
@@ -187539,7 +187356,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187539
187356
|
if (!match)
|
|
187540
187357
|
return;
|
|
187541
187358
|
const [, exportName, fromSpecifier] = match;
|
|
187542
|
-
const entryFileName =
|
|
187359
|
+
const entryFileName = path34.basename(entryFilePath);
|
|
187543
187360
|
console.error([
|
|
187544
187361
|
"",
|
|
187545
187362
|
`It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
|
|
@@ -187552,20 +187369,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187552
187369
|
};
|
|
187553
187370
|
|
|
187554
187371
|
// cli/build/get-build-entrypoints.ts
|
|
187555
|
-
import
|
|
187556
|
-
import
|
|
187372
|
+
import fs34 from "node:fs";
|
|
187373
|
+
import path35 from "node:path";
|
|
187557
187374
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
187558
|
-
const relative10 =
|
|
187559
|
-
return relative10 === "" || !relative10.startsWith("..") && !
|
|
187375
|
+
const relative10 = path35.relative(maybeParent, maybeChild);
|
|
187376
|
+
return relative10 === "" || !relative10.startsWith("..") && !path35.isAbsolute(relative10);
|
|
187560
187377
|
};
|
|
187561
187378
|
var findProjectRoot = (startDir) => {
|
|
187562
187379
|
let currentDir = startDir;
|
|
187563
|
-
while (currentDir !==
|
|
187564
|
-
const packageJsonPath =
|
|
187565
|
-
if (
|
|
187380
|
+
while (currentDir !== path35.dirname(currentDir)) {
|
|
187381
|
+
const packageJsonPath = path35.join(currentDir, "package.json");
|
|
187382
|
+
if (fs34.existsSync(packageJsonPath)) {
|
|
187566
187383
|
return currentDir;
|
|
187567
187384
|
}
|
|
187568
|
-
currentDir =
|
|
187385
|
+
currentDir = path35.dirname(currentDir);
|
|
187569
187386
|
}
|
|
187570
187387
|
return startDir;
|
|
187571
187388
|
};
|
|
@@ -187574,11 +187391,11 @@ async function getBuildEntrypoints({
|
|
|
187574
187391
|
rootDir = process.cwd(),
|
|
187575
187392
|
includeBoardFiles = true
|
|
187576
187393
|
}) {
|
|
187577
|
-
const resolvedRoot =
|
|
187394
|
+
const resolvedRoot = path35.resolve(rootDir);
|
|
187578
187395
|
const includeBoardFilePatterns = includeBoardFiles ? getBoardFilePatterns(resolvedRoot) : [];
|
|
187579
187396
|
const buildFromProjectDir = async () => {
|
|
187580
187397
|
const projectConfig = loadProjectConfig(resolvedRoot);
|
|
187581
|
-
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ?
|
|
187398
|
+
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig.previewComponentPath) : undefined;
|
|
187582
187399
|
if (includeBoardFiles) {
|
|
187583
187400
|
const files = findBoardFiles({ projectDir: resolvedRoot });
|
|
187584
187401
|
if (files.length > 0) {
|
|
@@ -187613,10 +187430,10 @@ async function getBuildEntrypoints({
|
|
|
187613
187430
|
};
|
|
187614
187431
|
};
|
|
187615
187432
|
if (fileOrDir) {
|
|
187616
|
-
const resolved =
|
|
187617
|
-
if (
|
|
187433
|
+
const resolved = path35.resolve(resolvedRoot, fileOrDir);
|
|
187434
|
+
if (fs34.existsSync(resolved) && fs34.statSync(resolved).isDirectory()) {
|
|
187618
187435
|
const projectConfig2 = loadProjectConfig(resolvedRoot);
|
|
187619
|
-
const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ?
|
|
187436
|
+
const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig2.previewComponentPath) : undefined;
|
|
187620
187437
|
if (includeBoardFiles) {
|
|
187621
187438
|
const circuitFiles = findBoardFiles({
|
|
187622
187439
|
projectDir: resolvedRoot,
|
|
@@ -187648,10 +187465,10 @@ async function getBuildEntrypoints({
|
|
|
187648
187465
|
circuitFiles: mainEntrypoint ? [mainEntrypoint] : []
|
|
187649
187466
|
};
|
|
187650
187467
|
}
|
|
187651
|
-
const fileDir =
|
|
187468
|
+
const fileDir = path35.dirname(resolved);
|
|
187652
187469
|
const projectDir = findProjectRoot(fileDir);
|
|
187653
187470
|
const projectConfig = loadProjectConfig(projectDir);
|
|
187654
|
-
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ?
|
|
187471
|
+
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(projectDir, projectConfig.previewComponentPath) : undefined;
|
|
187655
187472
|
return {
|
|
187656
187473
|
projectDir,
|
|
187657
187474
|
previewComponentPath: resolvedPreviewComponentPath,
|
|
@@ -187693,8 +187510,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
187693
187510
|
};
|
|
187694
187511
|
|
|
187695
187512
|
// cli/build/build-preview-images.ts
|
|
187696
|
-
import
|
|
187697
|
-
import
|
|
187513
|
+
import fs35 from "node:fs";
|
|
187514
|
+
import path36 from "node:path";
|
|
187698
187515
|
import {
|
|
187699
187516
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
187700
187517
|
convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
|
|
@@ -187770,21 +187587,21 @@ var generatePreviewAssets = async ({
|
|
|
187770
187587
|
outputDir,
|
|
187771
187588
|
distDir
|
|
187772
187589
|
}) => {
|
|
187773
|
-
const prefixRelative =
|
|
187590
|
+
const prefixRelative = path36.relative(distDir, outputDir) || ".";
|
|
187774
187591
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
187775
187592
|
let circuitJson;
|
|
187776
187593
|
try {
|
|
187777
|
-
const circuitJsonRaw =
|
|
187594
|
+
const circuitJsonRaw = fs35.readFileSync(build.outputPath, "utf-8");
|
|
187778
187595
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
187779
187596
|
} catch (error) {
|
|
187780
187597
|
console.error(`${prefix}Failed to read circuit JSON:`, error);
|
|
187781
187598
|
return;
|
|
187782
187599
|
}
|
|
187783
|
-
|
|
187600
|
+
fs35.mkdirSync(outputDir, { recursive: true });
|
|
187784
187601
|
try {
|
|
187785
187602
|
console.log(`${prefix}Generating PCB SVG...`);
|
|
187786
187603
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
187787
|
-
|
|
187604
|
+
fs35.writeFileSync(path36.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
187788
187605
|
console.log(`${prefix}Written pcb.svg`);
|
|
187789
187606
|
} catch (error) {
|
|
187790
187607
|
console.error(`${prefix}Failed to generate PCB SVG:`, error);
|
|
@@ -187792,7 +187609,7 @@ var generatePreviewAssets = async ({
|
|
|
187792
187609
|
try {
|
|
187793
187610
|
console.log(`${prefix}Generating schematic SVG...`);
|
|
187794
187611
|
const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
|
|
187795
|
-
|
|
187612
|
+
fs35.writeFileSync(path36.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
187796
187613
|
console.log(`${prefix}Written schematic.svg`);
|
|
187797
187614
|
} catch (error) {
|
|
187798
187615
|
console.error(`${prefix}Failed to generate schematic SVG:`, error);
|
|
@@ -187809,7 +187626,7 @@ var generatePreviewAssets = async ({
|
|
|
187809
187626
|
camPos: [10, 10, 10],
|
|
187810
187627
|
lookAt: [0, 0, 0]
|
|
187811
187628
|
});
|
|
187812
|
-
|
|
187629
|
+
fs35.writeFileSync(path36.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
187813
187630
|
console.log(`${prefix}Written 3d.png`);
|
|
187814
187631
|
} catch (error) {
|
|
187815
187632
|
console.error(`${prefix}Failed to generate 3D PNG:`, error);
|
|
@@ -187824,14 +187641,14 @@ var buildPreviewImages = async ({
|
|
|
187824
187641
|
}) => {
|
|
187825
187642
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
187826
187643
|
const previewEntrypoint = previewComponentPath || mainEntrypoint;
|
|
187827
|
-
const resolvedPreviewEntrypoint = previewEntrypoint ?
|
|
187644
|
+
const resolvedPreviewEntrypoint = previewEntrypoint ? path36.resolve(previewEntrypoint) : undefined;
|
|
187828
187645
|
if (allImages) {
|
|
187829
187646
|
if (successfulBuilds.length === 0) {
|
|
187830
187647
|
console.warn("No successful build output available for preview image generation.");
|
|
187831
187648
|
return;
|
|
187832
187649
|
}
|
|
187833
187650
|
for (const build of successfulBuilds) {
|
|
187834
|
-
const outputDir =
|
|
187651
|
+
const outputDir = path36.dirname(build.outputPath);
|
|
187835
187652
|
await generatePreviewAssets({
|
|
187836
187653
|
build,
|
|
187837
187654
|
outputDir,
|
|
@@ -187842,7 +187659,7 @@ var buildPreviewImages = async ({
|
|
|
187842
187659
|
}
|
|
187843
187660
|
const previewBuild = (() => {
|
|
187844
187661
|
if (resolvedPreviewEntrypoint) {
|
|
187845
|
-
const match = successfulBuilds.find((built) =>
|
|
187662
|
+
const match = successfulBuilds.find((built) => path36.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
|
|
187846
187663
|
if (match)
|
|
187847
187664
|
return match;
|
|
187848
187665
|
}
|
|
@@ -187860,8 +187677,8 @@ var buildPreviewImages = async ({
|
|
|
187860
187677
|
};
|
|
187861
187678
|
|
|
187862
187679
|
// cli/build/build-preview-gltf.ts
|
|
187863
|
-
import
|
|
187864
|
-
import
|
|
187680
|
+
import fs36 from "node:fs";
|
|
187681
|
+
import path37 from "node:path";
|
|
187865
187682
|
import { convertCircuitJsonToGltf as convertCircuitJsonToGltf3 } from "circuit-json-to-gltf";
|
|
187866
187683
|
var buildPreviewGltf = async ({
|
|
187867
187684
|
builtFiles,
|
|
@@ -187871,10 +187688,10 @@ var buildPreviewGltf = async ({
|
|
|
187871
187688
|
}) => {
|
|
187872
187689
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
187873
187690
|
const previewEntrypoint = previewComponentPath || mainEntrypoint;
|
|
187874
|
-
const resolvedPreviewEntrypoint = previewEntrypoint ?
|
|
187691
|
+
const resolvedPreviewEntrypoint = previewEntrypoint ? path37.resolve(previewEntrypoint) : undefined;
|
|
187875
187692
|
const previewBuild = (() => {
|
|
187876
187693
|
if (resolvedPreviewEntrypoint) {
|
|
187877
|
-
const match = successfulBuilds.find((built) =>
|
|
187694
|
+
const match = successfulBuilds.find((built) => path37.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
|
|
187878
187695
|
if (match)
|
|
187879
187696
|
return match;
|
|
187880
187697
|
}
|
|
@@ -187886,16 +187703,16 @@ var buildPreviewGltf = async ({
|
|
|
187886
187703
|
}
|
|
187887
187704
|
let circuitJson;
|
|
187888
187705
|
try {
|
|
187889
|
-
const circuitJsonRaw =
|
|
187706
|
+
const circuitJsonRaw = fs36.readFileSync(previewBuild.outputPath, "utf-8");
|
|
187890
187707
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
187891
187708
|
} catch (error) {
|
|
187892
187709
|
console.error("Failed to read circuit JSON:", error);
|
|
187893
187710
|
return;
|
|
187894
187711
|
}
|
|
187895
187712
|
const sourcePath = previewBuild.sourcePath;
|
|
187896
|
-
const sourceBasename =
|
|
187713
|
+
const sourceBasename = path37.basename(sourcePath);
|
|
187897
187714
|
const gltfFilename = sourceBasename.replace(/(\.(board|circuit))?\.tsx?$/, ".gltf");
|
|
187898
|
-
const outputPath =
|
|
187715
|
+
const outputPath = path37.join(distDir, gltfFilename);
|
|
187899
187716
|
try {
|
|
187900
187717
|
console.log("Converting circuit to GLTF...");
|
|
187901
187718
|
const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
|
|
@@ -187903,7 +187720,7 @@ var buildPreviewGltf = async ({
|
|
|
187903
187720
|
format: "gltf"
|
|
187904
187721
|
});
|
|
187905
187722
|
const gltfContent = JSON.stringify(gltfData, null, 2);
|
|
187906
|
-
|
|
187723
|
+
fs36.writeFileSync(outputPath, gltfContent, "utf-8");
|
|
187907
187724
|
console.log(`Written ${gltfFilename}`);
|
|
187908
187725
|
} catch (error) {
|
|
187909
187726
|
console.error("Failed to generate GLTF:", error);
|
|
@@ -187911,8 +187728,8 @@ var buildPreviewGltf = async ({
|
|
|
187911
187728
|
};
|
|
187912
187729
|
|
|
187913
187730
|
// cli/build/generate-kicad-project.ts
|
|
187914
|
-
import
|
|
187915
|
-
import
|
|
187731
|
+
import fs37 from "node:fs";
|
|
187732
|
+
import path38 from "node:path";
|
|
187916
187733
|
var createKicadProContent = ({
|
|
187917
187734
|
projectName,
|
|
187918
187735
|
schematicFileName,
|
|
@@ -187952,10 +187769,10 @@ var generateKicadProject = async ({
|
|
|
187952
187769
|
boardFileName
|
|
187953
187770
|
});
|
|
187954
187771
|
if (writeFiles) {
|
|
187955
|
-
|
|
187956
|
-
|
|
187957
|
-
|
|
187958
|
-
|
|
187772
|
+
fs37.mkdirSync(outputDir, { recursive: true });
|
|
187773
|
+
fs37.writeFileSync(path38.join(outputDir, schematicFileName), schContent);
|
|
187774
|
+
fs37.writeFileSync(path38.join(outputDir, boardFileName), pcbContent);
|
|
187775
|
+
fs37.writeFileSync(path38.join(outputDir, projectFileName), proContent);
|
|
187959
187776
|
}
|
|
187960
187777
|
return {
|
|
187961
187778
|
pcbContent,
|
|
@@ -187967,8 +187784,8 @@ var generateKicadProject = async ({
|
|
|
187967
187784
|
};
|
|
187968
187785
|
|
|
187969
187786
|
// cli/build/transpile/index.ts
|
|
187970
|
-
import
|
|
187971
|
-
import
|
|
187787
|
+
import path40 from "node:path";
|
|
187788
|
+
import fs39 from "node:fs";
|
|
187972
187789
|
import { rollup } from "rollup";
|
|
187973
187790
|
import typescript from "@rollup/plugin-typescript";
|
|
187974
187791
|
import resolve11 from "@rollup/plugin-node-resolve";
|
|
@@ -187977,11 +187794,11 @@ import json from "@rollup/plugin-json";
|
|
|
187977
187794
|
import dts from "rollup-plugin-dts";
|
|
187978
187795
|
|
|
187979
187796
|
// cli/build/transpile/static-asset-plugin.ts
|
|
187980
|
-
import
|
|
187981
|
-
import
|
|
187797
|
+
import fs38 from "node:fs";
|
|
187798
|
+
import path39 from "node:path";
|
|
187982
187799
|
import { createHash } from "node:crypto";
|
|
187983
187800
|
function normalizePathSeparators(filePath) {
|
|
187984
|
-
return filePath.split(
|
|
187801
|
+
return filePath.split(path39.sep).join("/");
|
|
187985
187802
|
}
|
|
187986
187803
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
187987
187804
|
".glb",
|
|
@@ -188012,24 +187829,24 @@ var createStaticAssetPlugin = ({
|
|
|
188012
187829
|
return {
|
|
188013
187830
|
name: "tsci-static-assets",
|
|
188014
187831
|
resolveId(source, importer) {
|
|
188015
|
-
const ext =
|
|
187832
|
+
const ext = path39.extname(source).toLowerCase();
|
|
188016
187833
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
188017
187834
|
return null;
|
|
188018
|
-
if (
|
|
188019
|
-
return
|
|
187835
|
+
if (path39.isAbsolute(source)) {
|
|
187836
|
+
return fs38.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
188020
187837
|
}
|
|
188021
187838
|
if (importer) {
|
|
188022
|
-
const importerNative = importer.split("/").join(
|
|
188023
|
-
const resolvedFromImporter =
|
|
188024
|
-
if (
|
|
187839
|
+
const importerNative = importer.split("/").join(path39.sep);
|
|
187840
|
+
const resolvedFromImporter = path39.resolve(path39.dirname(importerNative), source);
|
|
187841
|
+
if (fs38.existsSync(resolvedFromImporter)) {
|
|
188025
187842
|
return {
|
|
188026
187843
|
id: normalizePathSeparators(resolvedFromImporter),
|
|
188027
187844
|
external: true
|
|
188028
187845
|
};
|
|
188029
187846
|
}
|
|
188030
187847
|
}
|
|
188031
|
-
const resolvedFromProject =
|
|
188032
|
-
if (
|
|
187848
|
+
const resolvedFromProject = path39.resolve(resolvedBaseUrl, source);
|
|
187849
|
+
if (fs38.existsSync(resolvedFromProject)) {
|
|
188033
187850
|
return {
|
|
188034
187851
|
id: normalizePathSeparators(resolvedFromProject),
|
|
188035
187852
|
external: true
|
|
@@ -188042,8 +187859,8 @@ var createStaticAssetPlugin = ({
|
|
|
188042
187859
|
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
188043
187860
|
for (const target of targets) {
|
|
188044
187861
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
188045
|
-
const resolvedTarget =
|
|
188046
|
-
if (
|
|
187862
|
+
const resolvedTarget = path39.resolve(resolvedBaseUrl, targetPath);
|
|
187863
|
+
if (fs38.existsSync(resolvedTarget)) {
|
|
188047
187864
|
return {
|
|
188048
187865
|
id: normalizePathSeparators(resolvedTarget),
|
|
188049
187866
|
external: true
|
|
@@ -188069,18 +187886,18 @@ var createStaticAssetPlugin = ({
|
|
|
188069
187886
|
if (chunk.type !== "chunk")
|
|
188070
187887
|
continue;
|
|
188071
187888
|
for (const importedId of chunk.imports) {
|
|
188072
|
-
const ext =
|
|
187889
|
+
const ext = path39.extname(importedId).toLowerCase();
|
|
188073
187890
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
188074
187891
|
continue;
|
|
188075
187892
|
if (!copiedAssets.has(importedId)) {
|
|
188076
|
-
const assetDir =
|
|
188077
|
-
|
|
188078
|
-
const nativePath = importedId.split("/").join(
|
|
188079
|
-
const fileBuffer =
|
|
187893
|
+
const assetDir = path39.join(outputDir, "assets");
|
|
187894
|
+
fs38.mkdirSync(assetDir, { recursive: true });
|
|
187895
|
+
const nativePath = importedId.split("/").join(path39.sep);
|
|
187896
|
+
const fileBuffer = fs38.readFileSync(nativePath);
|
|
188080
187897
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
188081
|
-
const fileName = `${
|
|
188082
|
-
const outputFilePath =
|
|
188083
|
-
|
|
187898
|
+
const fileName = `${path39.basename(importedId, ext)}-${hash}${ext}`;
|
|
187899
|
+
const outputFilePath = path39.join(assetDir, fileName);
|
|
187900
|
+
fs38.writeFileSync(outputFilePath, fileBuffer);
|
|
188084
187901
|
copiedAssets.set(importedId, `./assets/${fileName}`);
|
|
188085
187902
|
assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
|
|
188086
187903
|
}
|
|
@@ -188102,17 +187919,17 @@ function escapeRegExp(string) {
|
|
|
188102
187919
|
|
|
188103
187920
|
// cli/build/transpile/index.ts
|
|
188104
187921
|
var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
188105
|
-
if (id2.startsWith(".") || id2.startsWith("/") ||
|
|
187922
|
+
if (id2.startsWith(".") || id2.startsWith("/") || path40.isAbsolute(id2)) {
|
|
188106
187923
|
return false;
|
|
188107
187924
|
}
|
|
188108
187925
|
let baseUrl = projectDir;
|
|
188109
187926
|
let pathMappings = {};
|
|
188110
|
-
if (tsconfigPath &&
|
|
187927
|
+
if (tsconfigPath && fs39.existsSync(tsconfigPath)) {
|
|
188111
187928
|
try {
|
|
188112
|
-
const tsconfigContent =
|
|
187929
|
+
const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
|
|
188113
187930
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
188114
187931
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
188115
|
-
baseUrl =
|
|
187932
|
+
baseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
188116
187933
|
}
|
|
188117
187934
|
if (tsconfig.compilerOptions?.paths) {
|
|
188118
187935
|
pathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -188126,17 +187943,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
188126
187943
|
}
|
|
188127
187944
|
}
|
|
188128
187945
|
const potentialPaths = [
|
|
188129
|
-
|
|
188130
|
-
|
|
188131
|
-
|
|
188132
|
-
|
|
188133
|
-
|
|
188134
|
-
|
|
188135
|
-
|
|
188136
|
-
|
|
188137
|
-
|
|
187946
|
+
path40.join(baseUrl, id2),
|
|
187947
|
+
path40.join(baseUrl, `${id2}.ts`),
|
|
187948
|
+
path40.join(baseUrl, `${id2}.tsx`),
|
|
187949
|
+
path40.join(baseUrl, `${id2}.js`),
|
|
187950
|
+
path40.join(baseUrl, `${id2}.jsx`),
|
|
187951
|
+
path40.join(baseUrl, id2, "index.ts"),
|
|
187952
|
+
path40.join(baseUrl, id2, "index.tsx"),
|
|
187953
|
+
path40.join(baseUrl, id2, "index.js"),
|
|
187954
|
+
path40.join(baseUrl, id2, "index.jsx")
|
|
188138
187955
|
];
|
|
188139
|
-
if (potentialPaths.some((p) =>
|
|
187956
|
+
if (potentialPaths.some((p) => fs39.existsSync(p))) {
|
|
188140
187957
|
return false;
|
|
188141
187958
|
}
|
|
188142
187959
|
return true;
|
|
@@ -188147,17 +187964,17 @@ var transpileFile = async ({
|
|
|
188147
187964
|
projectDir
|
|
188148
187965
|
}) => {
|
|
188149
187966
|
try {
|
|
188150
|
-
|
|
188151
|
-
const tsconfigPath =
|
|
188152
|
-
const hasTsConfig =
|
|
187967
|
+
fs39.mkdirSync(outputDir, { recursive: true });
|
|
187968
|
+
const tsconfigPath = path40.join(projectDir, "tsconfig.json");
|
|
187969
|
+
const hasTsConfig = fs39.existsSync(tsconfigPath);
|
|
188153
187970
|
let tsconfigBaseUrl = projectDir;
|
|
188154
187971
|
let tsconfigPathMappings;
|
|
188155
187972
|
if (hasTsConfig) {
|
|
188156
187973
|
try {
|
|
188157
|
-
const tsconfigContent =
|
|
187974
|
+
const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
|
|
188158
187975
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
188159
187976
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
188160
|
-
tsconfigBaseUrl =
|
|
187977
|
+
tsconfigBaseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
188161
187978
|
}
|
|
188162
187979
|
if (tsconfig.compilerOptions?.paths) {
|
|
188163
187980
|
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -188212,27 +188029,27 @@ var transpileFile = async ({
|
|
|
188212
188029
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
188213
188030
|
plugins: getPlugins()
|
|
188214
188031
|
});
|
|
188215
|
-
const esmOutputPath =
|
|
188032
|
+
const esmOutputPath = path40.join(outputDir, "index.js");
|
|
188216
188033
|
await esmBundle.write({
|
|
188217
188034
|
file: esmOutputPath,
|
|
188218
188035
|
format: "es",
|
|
188219
188036
|
sourcemap: false
|
|
188220
188037
|
});
|
|
188221
|
-
console.log(`ESM bundle written to ${
|
|
188038
|
+
console.log(`ESM bundle written to ${path40.relative(projectDir, esmOutputPath)}`);
|
|
188222
188039
|
console.log("Building CommonJS bundle...");
|
|
188223
188040
|
const cjsBundle = await rollup({
|
|
188224
188041
|
input,
|
|
188225
188042
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
188226
188043
|
plugins: getPlugins()
|
|
188227
188044
|
});
|
|
188228
|
-
const cjsOutputPath =
|
|
188045
|
+
const cjsOutputPath = path40.join(outputDir, "index.cjs");
|
|
188229
188046
|
console.log("Writing CJS bundle to:", cjsOutputPath);
|
|
188230
188047
|
await cjsBundle.write({
|
|
188231
188048
|
file: cjsOutputPath,
|
|
188232
188049
|
format: "cjs",
|
|
188233
188050
|
sourcemap: false
|
|
188234
188051
|
});
|
|
188235
|
-
console.log(`CommonJS bundle written to ${
|
|
188052
|
+
console.log(`CommonJS bundle written to ${path40.relative(projectDir, cjsOutputPath)}`);
|
|
188236
188053
|
console.log("Generating type declarations...");
|
|
188237
188054
|
const dtsBundle = await rollup({
|
|
188238
188055
|
input,
|
|
@@ -188257,9 +188074,9 @@ var transpileFile = async ({
|
|
|
188257
188074
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
188258
188075
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
188259
188076
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
188260
|
-
const dtsOutputPath =
|
|
188261
|
-
|
|
188262
|
-
console.log(`Type declarations written to ${
|
|
188077
|
+
const dtsOutputPath = path40.join(outputDir, "index.d.ts");
|
|
188078
|
+
fs39.writeFileSync(dtsOutputPath, dtsContent);
|
|
188079
|
+
console.log(`Type declarations written to ${path40.relative(projectDir, dtsOutputPath)}`);
|
|
188263
188080
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
188264
188081
|
return true;
|
|
188265
188082
|
} catch (err) {
|
|
@@ -188272,17 +188089,17 @@ var transpileFile = async ({
|
|
|
188272
188089
|
};
|
|
188273
188090
|
|
|
188274
188091
|
// cli/utils/validate-main-in-dist.ts
|
|
188275
|
-
import
|
|
188276
|
-
import
|
|
188092
|
+
import fs40 from "node:fs";
|
|
188093
|
+
import path41 from "node:path";
|
|
188277
188094
|
var validateMainInDist = (projectDir, distDir) => {
|
|
188278
|
-
const packageJsonPath =
|
|
188279
|
-
if (!
|
|
188095
|
+
const packageJsonPath = path41.join(projectDir, "package.json");
|
|
188096
|
+
if (!fs40.existsSync(packageJsonPath))
|
|
188280
188097
|
return;
|
|
188281
|
-
const packageJson = JSON.parse(
|
|
188098
|
+
const packageJson = JSON.parse(fs40.readFileSync(packageJsonPath, "utf-8"));
|
|
188282
188099
|
if (typeof packageJson.main !== "string")
|
|
188283
188100
|
return;
|
|
188284
|
-
const resolvedMainPath =
|
|
188285
|
-
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${
|
|
188101
|
+
const resolvedMainPath = path41.resolve(projectDir, packageJson.main);
|
|
188102
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path41.sep}`);
|
|
188286
188103
|
if (!isMainInDist) {
|
|
188287
188104
|
console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
188288
188105
|
}
|
|
@@ -188305,7 +188122,7 @@ async function getLatestTscircuitCdnUrl() {
|
|
|
188305
188122
|
|
|
188306
188123
|
// cli/build/register.ts
|
|
188307
188124
|
var registerBuild = (program3) => {
|
|
188308
|
-
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad", "Generate KiCad project directories for each successful build output").option("--
|
|
188125
|
+
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad", "Generate KiCad project directories for each successful build output").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").action(async (file, options) => {
|
|
188309
188126
|
try {
|
|
188310
188127
|
const {
|
|
188311
188128
|
projectDir,
|
|
@@ -188327,8 +188144,8 @@ var registerBuild = (program3) => {
|
|
|
188327
188144
|
}
|
|
188328
188145
|
return config;
|
|
188329
188146
|
})();
|
|
188330
|
-
const distDir =
|
|
188331
|
-
|
|
188147
|
+
const distDir = path42.join(projectDir, "dist");
|
|
188148
|
+
fs41.mkdirSync(distDir, { recursive: true });
|
|
188332
188149
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
188333
188150
|
let hasErrors = false;
|
|
188334
188151
|
const staticFileReferences = [];
|
|
@@ -188336,10 +188153,10 @@ var registerBuild = (program3) => {
|
|
|
188336
188153
|
const kicadProjects = [];
|
|
188337
188154
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
188338
188155
|
for (const filePath of circuitFiles) {
|
|
188339
|
-
const relative10 =
|
|
188156
|
+
const relative10 = path42.relative(projectDir, filePath);
|
|
188340
188157
|
console.log(`Building ${relative10}...`);
|
|
188341
188158
|
const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
188342
|
-
const outputPath =
|
|
188159
|
+
const outputPath = path42.join(distDir, outputDirName, "circuit.json");
|
|
188343
188160
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
188344
188161
|
ignoreErrors: options?.ignoreErrors,
|
|
188345
188162
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -188353,17 +188170,17 @@ var registerBuild = (program3) => {
|
|
|
188353
188170
|
if (!buildOutcome.ok) {
|
|
188354
188171
|
hasErrors = true;
|
|
188355
188172
|
} else if (options?.site) {
|
|
188356
|
-
const normalizedSourcePath = relative10.split(
|
|
188357
|
-
const relativeOutputPath =
|
|
188358
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
188173
|
+
const normalizedSourcePath = relative10.split(path42.sep).join("/");
|
|
188174
|
+
const relativeOutputPath = path42.join(outputDirName, "circuit.json");
|
|
188175
|
+
const normalizedOutputPath = relativeOutputPath.split(path42.sep).join("/");
|
|
188359
188176
|
staticFileReferences.push({
|
|
188360
188177
|
filePath: normalizedSourcePath,
|
|
188361
188178
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
188362
188179
|
});
|
|
188363
188180
|
}
|
|
188364
188181
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
188365
|
-
const projectOutputDir =
|
|
188366
|
-
const projectName =
|
|
188182
|
+
const projectOutputDir = path42.join(distDir, outputDirName, "kicad");
|
|
188183
|
+
const projectName = path42.basename(outputDirName);
|
|
188367
188184
|
const project = await generateKicadProject({
|
|
188368
188185
|
circuitJson: buildOutcome.circuitJson,
|
|
188369
188186
|
outputDir: projectOutputDir,
|
|
@@ -188426,23 +188243,13 @@ var registerBuild = (program3) => {
|
|
|
188426
188243
|
if (options?.useCdnJavascript) {
|
|
188427
188244
|
standaloneScriptSrc = await getLatestTscircuitCdnUrl();
|
|
188428
188245
|
} else {
|
|
188429
|
-
|
|
188246
|
+
fs41.writeFileSync(path42.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
188430
188247
|
}
|
|
188431
188248
|
const indexHtml = getStaticIndexHtmlFile({
|
|
188432
188249
|
files: staticFileReferences,
|
|
188433
188250
|
standaloneScriptSrc
|
|
188434
188251
|
});
|
|
188435
|
-
|
|
188436
|
-
}
|
|
188437
|
-
if (options?.kicadFootprintLibrary) {
|
|
188438
|
-
if (kicadProjects.length === 0) {
|
|
188439
|
-
console.warn("No successful build output available for KiCad footprint library generation.");
|
|
188440
|
-
} else {
|
|
188441
|
-
await generateKicadFootprintLibrary({
|
|
188442
|
-
projects: kicadProjects,
|
|
188443
|
-
distDir
|
|
188444
|
-
});
|
|
188445
|
-
}
|
|
188252
|
+
fs41.writeFileSync(path42.join(distDir, "index.html"), indexHtml);
|
|
188446
188253
|
}
|
|
188447
188254
|
const successCount = builtFiles.filter((f) => f.ok).length;
|
|
188448
188255
|
const failCount = builtFiles.length - successCount;
|
|
@@ -188452,7 +188259,6 @@ var registerBuild = (program3) => {
|
|
|
188452
188259
|
options?.previewImages && "preview-images",
|
|
188453
188260
|
options?.allImages && "all-images",
|
|
188454
188261
|
options?.kicad && "kicad",
|
|
188455
|
-
options?.kicadFootprintLibrary && "kicad-footprint-library",
|
|
188456
188262
|
options?.previewGltf && "preview-gltf"
|
|
188457
188263
|
].filter(Boolean);
|
|
188458
188264
|
console.log("");
|
|
@@ -188461,7 +188267,7 @@ var registerBuild = (program3) => {
|
|
|
188461
188267
|
if (enabledOpts.length > 0) {
|
|
188462
188268
|
console.log(` Options ${kleur_default.cyan(enabledOpts.join(", "))}`);
|
|
188463
188269
|
}
|
|
188464
|
-
console.log(` Output ${kleur_default.dim(
|
|
188270
|
+
console.log(` Output ${kleur_default.dim(path42.relative(process.cwd(), distDir) || "dist")}`);
|
|
188465
188271
|
console.log(hasErrors ? kleur_default.yellow(`
|
|
188466
188272
|
⚠ Build completed with errors`) : kleur_default.green(`
|
|
188467
188273
|
✓ Done`));
|
|
@@ -188475,8 +188281,8 @@ var registerBuild = (program3) => {
|
|
|
188475
188281
|
};
|
|
188476
188282
|
|
|
188477
188283
|
// lib/shared/snapshot-project.ts
|
|
188478
|
-
import
|
|
188479
|
-
import
|
|
188284
|
+
import fs43 from "node:fs";
|
|
188285
|
+
import path43 from "node:path";
|
|
188480
188286
|
import looksSame2 from "looks-same";
|
|
188481
188287
|
import {
|
|
188482
188288
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -188487,7 +188293,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
188487
188293
|
|
|
188488
188294
|
// lib/shared/compare-images.ts
|
|
188489
188295
|
import looksSame from "looks-same";
|
|
188490
|
-
import
|
|
188296
|
+
import fs42 from "node:fs/promises";
|
|
188491
188297
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
188492
188298
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
188493
188299
|
strict: false,
|
|
@@ -188503,7 +188309,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
188503
188309
|
tolerance: 2
|
|
188504
188310
|
});
|
|
188505
188311
|
} else {
|
|
188506
|
-
await
|
|
188312
|
+
await fs42.writeFile(diffPath, buffer2);
|
|
188507
188313
|
}
|
|
188508
188314
|
}
|
|
188509
188315
|
return { equal: equal2 };
|
|
@@ -188528,7 +188334,7 @@ var snapshotProject = async ({
|
|
|
188528
188334
|
...DEFAULT_IGNORED_PATTERNS,
|
|
188529
188335
|
...ignored.map(normalizeIgnorePattern)
|
|
188530
188336
|
];
|
|
188531
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
188337
|
+
const resolvedPaths = filePaths.map((f) => path43.resolve(projectDir, f));
|
|
188532
188338
|
const boardFiles = findBoardFiles({
|
|
188533
188339
|
projectDir,
|
|
188534
188340
|
ignore,
|
|
@@ -188542,7 +188348,7 @@ var snapshotProject = async ({
|
|
|
188542
188348
|
const mismatches = [];
|
|
188543
188349
|
let didUpdate = false;
|
|
188544
188350
|
for (const file of boardFiles) {
|
|
188545
|
-
const relativeFilePath =
|
|
188351
|
+
const relativeFilePath = path43.relative(projectDir, file);
|
|
188546
188352
|
let circuitJson;
|
|
188547
188353
|
let pcbSvg;
|
|
188548
188354
|
let schSvg;
|
|
@@ -188597,17 +188403,17 @@ var snapshotProject = async ({
|
|
|
188597
188403
|
} catch (error) {
|
|
188598
188404
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
188599
188405
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
188600
|
-
const fileDir =
|
|
188601
|
-
const relativeDir =
|
|
188602
|
-
const snapDir2 = snapshotsDirName ?
|
|
188603
|
-
const base2 =
|
|
188604
|
-
const snap3dPath =
|
|
188605
|
-
const existing3dSnapshot =
|
|
188406
|
+
const fileDir = path43.dirname(file);
|
|
188407
|
+
const relativeDir = path43.relative(projectDir, fileDir);
|
|
188408
|
+
const snapDir2 = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, relativeDir) : path43.join(fileDir, "__snapshots__");
|
|
188409
|
+
const base2 = path43.basename(file).replace(/\.tsx$/, "");
|
|
188410
|
+
const snap3dPath = path43.join(snapDir2, `${base2}-3d.snap.png`);
|
|
188411
|
+
const existing3dSnapshot = fs43.existsSync(snap3dPath);
|
|
188606
188412
|
if (existing3dSnapshot) {
|
|
188607
188413
|
onError(kleur_default.red(`
|
|
188608
188414
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
188609
188415
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
188610
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
188416
|
+
`) + kleur_default.red(` Existing snapshot: ${path43.relative(projectDir, snap3dPath)}
|
|
188611
188417
|
`));
|
|
188612
188418
|
return onExit2(1);
|
|
188613
188419
|
} else {
|
|
@@ -188623,9 +188429,9 @@ var snapshotProject = async ({
|
|
|
188623
188429
|
}
|
|
188624
188430
|
}
|
|
188625
188431
|
}
|
|
188626
|
-
const snapDir = snapshotsDirName ?
|
|
188627
|
-
|
|
188628
|
-
const base =
|
|
188432
|
+
const snapDir = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, path43.relative(projectDir, path43.dirname(file))) : path43.join(path43.dirname(file), "__snapshots__");
|
|
188433
|
+
fs43.mkdirSync(snapDir, { recursive: true });
|
|
188434
|
+
const base = path43.basename(file).replace(/\.tsx$/, "");
|
|
188629
188435
|
const snapshots = [];
|
|
188630
188436
|
if (pcbOnly || !schematicOnly) {
|
|
188631
188437
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -188643,31 +188449,31 @@ var snapshotProject = async ({
|
|
|
188643
188449
|
for (const snapshot of snapshots) {
|
|
188644
188450
|
const { type } = snapshot;
|
|
188645
188451
|
const is3d = type === "3d";
|
|
188646
|
-
const snapPath =
|
|
188647
|
-
const existing =
|
|
188452
|
+
const snapPath = path43.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
188453
|
+
const existing = fs43.existsSync(snapPath);
|
|
188648
188454
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
188649
188455
|
const newContentForFile = snapshot.content;
|
|
188650
188456
|
if (!existing) {
|
|
188651
|
-
|
|
188652
|
-
console.log("✅", kleur_default.gray(
|
|
188457
|
+
fs43.writeFileSync(snapPath, newContentForFile);
|
|
188458
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188653
188459
|
didUpdate = true;
|
|
188654
188460
|
continue;
|
|
188655
188461
|
}
|
|
188656
|
-
const oldContentBuffer =
|
|
188462
|
+
const oldContentBuffer = fs43.readFileSync(snapPath);
|
|
188657
188463
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
188658
188464
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
188659
188465
|
if (update) {
|
|
188660
188466
|
if (!forceUpdate && equal2) {
|
|
188661
|
-
console.log("✅", kleur_default.gray(
|
|
188467
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188662
188468
|
} else {
|
|
188663
|
-
|
|
188664
|
-
console.log("✅", kleur_default.gray(
|
|
188469
|
+
fs43.writeFileSync(snapPath, newContentForFile);
|
|
188470
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188665
188471
|
didUpdate = true;
|
|
188666
188472
|
}
|
|
188667
188473
|
} else if (!equal2) {
|
|
188668
188474
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
188669
188475
|
} else {
|
|
188670
|
-
console.log("✅", kleur_default.gray(
|
|
188476
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188671
188477
|
}
|
|
188672
188478
|
}
|
|
188673
188479
|
}
|
|
@@ -188706,22 +188512,22 @@ var registerSnapshot = (program3) => {
|
|
|
188706
188512
|
};
|
|
188707
188513
|
|
|
188708
188514
|
// lib/shared/setup-github-actions.ts
|
|
188709
|
-
import
|
|
188710
|
-
import
|
|
188515
|
+
import fs44 from "node:fs";
|
|
188516
|
+
import path44 from "node:path";
|
|
188711
188517
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
188712
188518
|
const findGitRoot = (startDir) => {
|
|
188713
|
-
let dir =
|
|
188714
|
-
while (dir !==
|
|
188715
|
-
if (
|
|
188519
|
+
let dir = path44.resolve(startDir);
|
|
188520
|
+
while (dir !== path44.parse(dir).root) {
|
|
188521
|
+
if (fs44.existsSync(path44.join(dir, ".git"))) {
|
|
188716
188522
|
return dir;
|
|
188717
188523
|
}
|
|
188718
|
-
dir =
|
|
188524
|
+
dir = path44.dirname(dir);
|
|
188719
188525
|
}
|
|
188720
188526
|
return null;
|
|
188721
188527
|
};
|
|
188722
188528
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
188723
|
-
const workflowsDir =
|
|
188724
|
-
|
|
188529
|
+
const workflowsDir = path44.join(gitRoot, ".github", "workflows");
|
|
188530
|
+
fs44.mkdirSync(workflowsDir, { recursive: true });
|
|
188725
188531
|
const buildWorkflow = `name: tscircuit Build
|
|
188726
188532
|
|
|
188727
188533
|
on:
|
|
@@ -188760,8 +188566,8 @@ jobs:
|
|
|
188760
188566
|
- run: bun install
|
|
188761
188567
|
- run: bunx tsci snapshot
|
|
188762
188568
|
`;
|
|
188763
|
-
writeFileIfNotExists(
|
|
188764
|
-
writeFileIfNotExists(
|
|
188569
|
+
writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
188570
|
+
writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
188765
188571
|
};
|
|
188766
188572
|
|
|
188767
188573
|
// cli/setup/register.ts
|
|
@@ -188799,8 +188605,8 @@ function registerAuthSetupNpmrc(program3) {
|
|
|
188799
188605
|
}
|
|
188800
188606
|
|
|
188801
188607
|
// cli/convert/register.ts
|
|
188802
|
-
import
|
|
188803
|
-
import
|
|
188608
|
+
import fs45 from "node:fs/promises";
|
|
188609
|
+
import path45 from "node:path";
|
|
188804
188610
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
188805
188611
|
|
|
188806
188612
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -188920,15 +188726,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
188920
188726
|
var registerConvert = (program3) => {
|
|
188921
188727
|
program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
|
|
188922
188728
|
try {
|
|
188923
|
-
const inputPath =
|
|
188924
|
-
const modContent = await
|
|
188729
|
+
const inputPath = path45.resolve(file);
|
|
188730
|
+
const modContent = await fs45.readFile(inputPath, "utf-8");
|
|
188925
188731
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
188926
|
-
const componentName = options.name ??
|
|
188732
|
+
const componentName = options.name ?? path45.basename(inputPath, ".kicad_mod");
|
|
188927
188733
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
188928
188734
|
componentName
|
|
188929
188735
|
});
|
|
188930
|
-
const outputPath = options.output ?
|
|
188931
|
-
await
|
|
188736
|
+
const outputPath = options.output ? path45.resolve(options.output) : path45.join(path45.dirname(inputPath), `${componentName}.tsx`);
|
|
188737
|
+
await fs45.writeFile(outputPath, tsx);
|
|
188932
188738
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
188933
188739
|
} catch (error) {
|
|
188934
188740
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|
|
@@ -189024,12 +188830,12 @@ var registerSimulate = (program3) => {
|
|
|
189024
188830
|
};
|
|
189025
188831
|
|
|
189026
188832
|
// lib/shared/install-project-dependencies.ts
|
|
189027
|
-
import fs48 from "node:fs";
|
|
189028
|
-
import path48 from "node:path";
|
|
189029
|
-
|
|
189030
|
-
// lib/shared/collect-tsci-dependencies.ts
|
|
189031
188833
|
import fs47 from "node:fs";
|
|
189032
188834
|
import path47 from "node:path";
|
|
188835
|
+
|
|
188836
|
+
// lib/shared/collect-tsci-dependencies.ts
|
|
188837
|
+
import fs46 from "node:fs";
|
|
188838
|
+
import path46 from "node:path";
|
|
189033
188839
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
189034
188840
|
var DEFAULT_IGNORES = [
|
|
189035
188841
|
"**/node_modules/**",
|
|
@@ -189044,7 +188850,7 @@ function collectTsciDependencies({
|
|
|
189044
188850
|
patterns = DEFAULT_PATTERNS,
|
|
189045
188851
|
ignore = DEFAULT_IGNORES
|
|
189046
188852
|
} = {}) {
|
|
189047
|
-
const searchRoot =
|
|
188853
|
+
const searchRoot = path46.resolve(cwd);
|
|
189048
188854
|
const files = globbySync(patterns, {
|
|
189049
188855
|
cwd: searchRoot,
|
|
189050
188856
|
absolute: true,
|
|
@@ -189054,7 +188860,7 @@ function collectTsciDependencies({
|
|
|
189054
188860
|
const dependencies2 = new Set;
|
|
189055
188861
|
for (const filePath of files) {
|
|
189056
188862
|
try {
|
|
189057
|
-
const fileContents =
|
|
188863
|
+
const fileContents = fs46.readFileSync(filePath, "utf-8");
|
|
189058
188864
|
let match;
|
|
189059
188865
|
while (true) {
|
|
189060
188866
|
match = IMPORT_PATTERN.exec(fileContents);
|
|
@@ -189071,26 +188877,26 @@ function collectTsciDependencies({
|
|
|
189071
188877
|
async function installProjectDependencies({
|
|
189072
188878
|
cwd = process.cwd()
|
|
189073
188879
|
} = {}) {
|
|
189074
|
-
const projectRoot =
|
|
189075
|
-
const packageJsonPath =
|
|
189076
|
-
const npmrcPath =
|
|
188880
|
+
const projectRoot = path47.resolve(cwd);
|
|
188881
|
+
const packageJsonPath = path47.join(projectRoot, "package.json");
|
|
188882
|
+
const npmrcPath = path47.join(projectRoot, ".npmrc");
|
|
189077
188883
|
const packageManager = getPackageManager();
|
|
189078
|
-
if (!
|
|
188884
|
+
if (!fs47.existsSync(projectRoot)) {
|
|
189079
188885
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
189080
188886
|
}
|
|
189081
188887
|
let packageJsonCreated = false;
|
|
189082
|
-
if (!
|
|
188888
|
+
if (!fs47.existsSync(packageJsonPath)) {
|
|
189083
188889
|
console.log("No package.json found. Generating a new one.");
|
|
189084
188890
|
generatePackageJson(projectRoot);
|
|
189085
188891
|
packageJsonCreated = true;
|
|
189086
188892
|
} else {
|
|
189087
188893
|
console.log("Found existing package.json.");
|
|
189088
188894
|
}
|
|
189089
|
-
if (!
|
|
188895
|
+
if (!fs47.existsSync(npmrcPath)) {
|
|
189090
188896
|
console.log("Creating .npmrc with tscircuit registry configuration.");
|
|
189091
|
-
|
|
188897
|
+
fs47.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
|
|
189092
188898
|
}
|
|
189093
|
-
const packageJson = JSON.parse(
|
|
188899
|
+
const packageJson = JSON.parse(fs47.readFileSync(packageJsonPath, "utf-8"));
|
|
189094
188900
|
if (packageJsonCreated) {
|
|
189095
188901
|
const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
|
|
189096
188902
|
if (tsciDependencies.length > 0) {
|
|
@@ -189105,7 +188911,7 @@ async function installProjectDependencies({
|
|
|
189105
188911
|
console.log("No @tsci dependencies detected in circuit files.");
|
|
189106
188912
|
}
|
|
189107
188913
|
}
|
|
189108
|
-
|
|
188914
|
+
fs47.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
189109
188915
|
`);
|
|
189110
188916
|
console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
|
|
189111
188917
|
try {
|
|
@@ -189140,7 +188946,7 @@ var registerInstall = (program3) => {
|
|
|
189140
188946
|
};
|
|
189141
188947
|
|
|
189142
188948
|
// cli/transpile/register.ts
|
|
189143
|
-
import
|
|
188949
|
+
import path48 from "node:path";
|
|
189144
188950
|
var registerTranspile = (program3) => {
|
|
189145
188951
|
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
189146
188952
|
try {
|
|
@@ -189148,7 +188954,7 @@ var registerTranspile = (program3) => {
|
|
|
189148
188954
|
fileOrDir: file,
|
|
189149
188955
|
includeBoardFiles: false
|
|
189150
188956
|
});
|
|
189151
|
-
const distDir =
|
|
188957
|
+
const distDir = path48.join(projectDir, "dist");
|
|
189152
188958
|
validateMainInDist(projectDir, distDir);
|
|
189153
188959
|
console.log("Transpiling entry file...");
|
|
189154
188960
|
const entryFile = mainEntrypoint || circuitFiles[0];
|