@tscircuit/cli 0.1.724 → 0.1.726
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 +414 -606
- 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,
|
|
@@ -78472,6 +78472,7 @@ var pushSnippet = async ({
|
|
|
78472
78472
|
filePath,
|
|
78473
78473
|
isPrivate,
|
|
78474
78474
|
versionTag,
|
|
78475
|
+
includeDist = false,
|
|
78475
78476
|
log = console.log,
|
|
78476
78477
|
onExit = (code) => process.exit(code),
|
|
78477
78478
|
onError = (message) => console.error(message),
|
|
@@ -78678,7 +78679,7 @@ var pushSnippet = async ({
|
|
|
78678
78679
|
});
|
|
78679
78680
|
log(`
|
|
78680
78681
|
`);
|
|
78681
|
-
const filePaths = getPackageFilePaths(projectDir);
|
|
78682
|
+
const filePaths = getPackageFilePaths(projectDir, includeDist ? [] : ["**/dist/**"]);
|
|
78682
78683
|
for (const fullFilePath of filePaths) {
|
|
78683
78684
|
const relativeFilePath = path15.relative(projectDir, fullFilePath);
|
|
78684
78685
|
const fileBuffer = fs13.readFileSync(fullFilePath);
|
|
@@ -80270,8 +80271,8 @@ Successfully cloned to:`));
|
|
|
80270
80271
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
80271
80272
|
|
|
80272
80273
|
// lib/shared/export-snippet.ts
|
|
80273
|
-
import
|
|
80274
|
-
import
|
|
80274
|
+
import fs28 from "node:fs";
|
|
80275
|
+
import path30 from "node:path";
|
|
80275
80276
|
import { promisify as promisify3 } from "node:util";
|
|
80276
80277
|
|
|
80277
80278
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -84246,162 +84247,8 @@ async function generateCircuitJson({
|
|
|
84246
84247
|
};
|
|
84247
84248
|
}
|
|
84248
84249
|
|
|
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
84250
|
// lib/shared/export-snippet.ts
|
|
84404
|
-
var writeFileAsync = promisify3(
|
|
84251
|
+
var writeFileAsync = promisify3(fs28.writeFile);
|
|
84405
84252
|
var ALLOWED_EXPORT_FORMATS = [
|
|
84406
84253
|
"json",
|
|
84407
84254
|
"circuit-json",
|
|
@@ -84415,7 +84262,6 @@ var ALLOWED_EXPORT_FORMATS = [
|
|
|
84415
84262
|
"kicad_sch",
|
|
84416
84263
|
"kicad_pcb",
|
|
84417
84264
|
"kicad_zip",
|
|
84418
|
-
"kicad-footprint-library",
|
|
84419
84265
|
"kicad-library"
|
|
84420
84266
|
];
|
|
84421
84267
|
var OUTPUT_EXTENSIONS = {
|
|
@@ -84431,7 +84277,6 @@ var OUTPUT_EXTENSIONS = {
|
|
|
84431
84277
|
kicad_sch: ".kicad_sch",
|
|
84432
84278
|
kicad_pcb: ".kicad_pcb",
|
|
84433
84279
|
kicad_zip: "-kicad.zip",
|
|
84434
|
-
"kicad-footprint-library": "-footprints.zip",
|
|
84435
84280
|
"kicad-library": ""
|
|
84436
84281
|
};
|
|
84437
84282
|
var exportSnippet = async ({
|
|
@@ -84448,10 +84293,10 @@ var exportSnippet = async ({
|
|
|
84448
84293
|
onError(`Invalid format: ${format}`);
|
|
84449
84294
|
return onExit(1);
|
|
84450
84295
|
}
|
|
84451
|
-
const projectDir =
|
|
84452
|
-
const outputBaseName =
|
|
84296
|
+
const projectDir = path30.dirname(filePath);
|
|
84297
|
+
const outputBaseName = path30.basename(filePath).replace(/\.[^.]+$/, "");
|
|
84453
84298
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
84454
|
-
const outputDestination =
|
|
84299
|
+
const outputDestination = path30.join(projectDir, outputPath ?? outputFileName);
|
|
84455
84300
|
const circuitData = await generateCircuitJson({
|
|
84456
84301
|
filePath,
|
|
84457
84302
|
saveToFile: format === "circuit-json",
|
|
@@ -84509,33 +84354,6 @@ var exportSnippet = async ({
|
|
|
84509
84354
|
outputContent = await zip.generateAsync({ type: "nodebuffer" });
|
|
84510
84355
|
break;
|
|
84511
84356
|
}
|
|
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
84357
|
case "kicad-library": {
|
|
84540
84358
|
const libraryName = outputBaseName;
|
|
84541
84359
|
const fpLibName = outputBaseName;
|
|
@@ -84546,26 +84364,26 @@ ${libTableEntries.join(`
|
|
|
84546
84364
|
libConverter.runUntilFinished();
|
|
84547
84365
|
const libOutput = libConverter.getOutput();
|
|
84548
84366
|
const libDir = outputDestination;
|
|
84549
|
-
|
|
84550
|
-
|
|
84551
|
-
const fpDir =
|
|
84552
|
-
|
|
84367
|
+
fs28.mkdirSync(libDir, { recursive: true });
|
|
84368
|
+
fs28.writeFileSync(path30.join(libDir, `${libraryName}.kicad_sym`), libOutput.kicadSymString);
|
|
84369
|
+
const fpDir = path30.join(libDir, `${fpLibName}.pretty`);
|
|
84370
|
+
fs28.mkdirSync(fpDir, { recursive: true });
|
|
84553
84371
|
for (const fp of libOutput.footprints) {
|
|
84554
|
-
|
|
84372
|
+
fs28.writeFileSync(path30.join(fpDir, `${fp.footprintName}.kicad_mod`), `${fp.kicadModString}
|
|
84555
84373
|
`);
|
|
84556
84374
|
}
|
|
84557
84375
|
if (libOutput.model3dSourcePaths.length > 0) {
|
|
84558
|
-
const shapesDir =
|
|
84559
|
-
|
|
84376
|
+
const shapesDir = path30.join(libDir, `${fpLibName}.3dshapes`);
|
|
84377
|
+
fs28.mkdirSync(shapesDir, { recursive: true });
|
|
84560
84378
|
for (const modelPath of libOutput.model3dSourcePaths) {
|
|
84561
|
-
if (
|
|
84562
|
-
const filename =
|
|
84563
|
-
|
|
84379
|
+
if (fs28.existsSync(modelPath)) {
|
|
84380
|
+
const filename = path30.basename(modelPath);
|
|
84381
|
+
fs28.copyFileSync(modelPath, path30.join(shapesDir, filename));
|
|
84564
84382
|
}
|
|
84565
84383
|
}
|
|
84566
84384
|
}
|
|
84567
|
-
|
|
84568
|
-
|
|
84385
|
+
fs28.writeFileSync(path30.join(libDir, "fp-lib-table"), libOutput.fpLibTableString);
|
|
84386
|
+
fs28.writeFileSync(path30.join(libDir, "sym-lib-table"), libOutput.symLibTableString);
|
|
84569
84387
|
outputContent = "";
|
|
84570
84388
|
if (writeFile) {
|
|
84571
84389
|
onSuccess({ outputDestination: libDir, outputContent: "" });
|
|
@@ -84700,12 +84518,12 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
84700
84518
|
};
|
|
84701
84519
|
|
|
84702
84520
|
// lib/eecircuit-engine/run-simulation.ts
|
|
84703
|
-
import { promises as
|
|
84704
|
-
import
|
|
84521
|
+
import { promises as fs29, existsSync as existsSync12 } from "node:fs";
|
|
84522
|
+
import path31 from "node:path";
|
|
84705
84523
|
import os4 from "node:os";
|
|
84706
84524
|
var sim = null;
|
|
84707
84525
|
var fetchSimulation = async () => {
|
|
84708
|
-
const tempFilePath =
|
|
84526
|
+
const tempFilePath = path31.join(os4.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
84709
84527
|
if (!existsSync12(tempFilePath)) {
|
|
84710
84528
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
84711
84529
|
const response = await fetch(url);
|
|
@@ -84713,7 +84531,7 @@ var fetchSimulation = async () => {
|
|
|
84713
84531
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
84714
84532
|
}
|
|
84715
84533
|
const scriptContent = await response.text();
|
|
84716
|
-
await
|
|
84534
|
+
await fs29.writeFile(tempFilePath, scriptContent);
|
|
84717
84535
|
}
|
|
84718
84536
|
const module2 = await import(tempFilePath);
|
|
84719
84537
|
return module2.Simulation;
|
|
@@ -84802,8 +84620,8 @@ var resultToCsv = (result) => {
|
|
|
84802
84620
|
};
|
|
84803
84621
|
|
|
84804
84622
|
// cli/export/register.ts
|
|
84805
|
-
import
|
|
84806
|
-
import { promises as
|
|
84623
|
+
import path32 from "node:path";
|
|
84624
|
+
import { promises as fs30 } from "node:fs";
|
|
84807
84625
|
var registerExport = (program3) => {
|
|
84808
84626
|
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
84627
|
const formatOption = options.format ?? "json";
|
|
@@ -84815,12 +84633,12 @@ var registerExport = (program3) => {
|
|
|
84815
84633
|
});
|
|
84816
84634
|
if (circuitJson) {
|
|
84817
84635
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
84818
|
-
const outputSpicePath = options.output ??
|
|
84819
|
-
await
|
|
84636
|
+
const outputSpicePath = options.output ?? path32.join(path32.dirname(file), `${path32.basename(file, path32.extname(file))}.spice.cir`);
|
|
84637
|
+
await fs30.writeFile(outputSpicePath, spiceString);
|
|
84820
84638
|
const { result } = await runSimulation(spiceString);
|
|
84821
84639
|
const csvContent = resultToCsv(result);
|
|
84822
84640
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
84823
|
-
await
|
|
84641
|
+
await fs30.writeFile(outputCsvPath, csvContent);
|
|
84824
84642
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
84825
84643
|
}
|
|
84826
84644
|
process.exit(0);
|
|
@@ -84902,11 +84720,12 @@ Logged in user:
|
|
|
84902
84720
|
|
|
84903
84721
|
// cli/push/register.ts
|
|
84904
84722
|
var registerPush = (program3) => {
|
|
84905
|
-
program3.command("push").description("Save package code to Registry API").argument("[file]", "Path to the package file").option("--private", "Make the package private").option("--version-tag <tag>", "Publish as a non-latest version using the provided tag").action(async (filePath, options = {}) => {
|
|
84723
|
+
program3.command("push").description("Save package code to Registry API").argument("[file]", "Path to the package file").option("--private", "Make the package private").option("--version-tag <tag>", "Publish as a non-latest version using the provided tag").option("--include-dist", "Include the dist directory in the push").action(async (filePath, options = {}) => {
|
|
84906
84724
|
await pushSnippet({
|
|
84907
84725
|
filePath,
|
|
84908
84726
|
isPrivate: options.private ?? false,
|
|
84909
84727
|
versionTag: options.versionTag,
|
|
84728
|
+
includeDist: options.includeDist ?? false,
|
|
84910
84729
|
onExit: (code) => process.exit(code),
|
|
84911
84730
|
onError: (message) => console.error(message),
|
|
84912
84731
|
onSuccess: (message) => console.log(message)
|
|
@@ -85045,14 +84864,14 @@ class KeyStore {
|
|
|
85045
84864
|
}
|
|
85046
84865
|
}
|
|
85047
84866
|
function createKey(key) {
|
|
85048
|
-
let
|
|
84867
|
+
let path33 = null;
|
|
85049
84868
|
let id = null;
|
|
85050
84869
|
let src = null;
|
|
85051
84870
|
let weight = 1;
|
|
85052
84871
|
let getFn = null;
|
|
85053
84872
|
if (isString2(key) || isArray(key)) {
|
|
85054
84873
|
src = key;
|
|
85055
|
-
|
|
84874
|
+
path33 = createKeyPath(key);
|
|
85056
84875
|
id = createKeyId(key);
|
|
85057
84876
|
} else {
|
|
85058
84877
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -85066,11 +84885,11 @@ function createKey(key) {
|
|
|
85066
84885
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
85067
84886
|
}
|
|
85068
84887
|
}
|
|
85069
|
-
|
|
84888
|
+
path33 = createKeyPath(name);
|
|
85070
84889
|
id = createKeyId(name);
|
|
85071
84890
|
getFn = key.getFn;
|
|
85072
84891
|
}
|
|
85073
|
-
return { path:
|
|
84892
|
+
return { path: path33, id, weight, src, getFn };
|
|
85074
84893
|
}
|
|
85075
84894
|
function createKeyPath(key) {
|
|
85076
84895
|
return isArray(key) ? key : key.split(".");
|
|
@@ -85078,34 +84897,34 @@ function createKeyPath(key) {
|
|
|
85078
84897
|
function createKeyId(key) {
|
|
85079
84898
|
return isArray(key) ? key.join(".") : key;
|
|
85080
84899
|
}
|
|
85081
|
-
function get(obj,
|
|
84900
|
+
function get(obj, path33) {
|
|
85082
84901
|
let list = [];
|
|
85083
84902
|
let arr = false;
|
|
85084
|
-
const deepGet = (obj2,
|
|
84903
|
+
const deepGet = (obj2, path34, index) => {
|
|
85085
84904
|
if (!isDefined(obj2)) {
|
|
85086
84905
|
return;
|
|
85087
84906
|
}
|
|
85088
|
-
if (!
|
|
84907
|
+
if (!path34[index]) {
|
|
85089
84908
|
list.push(obj2);
|
|
85090
84909
|
} else {
|
|
85091
|
-
let key =
|
|
84910
|
+
let key = path34[index];
|
|
85092
84911
|
const value = obj2[key];
|
|
85093
84912
|
if (!isDefined(value)) {
|
|
85094
84913
|
return;
|
|
85095
84914
|
}
|
|
85096
|
-
if (index ===
|
|
84915
|
+
if (index === path34.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
85097
84916
|
list.push(toString(value));
|
|
85098
84917
|
} else if (isArray(value)) {
|
|
85099
84918
|
arr = true;
|
|
85100
84919
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
85101
|
-
deepGet(value[i],
|
|
84920
|
+
deepGet(value[i], path34, index + 1);
|
|
85102
84921
|
}
|
|
85103
|
-
} else if (
|
|
85104
|
-
deepGet(value,
|
|
84922
|
+
} else if (path34.length) {
|
|
84923
|
+
deepGet(value, path34, index + 1);
|
|
85105
84924
|
}
|
|
85106
84925
|
}
|
|
85107
84926
|
};
|
|
85108
|
-
deepGet(obj, isString2(
|
|
84927
|
+
deepGet(obj, isString2(path33) ? path33.split(".") : path33, 0);
|
|
85109
84928
|
return arr ? list : list[0];
|
|
85110
84929
|
}
|
|
85111
84930
|
var MatchOptions = {
|
|
@@ -86297,8 +86116,8 @@ var registerSearch = (program3) => {
|
|
|
86297
86116
|
}
|
|
86298
86117
|
if (kicadResults.length) {
|
|
86299
86118
|
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:${
|
|
86119
|
+
kicadResults.forEach((path33, idx) => {
|
|
86120
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path33.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
86302
86121
|
});
|
|
86303
86122
|
}
|
|
86304
86123
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -91261,12 +91080,12 @@ var { paths: Ac, texts: ov, bounds: Le, refblocks: $y, circles: Pc } = R;
|
|
|
91261
91080
|
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
91081
|
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
91082
|
var { paths: Fc, texts: Rc, bounds: Ve, refblocks: Ny, circles: Tc } = Cy;
|
|
91264
|
-
var
|
|
91265
|
-
var { 5: Ec, ...Yc } =
|
|
91083
|
+
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 } });
|
|
91084
|
+
var { 5: Ec, ...Yc } = At3.primitives;
|
|
91266
91085
|
function Xc(t2) {
|
|
91267
91086
|
return typeof t2 == "object";
|
|
91268
91087
|
}
|
|
91269
|
-
var Iy = r({ ...
|
|
91088
|
+
var Iy = r({ ...At3, primitives: Object.values(Yc).filter(Xc) });
|
|
91270
91089
|
var By = { ...Iy, primitives: [...Iy.primitives, Ec] };
|
|
91271
91090
|
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
91091
|
var { paths: Vc, texts: jc, bounds: je, refblocks: Dy } = qy;
|
|
@@ -91477,7 +91296,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
91477
91296
|
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
91297
|
var ms = r(U, "down");
|
|
91479
91298
|
var ns = r(U, "left");
|
|
91480
|
-
var
|
|
91299
|
+
var fs31 = r(U, "up");
|
|
91481
91300
|
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
91301
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
91483
91302
|
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 +91865,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
92046
91865
|
sb.anchor = "middle_left";
|
|
92047
91866
|
mb.anchor = "middle_right";
|
|
92048
91867
|
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:
|
|
91868
|
+
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
91869
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
92051
91870
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
92052
91871
|
lineThickness = 0
|
|
@@ -94076,11 +93895,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
94076
93895
|
fiber = fiber.next, id2--;
|
|
94077
93896
|
return fiber;
|
|
94078
93897
|
}
|
|
94079
|
-
function copyWithSetImpl(obj,
|
|
94080
|
-
if (index >=
|
|
93898
|
+
function copyWithSetImpl(obj, path33, index, value) {
|
|
93899
|
+
if (index >= path33.length)
|
|
94081
93900
|
return value;
|
|
94082
|
-
var key =
|
|
94083
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
93901
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93902
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index + 1, value);
|
|
94084
93903
|
return updated;
|
|
94085
93904
|
}
|
|
94086
93905
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -94100,11 +93919,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
94100
93919
|
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
93920
|
return updated;
|
|
94102
93921
|
}
|
|
94103
|
-
function copyWithDeleteImpl(obj,
|
|
94104
|
-
var key =
|
|
94105
|
-
if (index + 1 ===
|
|
93922
|
+
function copyWithDeleteImpl(obj, path33, index) {
|
|
93923
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93924
|
+
if (index + 1 === path33.length)
|
|
94106
93925
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
94107
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
93926
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index + 1);
|
|
94108
93927
|
return updated;
|
|
94109
93928
|
}
|
|
94110
93929
|
function shouldSuspendImpl() {
|
|
@@ -103135,29 +102954,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
103135
102954
|
var didWarnAboutNestedUpdates = false;
|
|
103136
102955
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
103137
102956
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
103138
|
-
overrideHookState = function(fiber, id2,
|
|
102957
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
103139
102958
|
id2 = findHook(fiber, id2);
|
|
103140
|
-
id2 !== null && (
|
|
102959
|
+
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
102960
|
};
|
|
103142
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
102961
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
103143
102962
|
id2 = findHook(fiber, id2);
|
|
103144
|
-
id2 !== null && (
|
|
102963
|
+
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
102964
|
};
|
|
103146
102965
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
103147
102966
|
id2 = findHook(fiber, id2);
|
|
103148
102967
|
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
102968
|
};
|
|
103150
|
-
overrideProps = function(fiber,
|
|
103151
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
102969
|
+
overrideProps = function(fiber, path33, value) {
|
|
102970
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path33, 0, value);
|
|
103152
102971
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
103153
|
-
|
|
103154
|
-
|
|
102972
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102973
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
103155
102974
|
};
|
|
103156
|
-
overridePropsDeletePath = function(fiber,
|
|
103157
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
102975
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
102976
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path33, 0);
|
|
103158
102977
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
103159
|
-
|
|
103160
|
-
|
|
102978
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102979
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
103161
102980
|
};
|
|
103162
102981
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
103163
102982
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -118494,10 +118313,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118494
118313
|
var setErrorHandler = null;
|
|
118495
118314
|
var setSuspenseHandler = null;
|
|
118496
118315
|
{
|
|
118497
|
-
var copyWithDeleteImpl = function(obj,
|
|
118498
|
-
var key =
|
|
118316
|
+
var copyWithDeleteImpl = function(obj, path33, index2) {
|
|
118317
|
+
var key = path33[index2];
|
|
118499
118318
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118500
|
-
if (index2 + 1 ===
|
|
118319
|
+
if (index2 + 1 === path33.length) {
|
|
118501
118320
|
if (isArray2(updated)) {
|
|
118502
118321
|
updated.splice(key, 1);
|
|
118503
118322
|
} else {
|
|
@@ -118505,11 +118324,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118505
118324
|
}
|
|
118506
118325
|
return updated;
|
|
118507
118326
|
}
|
|
118508
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
118327
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index2 + 1);
|
|
118509
118328
|
return updated;
|
|
118510
118329
|
};
|
|
118511
|
-
var copyWithDelete = function(obj,
|
|
118512
|
-
return copyWithDeleteImpl(obj,
|
|
118330
|
+
var copyWithDelete = function(obj, path33) {
|
|
118331
|
+
return copyWithDeleteImpl(obj, path33, 0);
|
|
118513
118332
|
};
|
|
118514
118333
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
118515
118334
|
var oldKey = oldPath[index2];
|
|
@@ -118541,17 +118360,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118541
118360
|
}
|
|
118542
118361
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
118543
118362
|
};
|
|
118544
|
-
var copyWithSetImpl = function(obj,
|
|
118545
|
-
if (index2 >=
|
|
118363
|
+
var copyWithSetImpl = function(obj, path33, index2, value) {
|
|
118364
|
+
if (index2 >= path33.length) {
|
|
118546
118365
|
return value;
|
|
118547
118366
|
}
|
|
118548
|
-
var key =
|
|
118367
|
+
var key = path33[index2];
|
|
118549
118368
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118550
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
118369
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index2 + 1, value);
|
|
118551
118370
|
return updated;
|
|
118552
118371
|
};
|
|
118553
|
-
var copyWithSet = function(obj,
|
|
118554
|
-
return copyWithSetImpl(obj,
|
|
118372
|
+
var copyWithSet = function(obj, path33, value) {
|
|
118373
|
+
return copyWithSetImpl(obj, path33, 0, value);
|
|
118555
118374
|
};
|
|
118556
118375
|
var findHook = function(fiber, id2) {
|
|
118557
118376
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -118561,10 +118380,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118561
118380
|
}
|
|
118562
118381
|
return currentHook2;
|
|
118563
118382
|
};
|
|
118564
|
-
overrideHookState = function(fiber, id2,
|
|
118383
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
118565
118384
|
var hook = findHook(fiber, id2);
|
|
118566
118385
|
if (hook !== null) {
|
|
118567
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
118386
|
+
var newState = copyWithSet(hook.memoizedState, path33, value);
|
|
118568
118387
|
hook.memoizedState = newState;
|
|
118569
118388
|
hook.baseState = newState;
|
|
118570
118389
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118574,10 +118393,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118574
118393
|
}
|
|
118575
118394
|
}
|
|
118576
118395
|
};
|
|
118577
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
118396
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
118578
118397
|
var hook = findHook(fiber, id2);
|
|
118579
118398
|
if (hook !== null) {
|
|
118580
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
118399
|
+
var newState = copyWithDelete(hook.memoizedState, path33);
|
|
118581
118400
|
hook.memoizedState = newState;
|
|
118582
118401
|
hook.baseState = newState;
|
|
118583
118402
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118600,8 +118419,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118600
118419
|
}
|
|
118601
118420
|
}
|
|
118602
118421
|
};
|
|
118603
|
-
overrideProps = function(fiber,
|
|
118604
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
118422
|
+
overrideProps = function(fiber, path33, value) {
|
|
118423
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path33, value);
|
|
118605
118424
|
if (fiber.alternate) {
|
|
118606
118425
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118607
118426
|
}
|
|
@@ -118610,8 +118429,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118610
118429
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
118611
118430
|
}
|
|
118612
118431
|
};
|
|
118613
|
-
overridePropsDeletePath = function(fiber,
|
|
118614
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
118432
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
118433
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path33);
|
|
118615
118434
|
if (fiber.alternate) {
|
|
118616
118435
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118617
118436
|
}
|
|
@@ -124662,7 +124481,7 @@ var parsePin = (pinString) => {
|
|
|
124662
124481
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
124663
124482
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
124664
124483
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
124665
|
-
const
|
|
124484
|
+
const path33 = pathMatch ? pathMatch[1] : "";
|
|
124666
124485
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
124667
124486
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
124668
124487
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -124676,7 +124495,7 @@ var parsePin = (pinString) => {
|
|
|
124676
124495
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
124677
124496
|
label,
|
|
124678
124497
|
labelColor,
|
|
124679
|
-
path:
|
|
124498
|
+
path: path33,
|
|
124680
124499
|
arrow
|
|
124681
124500
|
};
|
|
124682
124501
|
};
|
|
@@ -125116,15 +124935,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
125116
124935
|
}
|
|
125117
124936
|
}
|
|
125118
124937
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
125119
|
-
const
|
|
124938
|
+
const path33 = [];
|
|
125120
124939
|
for (let i = 0;i <= numPoints; i++) {
|
|
125121
124940
|
const t3 = i / numPoints;
|
|
125122
124941
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
125123
124942
|
const x = centerX + radius * Math.cos(angle2);
|
|
125124
124943
|
const y = centerY + radius * Math.sin(angle2);
|
|
125125
|
-
|
|
124944
|
+
path33.push({ x, y });
|
|
125126
124945
|
}
|
|
125127
|
-
return
|
|
124946
|
+
return path33;
|
|
125128
124947
|
}
|
|
125129
124948
|
var __defProp4 = Object.defineProperty;
|
|
125130
124949
|
var __export22 = (target, all) => {
|
|
@@ -126542,7 +126361,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
126542
126361
|
};
|
|
126543
126362
|
};
|
|
126544
126363
|
var silkscreenPin = ({
|
|
126545
|
-
fs:
|
|
126364
|
+
fs: fs32,
|
|
126546
126365
|
pn: pn2,
|
|
126547
126366
|
anchor_x,
|
|
126548
126367
|
anchor_y,
|
|
@@ -126585,7 +126404,7 @@ var silkscreenPin = ({
|
|
|
126585
126404
|
type: "pcb_silkscreen_text",
|
|
126586
126405
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
126587
126406
|
font: "tscircuit2024",
|
|
126588
|
-
font_size:
|
|
126407
|
+
font_size: fs32,
|
|
126589
126408
|
pcb_component_id: "pcb_component_1",
|
|
126590
126409
|
text: `{PIN${pn2}}`,
|
|
126591
126410
|
layer,
|
|
@@ -134201,17 +134020,17 @@ var ObstacleList = class {
|
|
|
134201
134020
|
return obstacles;
|
|
134202
134021
|
}
|
|
134203
134022
|
};
|
|
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 =
|
|
134023
|
+
function removePathLoops(path33) {
|
|
134024
|
+
if (path33.length < 4)
|
|
134025
|
+
return path33;
|
|
134026
|
+
const result = [{ ...path33[0] }];
|
|
134027
|
+
let currentLayer = path33[0].layer;
|
|
134028
|
+
for (let i = 1;i < path33.length; i++) {
|
|
134029
|
+
const currentSegment = { start: path33[i - 1], end: path33[i] };
|
|
134030
|
+
const isVia = path33[i].route_type === "via" || path33[i - 1].route_type === "via";
|
|
134031
|
+
if (path33[i].layer !== currentLayer || isVia) {
|
|
134032
|
+
result.push({ ...path33[i] });
|
|
134033
|
+
currentLayer = path33[i].layer;
|
|
134215
134034
|
continue;
|
|
134216
134035
|
}
|
|
134217
134036
|
let intersectionFound = false;
|
|
@@ -134240,8 +134059,8 @@ function removePathLoops(path34) {
|
|
|
134240
134059
|
result.push(intersectionPoint);
|
|
134241
134060
|
}
|
|
134242
134061
|
const lastPoint = result[result.length - 1];
|
|
134243
|
-
if (lastPoint.x !==
|
|
134244
|
-
result.push(
|
|
134062
|
+
if (lastPoint.x !== path33[i].x || lastPoint.y !== path33[i].y) {
|
|
134063
|
+
result.push(path33[i]);
|
|
134245
134064
|
}
|
|
134246
134065
|
}
|
|
134247
134066
|
return result;
|
|
@@ -134730,10 +134549,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134730
134549
|
});
|
|
134731
134550
|
}
|
|
134732
134551
|
if (current2.parent) {
|
|
134733
|
-
const
|
|
134552
|
+
const path33 = [];
|
|
134734
134553
|
let p = current2;
|
|
134735
134554
|
while (p) {
|
|
134736
|
-
|
|
134555
|
+
path33.unshift(p);
|
|
134737
134556
|
p = p.parent;
|
|
134738
134557
|
}
|
|
134739
134558
|
debugSolution.push({
|
|
@@ -134741,7 +134560,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134741
134560
|
pcb_component_id: "",
|
|
134742
134561
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
134743
134562
|
layer: "top",
|
|
134744
|
-
route:
|
|
134563
|
+
route: path33,
|
|
134745
134564
|
stroke_width: 0.01
|
|
134746
134565
|
});
|
|
134747
134566
|
}
|
|
@@ -139663,13 +139482,13 @@ var RBush = class {
|
|
|
139663
139482
|
return this;
|
|
139664
139483
|
let node = this.data;
|
|
139665
139484
|
const bbox = this.toBBox(item);
|
|
139666
|
-
const
|
|
139485
|
+
const path33 = [];
|
|
139667
139486
|
const indexes = [];
|
|
139668
139487
|
let i, parent, goingUp;
|
|
139669
|
-
while (node ||
|
|
139488
|
+
while (node || path33.length) {
|
|
139670
139489
|
if (!node) {
|
|
139671
|
-
node =
|
|
139672
|
-
parent =
|
|
139490
|
+
node = path33.pop();
|
|
139491
|
+
parent = path33[path33.length - 1];
|
|
139673
139492
|
i = indexes.pop();
|
|
139674
139493
|
goingUp = true;
|
|
139675
139494
|
}
|
|
@@ -139677,13 +139496,13 @@ var RBush = class {
|
|
|
139677
139496
|
const index = findItem(item, node.children, equalsFn);
|
|
139678
139497
|
if (index !== -1) {
|
|
139679
139498
|
node.children.splice(index, 1);
|
|
139680
|
-
|
|
139681
|
-
this._condense(
|
|
139499
|
+
path33.push(node);
|
|
139500
|
+
this._condense(path33);
|
|
139682
139501
|
return this;
|
|
139683
139502
|
}
|
|
139684
139503
|
}
|
|
139685
139504
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
139686
|
-
|
|
139505
|
+
path33.push(node);
|
|
139687
139506
|
indexes.push(i);
|
|
139688
139507
|
i = 0;
|
|
139689
139508
|
parent = node;
|
|
@@ -139754,10 +139573,10 @@ var RBush = class {
|
|
|
139754
139573
|
calcBBox(node, this.toBBox);
|
|
139755
139574
|
return node;
|
|
139756
139575
|
}
|
|
139757
|
-
_chooseSubtree(bbox, node, level,
|
|
139576
|
+
_chooseSubtree(bbox, node, level, path33) {
|
|
139758
139577
|
while (true) {
|
|
139759
|
-
|
|
139760
|
-
if (node.leaf ||
|
|
139578
|
+
path33.push(node);
|
|
139579
|
+
if (node.leaf || path33.length - 1 === level)
|
|
139761
139580
|
break;
|
|
139762
139581
|
let minArea = Infinity;
|
|
139763
139582
|
let minEnlargement = Infinity;
|
|
@@ -139866,21 +139685,21 @@ var RBush = class {
|
|
|
139866
139685
|
}
|
|
139867
139686
|
return margin;
|
|
139868
139687
|
}
|
|
139869
|
-
_adjustParentBBoxes(bbox,
|
|
139688
|
+
_adjustParentBBoxes(bbox, path33, level) {
|
|
139870
139689
|
for (let i = level;i >= 0; i--) {
|
|
139871
|
-
extend(
|
|
139690
|
+
extend(path33[i], bbox);
|
|
139872
139691
|
}
|
|
139873
139692
|
}
|
|
139874
|
-
_condense(
|
|
139875
|
-
for (let i =
|
|
139876
|
-
if (
|
|
139693
|
+
_condense(path33) {
|
|
139694
|
+
for (let i = path33.length - 1, siblings;i >= 0; i--) {
|
|
139695
|
+
if (path33[i].children.length === 0) {
|
|
139877
139696
|
if (i > 0) {
|
|
139878
|
-
siblings =
|
|
139879
|
-
siblings.splice(siblings.indexOf(
|
|
139697
|
+
siblings = path33[i - 1].children;
|
|
139698
|
+
siblings.splice(siblings.indexOf(path33[i]), 1);
|
|
139880
139699
|
} else
|
|
139881
139700
|
this.clear();
|
|
139882
139701
|
} else
|
|
139883
|
-
calcBBox(
|
|
139702
|
+
calcBBox(path33[i], this.toBBox);
|
|
139884
139703
|
}
|
|
139885
139704
|
}
|
|
139886
139705
|
};
|
|
@@ -141025,7 +140844,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141025
140844
|
this.capacityPaths = capacityPaths;
|
|
141026
140845
|
this.colorMap = colorMap ?? {};
|
|
141027
140846
|
this.unprocessedNodeIds = [
|
|
141028
|
-
...new Set(capacityPaths.flatMap((
|
|
140847
|
+
...new Set(capacityPaths.flatMap((path33) => path33.nodeIds))
|
|
141029
140848
|
];
|
|
141030
140849
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
141031
140850
|
}
|
|
@@ -141036,17 +140855,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141036
140855
|
return;
|
|
141037
140856
|
}
|
|
141038
140857
|
const pathsGoingThroughNode = [];
|
|
141039
|
-
for (const
|
|
141040
|
-
const indexOfNodeInPath =
|
|
140858
|
+
for (const path33 of this.capacityPaths) {
|
|
140859
|
+
const indexOfNodeInPath = path33.nodeIds.indexOf(nodeId);
|
|
141041
140860
|
if (indexOfNodeInPath !== -1) {
|
|
141042
|
-
pathsGoingThroughNode.push({ path:
|
|
140861
|
+
pathsGoingThroughNode.push({ path: path33, indexOfNodeInPath });
|
|
141043
140862
|
}
|
|
141044
140863
|
}
|
|
141045
140864
|
const node = this.nodeMap.get(nodeId);
|
|
141046
140865
|
const nodePortSegments = [];
|
|
141047
|
-
for (const { path:
|
|
141048
|
-
const entryNodeId =
|
|
141049
|
-
const exitNodeId =
|
|
140866
|
+
for (const { path: path33, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
140867
|
+
const entryNodeId = path33.nodeIds[indexOfNodeInPath - 1];
|
|
140868
|
+
const exitNodeId = path33.nodeIds[indexOfNodeInPath + 1];
|
|
141050
140869
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
141051
140870
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
141052
140871
|
if (!adjNode)
|
|
@@ -141059,7 +140878,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
141059
140878
|
capacityMeshNodeId: nodeId,
|
|
141060
140879
|
start: segment2.start,
|
|
141061
140880
|
end: segment2.end,
|
|
141062
|
-
connectionNames: [
|
|
140881
|
+
connectionNames: [path33.connectionName],
|
|
141063
140882
|
availableZ: mutuallyAvailableZ
|
|
141064
140883
|
};
|
|
141065
140884
|
nodePortSegments.push(portSegment);
|
|
@@ -141865,37 +141684,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
141865
141684
|
return neighbors;
|
|
141866
141685
|
}
|
|
141867
141686
|
getNodePath(node) {
|
|
141868
|
-
const
|
|
141687
|
+
const path33 = [];
|
|
141869
141688
|
while (node) {
|
|
141870
|
-
|
|
141689
|
+
path33.push(node);
|
|
141871
141690
|
node = node.parent;
|
|
141872
141691
|
}
|
|
141873
|
-
return
|
|
141692
|
+
return path33;
|
|
141874
141693
|
}
|
|
141875
141694
|
getViasInNodePath(node) {
|
|
141876
|
-
const
|
|
141695
|
+
const path33 = this.getNodePath(node);
|
|
141877
141696
|
const vias = [];
|
|
141878
|
-
for (let i = 0;i <
|
|
141879
|
-
if (
|
|
141880
|
-
vias.push({ x:
|
|
141697
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141698
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141699
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141881
141700
|
}
|
|
141882
141701
|
}
|
|
141883
141702
|
return vias;
|
|
141884
141703
|
}
|
|
141885
141704
|
setSolvedPath(node) {
|
|
141886
|
-
const
|
|
141887
|
-
|
|
141705
|
+
const path33 = this.getNodePath(node);
|
|
141706
|
+
path33.reverse();
|
|
141888
141707
|
const vias = [];
|
|
141889
|
-
for (let i = 0;i <
|
|
141890
|
-
if (
|
|
141891
|
-
vias.push({ x:
|
|
141708
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141709
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141710
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141892
141711
|
}
|
|
141893
141712
|
}
|
|
141894
141713
|
this.solvedPath = {
|
|
141895
141714
|
connectionName: this.connectionName,
|
|
141896
141715
|
traceThickness: this.traceThickness,
|
|
141897
141716
|
viaDiameter: this.viaDiameter,
|
|
141898
|
-
route:
|
|
141717
|
+
route: path33.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
141899
141718
|
vias
|
|
141900
141719
|
};
|
|
141901
141720
|
}
|
|
@@ -142703,12 +142522,12 @@ function computeDumbbellPaths({
|
|
|
142703
142522
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
142704
142523
|
};
|
|
142705
142524
|
};
|
|
142706
|
-
const subdivideOptimalPath = (
|
|
142707
|
-
if (
|
|
142708
|
-
return
|
|
142709
|
-
const result = [
|
|
142710
|
-
for (let i = 0;i <
|
|
142711
|
-
const segment2 = { start:
|
|
142525
|
+
const subdivideOptimalPath = (path33, numSubdivisions) => {
|
|
142526
|
+
if (path33.length < 2)
|
|
142527
|
+
return path33;
|
|
142528
|
+
const result = [path33[0]];
|
|
142529
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142530
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
142712
142531
|
const segmentMidpoint = {
|
|
142713
142532
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
142714
142533
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -142770,7 +142589,7 @@ function computeDumbbellPaths({
|
|
|
142770
142589
|
}
|
|
142771
142590
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
142772
142591
|
}
|
|
142773
|
-
result.push(
|
|
142592
|
+
result.push(path33[i + 1]);
|
|
142774
142593
|
}
|
|
142775
142594
|
if (result.length > 1) {
|
|
142776
142595
|
const filteredResult = [result[0]];
|
|
@@ -143005,13 +142824,13 @@ function computeDumbbellPaths({
|
|
|
143005
142824
|
].map((l, index) => ({ ...l, index }));
|
|
143006
142825
|
};
|
|
143007
142826
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
143008
|
-
const
|
|
143009
|
-
if (
|
|
143010
|
-
return
|
|
142827
|
+
const path33 = jLine.points;
|
|
142828
|
+
if (path33.length < 2)
|
|
142829
|
+
return path33;
|
|
143011
142830
|
const minDistThreshold = r3 + m2;
|
|
143012
|
-
const result = [
|
|
143013
|
-
for (let i = 0;i <
|
|
143014
|
-
const segment2 = { start:
|
|
142831
|
+
const result = [path33[0]];
|
|
142832
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142833
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
143015
142834
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
143016
142835
|
if (distToOpposite < minDistThreshold) {
|
|
143017
142836
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -143080,26 +142899,26 @@ function computeDumbbellPaths({
|
|
|
143080
142899
|
return { index: 0, path: [] };
|
|
143081
142900
|
}
|
|
143082
142901
|
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,
|
|
142902
|
+
const path33 = [...optimalPath2.path];
|
|
142903
|
+
const firstPoint = path33[0];
|
|
142904
|
+
const dist3 = distance3(firstPoint, path33[2]);
|
|
142905
|
+
const dist4 = distance3(firstPoint, path33[3]);
|
|
143087
142906
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
143088
|
-
if (dist3 < distance3(firstPoint,
|
|
143089
|
-
|
|
142907
|
+
if (dist3 < distance3(firstPoint, path33[1]) || dist4 < distance3(firstPoint, path33[1])) {
|
|
142908
|
+
path33.splice(1, closerIdx - 1);
|
|
143090
142909
|
}
|
|
143091
|
-
const lastPoint =
|
|
143092
|
-
const distM3 = distance3(lastPoint,
|
|
143093
|
-
const distM4 = distance3(lastPoint,
|
|
143094
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
143095
|
-
if (distM3 < distance3(lastPoint,
|
|
143096
|
-
|
|
142910
|
+
const lastPoint = path33[path33.length - 1];
|
|
142911
|
+
const distM3 = distance3(lastPoint, path33[path33.length - 3]);
|
|
142912
|
+
const distM4 = distance3(lastPoint, path33[path33.length - 4]);
|
|
142913
|
+
const closerLastIdx = distM3 < distM4 ? path33.length - 3 : path33.length - 4;
|
|
142914
|
+
if (distM3 < distance3(lastPoint, path33[path33.length - 2]) || distM4 < distance3(lastPoint, path33[path33.length - 2])) {
|
|
142915
|
+
path33.splice(closerLastIdx + 1, path33.length - closerLastIdx - 2);
|
|
143097
142916
|
}
|
|
143098
142917
|
return {
|
|
143099
142918
|
index: optimalPath2.index,
|
|
143100
|
-
path:
|
|
143101
|
-
startsAt:
|
|
143102
|
-
goesTo:
|
|
142919
|
+
path: path33,
|
|
142920
|
+
startsAt: path33[0] === C2 ? "C" : "D",
|
|
142921
|
+
goesTo: path33[path33.length - 1] === C2 ? "C" : "D"
|
|
143103
142922
|
};
|
|
143104
142923
|
};
|
|
143105
142924
|
const optimalPath = findOptimalPath();
|
|
@@ -144519,9 +144338,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144519
144338
|
let closestIntersection = null;
|
|
144520
144339
|
let intersectedSegmentZ = null;
|
|
144521
144340
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
144522
|
-
for (const
|
|
144523
|
-
for (let i = 0;i <
|
|
144524
|
-
const segment2 = [
|
|
144341
|
+
for (const path33 of pathMap.values()) {
|
|
144342
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144343
|
+
const segment2 = [path33[i], path33[i + 1]];
|
|
144525
144344
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
144526
144345
|
continue;
|
|
144527
144346
|
}
|
|
@@ -144651,11 +144470,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144651
144470
|
});
|
|
144652
144471
|
}
|
|
144653
144472
|
const drawPath = (pathMap, labelPrefix) => {
|
|
144654
|
-
for (const [connectionName,
|
|
144473
|
+
for (const [connectionName, path33] of pathMap.entries()) {
|
|
144655
144474
|
const color = colorMap[connectionName] ?? "black";
|
|
144656
|
-
for (let i = 0;i <
|
|
144657
|
-
const p12 =
|
|
144658
|
-
const p2 =
|
|
144475
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144476
|
+
const p12 = path33[i];
|
|
144477
|
+
const p2 = path33[i + 1];
|
|
144659
144478
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
144660
144479
|
graphics.circles.push({
|
|
144661
144480
|
center: { x: p12.x, y: p12.y },
|
|
@@ -145253,10 +145072,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
145253
145072
|
const allSegments = [];
|
|
145254
145073
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
145255
145074
|
for (const polyLine of polyLines) {
|
|
145256
|
-
const
|
|
145257
|
-
for (let i = 0;i <
|
|
145258
|
-
const p12 =
|
|
145259
|
-
const p2 =
|
|
145075
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
145076
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
145077
|
+
const p12 = path33[i];
|
|
145078
|
+
const p2 = path33[i + 1];
|
|
145260
145079
|
const layer = p12.z2;
|
|
145261
145080
|
allSegments.push({
|
|
145262
145081
|
start: { x: p12.x, y: p12.y },
|
|
@@ -145274,7 +145093,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
145274
145093
|
}
|
|
145275
145094
|
}
|
|
145276
145095
|
}
|
|
145277
|
-
const lastPoint =
|
|
145096
|
+
const lastPoint = path33[path33.length - 1];
|
|
145278
145097
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
145279
145098
|
const key = pointKey2(lastPoint);
|
|
145280
145099
|
if (!viaPoints.has(key)) {
|
|
@@ -145573,14 +145392,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
145573
145392
|
const polyLineVias = [];
|
|
145574
145393
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145575
145394
|
const polyLine = polyLines[i];
|
|
145576
|
-
const
|
|
145395
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
145577
145396
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
145578
|
-
for (let i22 = 0;i22 <
|
|
145579
|
-
const segment2 = [
|
|
145397
|
+
for (let i22 = 0;i22 < path33.length - 1; i22++) {
|
|
145398
|
+
const segment2 = [path33[i22], path33[i22 + 1]];
|
|
145580
145399
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
145581
145400
|
}
|
|
145582
145401
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
145583
|
-
polyLineVias.push(
|
|
145402
|
+
polyLineVias.push(path33.filter((p) => p.z1 !== p.z2));
|
|
145584
145403
|
}
|
|
145585
145404
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145586
145405
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -147009,7 +146828,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
147009
146828
|
if (this.failedSolvers.length > 0) {
|
|
147010
146829
|
this.solved = false;
|
|
147011
146830
|
this.failed = true;
|
|
147012
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
146831
|
+
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
146832
|
return;
|
|
147014
146833
|
}
|
|
147015
146834
|
this.solved = true;
|
|
@@ -149790,13 +149609,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149790
149609
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
149791
149610
|
}
|
|
149792
149611
|
getBacktrackedPath(candidate) {
|
|
149793
|
-
const
|
|
149612
|
+
const path33 = [];
|
|
149794
149613
|
let currentCandidate = candidate;
|
|
149795
149614
|
while (currentCandidate) {
|
|
149796
|
-
|
|
149615
|
+
path33.push(currentCandidate.node);
|
|
149797
149616
|
currentCandidate = currentCandidate.prevCandidate;
|
|
149798
149617
|
}
|
|
149799
|
-
return
|
|
149618
|
+
return path33;
|
|
149800
149619
|
}
|
|
149801
149620
|
getNeighboringNodes(node) {
|
|
149802
149621
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -149804,12 +149623,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149804
149623
|
getCapacityPaths() {
|
|
149805
149624
|
const capacityPaths = [];
|
|
149806
149625
|
for (const connection of this.connectionsWithNodes) {
|
|
149807
|
-
const
|
|
149808
|
-
if (
|
|
149626
|
+
const path33 = connection.path;
|
|
149627
|
+
if (path33) {
|
|
149809
149628
|
capacityPaths.push({
|
|
149810
149629
|
capacityPathId: connection.connection.name,
|
|
149811
149630
|
connectionName: connection.connection.name,
|
|
149812
|
-
nodeIds:
|
|
149631
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
149813
149632
|
});
|
|
149814
149633
|
}
|
|
149815
149634
|
}
|
|
@@ -150494,10 +150313,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150494
150313
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
150495
150314
|
}
|
|
150496
150315
|
getBacktrackedPath(candidate) {
|
|
150497
|
-
const
|
|
150316
|
+
const path33 = [];
|
|
150498
150317
|
let currentCandidate = candidate;
|
|
150499
150318
|
while (currentCandidate) {
|
|
150500
|
-
|
|
150319
|
+
path33.push(currentCandidate.node);
|
|
150501
150320
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
150502
150321
|
currentCandidate = currentCandidate.prevCandidate;
|
|
150503
150322
|
} else {
|
|
@@ -150505,7 +150324,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150505
150324
|
break;
|
|
150506
150325
|
}
|
|
150507
150326
|
}
|
|
150508
|
-
return
|
|
150327
|
+
return path33.reverse();
|
|
150509
150328
|
}
|
|
150510
150329
|
getNeighboringNodes(node) {
|
|
150511
150330
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -150520,8 +150339,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150520
150339
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
150521
150340
|
return true;
|
|
150522
150341
|
}
|
|
150523
|
-
reduceCapacityAlongPath(
|
|
150524
|
-
for (const pathNode of
|
|
150342
|
+
reduceCapacityAlongPath(path33) {
|
|
150343
|
+
for (const pathNode of path33) {
|
|
150525
150344
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
150526
150345
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
150527
150346
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -150650,9 +150469,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150650
150469
|
this.queuedNodes = null;
|
|
150651
150470
|
}
|
|
150652
150471
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
150653
|
-
const
|
|
150654
|
-
currentTerminal.path =
|
|
150655
|
-
this.reduceCapacityAlongPath(
|
|
150472
|
+
const path33 = this.getBacktrackedPath(currentCandidate);
|
|
150473
|
+
currentTerminal.path = path33;
|
|
150474
|
+
this.reduceCapacityAlongPath(path33);
|
|
150656
150475
|
this.currentConnectionIndex++;
|
|
150657
150476
|
this.candidates = null;
|
|
150658
150477
|
this.visitedNodes = null;
|
|
@@ -150701,10 +150520,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150701
150520
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
150702
150521
|
topCandidates.forEach((candidate, index) => {
|
|
150703
150522
|
const opacity = 0.8 * (1 - index / 5);
|
|
150704
|
-
const
|
|
150705
|
-
if (
|
|
150523
|
+
const path33 = this.getBacktrackedPath(candidate);
|
|
150524
|
+
if (path33.length > 0) {
|
|
150706
150525
|
baseGraphics.lines.push({
|
|
150707
|
-
points:
|
|
150526
|
+
points: path33.map(({ center: { x, y } }) => ({ x, y })),
|
|
150708
150527
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
150709
150528
|
strokeWidth: 0.05
|
|
150710
150529
|
});
|
|
@@ -151393,12 +151212,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
151393
151212
|
getCapacityPaths() {
|
|
151394
151213
|
const capacityPaths = [];
|
|
151395
151214
|
for (const connection of this.connectionsWithNodes) {
|
|
151396
|
-
const
|
|
151397
|
-
if (
|
|
151215
|
+
const path33 = connection.path;
|
|
151216
|
+
if (path33) {
|
|
151398
151217
|
capacityPaths.push({
|
|
151399
151218
|
capacityPathId: connection.connection.name,
|
|
151400
151219
|
connectionName: connection.connection.name,
|
|
151401
|
-
nodeIds:
|
|
151220
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
151402
151221
|
});
|
|
151403
151222
|
}
|
|
151404
151223
|
}
|
|
@@ -152419,22 +152238,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
152419
152238
|
return null;
|
|
152420
152239
|
}
|
|
152421
152240
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
152422
|
-
for (const
|
|
152423
|
-
const fullPath =
|
|
152241
|
+
for (const path33 of possiblePaths) {
|
|
152242
|
+
const fullPath = path33.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
152424
152243
|
if (this.isValidPath(fullPath)) {
|
|
152425
152244
|
return fullPath;
|
|
152426
152245
|
}
|
|
152427
152246
|
}
|
|
152428
152247
|
return null;
|
|
152429
152248
|
}
|
|
152430
|
-
addPathToResult(
|
|
152431
|
-
if (
|
|
152249
|
+
addPathToResult(path33) {
|
|
152250
|
+
if (path33.length === 0)
|
|
152432
152251
|
return;
|
|
152433
|
-
for (let i = 0;i <
|
|
152434
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
152252
|
+
for (let i = 0;i < path33.length; i++) {
|
|
152253
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path33[i])) {
|
|
152435
152254
|
continue;
|
|
152436
152255
|
}
|
|
152437
|
-
this.newRoute.push(
|
|
152256
|
+
this.newRoute.push(path33[i]);
|
|
152438
152257
|
}
|
|
152439
152258
|
this.currentStepSize = this.maxStepSize;
|
|
152440
152259
|
}
|
|
@@ -175367,7 +175186,7 @@ __export3(components_exports, {
|
|
|
175367
175186
|
Diode: () => Diode,
|
|
175368
175187
|
FabricationNotePath: () => FabricationNotePath,
|
|
175369
175188
|
FabricationNoteText: () => FabricationNoteText,
|
|
175370
|
-
Footprint: () =>
|
|
175189
|
+
Footprint: () => Footprint2,
|
|
175371
175190
|
Fuse: () => Fuse2,
|
|
175372
175191
|
Group: () => Group,
|
|
175373
175192
|
Hole: () => Hole,
|
|
@@ -178482,7 +178301,7 @@ var getAllDimensionsForSchematicBox = (params2) => {
|
|
|
178482
178301
|
};
|
|
178483
178302
|
};
|
|
178484
178303
|
var debug222 = (0, import_debug92.default)("tscircuit:core:footprint");
|
|
178485
|
-
var
|
|
178304
|
+
var Footprint2 = class extends PrimitiveComponent2 {
|
|
178486
178305
|
get config() {
|
|
178487
178306
|
return {
|
|
178488
178307
|
componentName: "Footprint",
|
|
@@ -179841,7 +179660,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179841
179660
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
179842
179661
|
const start = portsWithPosition[i];
|
|
179843
179662
|
const end = portsWithPosition[i + 1];
|
|
179844
|
-
const
|
|
179663
|
+
const path33 = calculateElbow({
|
|
179845
179664
|
x: start.position.x,
|
|
179846
179665
|
y: start.position.y,
|
|
179847
179666
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -179850,8 +179669,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179850
179669
|
y: end.position.y,
|
|
179851
179670
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
179852
179671
|
});
|
|
179853
|
-
for (let j4 = 0;j4 <
|
|
179854
|
-
elbowEdges.push({ from:
|
|
179672
|
+
for (let j4 = 0;j4 < path33.length - 1; j4++) {
|
|
179673
|
+
elbowEdges.push({ from: path33[j4], to: path33[j4 + 1] });
|
|
179855
179674
|
}
|
|
179856
179675
|
}
|
|
179857
179676
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -186039,8 +185858,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
186039
185858
|
*/
|
|
186040
185859
|
|
|
186041
185860
|
// lib/import/import-component-from-jlcpcb.ts
|
|
186042
|
-
import
|
|
186043
|
-
import
|
|
185861
|
+
import fs32 from "node:fs/promises";
|
|
185862
|
+
import path33 from "node:path";
|
|
186044
185863
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
186045
185864
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
186046
185865
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -186048,10 +185867,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
186048
185867
|
if (!fileName) {
|
|
186049
185868
|
throw new Error("Could not determine file name of converted component");
|
|
186050
185869
|
}
|
|
186051
|
-
const importsDir =
|
|
186052
|
-
await
|
|
186053
|
-
const filePath =
|
|
186054
|
-
await
|
|
185870
|
+
const importsDir = path33.join(projectDir, "imports");
|
|
185871
|
+
await fs32.mkdir(importsDir, { recursive: true });
|
|
185872
|
+
const filePath = path33.join(importsDir, `${fileName}.tsx`);
|
|
185873
|
+
await fs32.writeFile(filePath, tsx);
|
|
186055
185874
|
return { filePath };
|
|
186056
185875
|
};
|
|
186057
185876
|
|
|
@@ -187416,12 +187235,12 @@ var registerRemove = (program3) => {
|
|
|
187416
187235
|
};
|
|
187417
187236
|
|
|
187418
187237
|
// cli/build/register.ts
|
|
187419
|
-
import
|
|
187420
|
-
import
|
|
187238
|
+
import path42 from "node:path";
|
|
187239
|
+
import fs41 from "node:fs";
|
|
187421
187240
|
|
|
187422
187241
|
// cli/build/build-file.ts
|
|
187423
|
-
import
|
|
187424
|
-
import
|
|
187242
|
+
import path34 from "node:path";
|
|
187243
|
+
import fs33 from "node:fs";
|
|
187425
187244
|
|
|
187426
187245
|
// lib/shared/circuit-json-diagnostics.ts
|
|
187427
187246
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -187483,9 +187302,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
187483
187302
|
filePath: input,
|
|
187484
187303
|
platformConfig: completePlatformConfig
|
|
187485
187304
|
});
|
|
187486
|
-
|
|
187487
|
-
|
|
187488
|
-
console.log(`Circuit JSON written to ${
|
|
187305
|
+
fs33.mkdirSync(path34.dirname(output), { recursive: true });
|
|
187306
|
+
fs33.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
187307
|
+
console.log(`Circuit JSON written to ${path34.relative(projectDir, output)}`);
|
|
187489
187308
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
187490
187309
|
if (!options?.ignoreWarnings) {
|
|
187491
187310
|
for (const warn of warnings) {
|
|
@@ -187524,7 +187343,7 @@ var logTsxExtensionHint = (error, entryFilePath) => {
|
|
|
187524
187343
|
const isAggregateError = error instanceof AggregateError || String(error).includes("AggregateError");
|
|
187525
187344
|
if (!isTsEntry || !isAggregateError)
|
|
187526
187345
|
return;
|
|
187527
|
-
const entryFileName =
|
|
187346
|
+
const entryFileName = path34.basename(entryFilePath);
|
|
187528
187347
|
console.error([
|
|
187529
187348
|
"",
|
|
187530
187349
|
`It looks like "${entryFileName}" is a ".ts" file. tscircuit component files must use the ".tsx" extension.`,
|
|
@@ -187539,7 +187358,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187539
187358
|
if (!match)
|
|
187540
187359
|
return;
|
|
187541
187360
|
const [, exportName, fromSpecifier] = match;
|
|
187542
|
-
const entryFileName =
|
|
187361
|
+
const entryFileName = path34.basename(entryFilePath);
|
|
187543
187362
|
console.error([
|
|
187544
187363
|
"",
|
|
187545
187364
|
`It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
|
|
@@ -187552,20 +187371,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187552
187371
|
};
|
|
187553
187372
|
|
|
187554
187373
|
// cli/build/get-build-entrypoints.ts
|
|
187555
|
-
import
|
|
187556
|
-
import
|
|
187374
|
+
import fs34 from "node:fs";
|
|
187375
|
+
import path35 from "node:path";
|
|
187557
187376
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
187558
|
-
const relative10 =
|
|
187559
|
-
return relative10 === "" || !relative10.startsWith("..") && !
|
|
187377
|
+
const relative10 = path35.relative(maybeParent, maybeChild);
|
|
187378
|
+
return relative10 === "" || !relative10.startsWith("..") && !path35.isAbsolute(relative10);
|
|
187560
187379
|
};
|
|
187561
187380
|
var findProjectRoot = (startDir) => {
|
|
187562
187381
|
let currentDir = startDir;
|
|
187563
|
-
while (currentDir !==
|
|
187564
|
-
const packageJsonPath =
|
|
187565
|
-
if (
|
|
187382
|
+
while (currentDir !== path35.dirname(currentDir)) {
|
|
187383
|
+
const packageJsonPath = path35.join(currentDir, "package.json");
|
|
187384
|
+
if (fs34.existsSync(packageJsonPath)) {
|
|
187566
187385
|
return currentDir;
|
|
187567
187386
|
}
|
|
187568
|
-
currentDir =
|
|
187387
|
+
currentDir = path35.dirname(currentDir);
|
|
187569
187388
|
}
|
|
187570
187389
|
return startDir;
|
|
187571
187390
|
};
|
|
@@ -187574,11 +187393,11 @@ async function getBuildEntrypoints({
|
|
|
187574
187393
|
rootDir = process.cwd(),
|
|
187575
187394
|
includeBoardFiles = true
|
|
187576
187395
|
}) {
|
|
187577
|
-
const resolvedRoot =
|
|
187396
|
+
const resolvedRoot = path35.resolve(rootDir);
|
|
187578
187397
|
const includeBoardFilePatterns = includeBoardFiles ? getBoardFilePatterns(resolvedRoot) : [];
|
|
187579
187398
|
const buildFromProjectDir = async () => {
|
|
187580
187399
|
const projectConfig = loadProjectConfig(resolvedRoot);
|
|
187581
|
-
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ?
|
|
187400
|
+
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig.previewComponentPath) : undefined;
|
|
187582
187401
|
if (includeBoardFiles) {
|
|
187583
187402
|
const files = findBoardFiles({ projectDir: resolvedRoot });
|
|
187584
187403
|
if (files.length > 0) {
|
|
@@ -187613,10 +187432,10 @@ async function getBuildEntrypoints({
|
|
|
187613
187432
|
};
|
|
187614
187433
|
};
|
|
187615
187434
|
if (fileOrDir) {
|
|
187616
|
-
const resolved =
|
|
187617
|
-
if (
|
|
187435
|
+
const resolved = path35.resolve(resolvedRoot, fileOrDir);
|
|
187436
|
+
if (fs34.existsSync(resolved) && fs34.statSync(resolved).isDirectory()) {
|
|
187618
187437
|
const projectConfig2 = loadProjectConfig(resolvedRoot);
|
|
187619
|
-
const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ?
|
|
187438
|
+
const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig2.previewComponentPath) : undefined;
|
|
187620
187439
|
if (includeBoardFiles) {
|
|
187621
187440
|
const circuitFiles = findBoardFiles({
|
|
187622
187441
|
projectDir: resolvedRoot,
|
|
@@ -187648,10 +187467,10 @@ async function getBuildEntrypoints({
|
|
|
187648
187467
|
circuitFiles: mainEntrypoint ? [mainEntrypoint] : []
|
|
187649
187468
|
};
|
|
187650
187469
|
}
|
|
187651
|
-
const fileDir =
|
|
187470
|
+
const fileDir = path35.dirname(resolved);
|
|
187652
187471
|
const projectDir = findProjectRoot(fileDir);
|
|
187653
187472
|
const projectConfig = loadProjectConfig(projectDir);
|
|
187654
|
-
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ?
|
|
187473
|
+
const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(projectDir, projectConfig.previewComponentPath) : undefined;
|
|
187655
187474
|
return {
|
|
187656
187475
|
projectDir,
|
|
187657
187476
|
previewComponentPath: resolvedPreviewComponentPath,
|
|
@@ -187693,8 +187512,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
187693
187512
|
};
|
|
187694
187513
|
|
|
187695
187514
|
// cli/build/build-preview-images.ts
|
|
187696
|
-
import
|
|
187697
|
-
import
|
|
187515
|
+
import fs35 from "node:fs";
|
|
187516
|
+
import path36 from "node:path";
|
|
187698
187517
|
import {
|
|
187699
187518
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
187700
187519
|
convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
|
|
@@ -187770,21 +187589,21 @@ var generatePreviewAssets = async ({
|
|
|
187770
187589
|
outputDir,
|
|
187771
187590
|
distDir
|
|
187772
187591
|
}) => {
|
|
187773
|
-
const prefixRelative =
|
|
187592
|
+
const prefixRelative = path36.relative(distDir, outputDir) || ".";
|
|
187774
187593
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
187775
187594
|
let circuitJson;
|
|
187776
187595
|
try {
|
|
187777
|
-
const circuitJsonRaw =
|
|
187596
|
+
const circuitJsonRaw = fs35.readFileSync(build.outputPath, "utf-8");
|
|
187778
187597
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
187779
187598
|
} catch (error) {
|
|
187780
187599
|
console.error(`${prefix}Failed to read circuit JSON:`, error);
|
|
187781
187600
|
return;
|
|
187782
187601
|
}
|
|
187783
|
-
|
|
187602
|
+
fs35.mkdirSync(outputDir, { recursive: true });
|
|
187784
187603
|
try {
|
|
187785
187604
|
console.log(`${prefix}Generating PCB SVG...`);
|
|
187786
187605
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
187787
|
-
|
|
187606
|
+
fs35.writeFileSync(path36.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
187788
187607
|
console.log(`${prefix}Written pcb.svg`);
|
|
187789
187608
|
} catch (error) {
|
|
187790
187609
|
console.error(`${prefix}Failed to generate PCB SVG:`, error);
|
|
@@ -187792,7 +187611,7 @@ var generatePreviewAssets = async ({
|
|
|
187792
187611
|
try {
|
|
187793
187612
|
console.log(`${prefix}Generating schematic SVG...`);
|
|
187794
187613
|
const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
|
|
187795
|
-
|
|
187614
|
+
fs35.writeFileSync(path36.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
187796
187615
|
console.log(`${prefix}Written schematic.svg`);
|
|
187797
187616
|
} catch (error) {
|
|
187798
187617
|
console.error(`${prefix}Failed to generate schematic SVG:`, error);
|
|
@@ -187809,7 +187628,7 @@ var generatePreviewAssets = async ({
|
|
|
187809
187628
|
camPos: [10, 10, 10],
|
|
187810
187629
|
lookAt: [0, 0, 0]
|
|
187811
187630
|
});
|
|
187812
|
-
|
|
187631
|
+
fs35.writeFileSync(path36.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
187813
187632
|
console.log(`${prefix}Written 3d.png`);
|
|
187814
187633
|
} catch (error) {
|
|
187815
187634
|
console.error(`${prefix}Failed to generate 3D PNG:`, error);
|
|
@@ -187824,14 +187643,14 @@ var buildPreviewImages = async ({
|
|
|
187824
187643
|
}) => {
|
|
187825
187644
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
187826
187645
|
const previewEntrypoint = previewComponentPath || mainEntrypoint;
|
|
187827
|
-
const resolvedPreviewEntrypoint = previewEntrypoint ?
|
|
187646
|
+
const resolvedPreviewEntrypoint = previewEntrypoint ? path36.resolve(previewEntrypoint) : undefined;
|
|
187828
187647
|
if (allImages) {
|
|
187829
187648
|
if (successfulBuilds.length === 0) {
|
|
187830
187649
|
console.warn("No successful build output available for preview image generation.");
|
|
187831
187650
|
return;
|
|
187832
187651
|
}
|
|
187833
187652
|
for (const build of successfulBuilds) {
|
|
187834
|
-
const outputDir =
|
|
187653
|
+
const outputDir = path36.dirname(build.outputPath);
|
|
187835
187654
|
await generatePreviewAssets({
|
|
187836
187655
|
build,
|
|
187837
187656
|
outputDir,
|
|
@@ -187842,7 +187661,7 @@ var buildPreviewImages = async ({
|
|
|
187842
187661
|
}
|
|
187843
187662
|
const previewBuild = (() => {
|
|
187844
187663
|
if (resolvedPreviewEntrypoint) {
|
|
187845
|
-
const match = successfulBuilds.find((built) =>
|
|
187664
|
+
const match = successfulBuilds.find((built) => path36.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
|
|
187846
187665
|
if (match)
|
|
187847
187666
|
return match;
|
|
187848
187667
|
}
|
|
@@ -187860,8 +187679,8 @@ var buildPreviewImages = async ({
|
|
|
187860
187679
|
};
|
|
187861
187680
|
|
|
187862
187681
|
// cli/build/build-preview-gltf.ts
|
|
187863
|
-
import
|
|
187864
|
-
import
|
|
187682
|
+
import fs36 from "node:fs";
|
|
187683
|
+
import path37 from "node:path";
|
|
187865
187684
|
import { convertCircuitJsonToGltf as convertCircuitJsonToGltf3 } from "circuit-json-to-gltf";
|
|
187866
187685
|
var buildPreviewGltf = async ({
|
|
187867
187686
|
builtFiles,
|
|
@@ -187871,10 +187690,10 @@ var buildPreviewGltf = async ({
|
|
|
187871
187690
|
}) => {
|
|
187872
187691
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
187873
187692
|
const previewEntrypoint = previewComponentPath || mainEntrypoint;
|
|
187874
|
-
const resolvedPreviewEntrypoint = previewEntrypoint ?
|
|
187693
|
+
const resolvedPreviewEntrypoint = previewEntrypoint ? path37.resolve(previewEntrypoint) : undefined;
|
|
187875
187694
|
const previewBuild = (() => {
|
|
187876
187695
|
if (resolvedPreviewEntrypoint) {
|
|
187877
|
-
const match = successfulBuilds.find((built) =>
|
|
187696
|
+
const match = successfulBuilds.find((built) => path37.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
|
|
187878
187697
|
if (match)
|
|
187879
187698
|
return match;
|
|
187880
187699
|
}
|
|
@@ -187886,16 +187705,16 @@ var buildPreviewGltf = async ({
|
|
|
187886
187705
|
}
|
|
187887
187706
|
let circuitJson;
|
|
187888
187707
|
try {
|
|
187889
|
-
const circuitJsonRaw =
|
|
187708
|
+
const circuitJsonRaw = fs36.readFileSync(previewBuild.outputPath, "utf-8");
|
|
187890
187709
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
187891
187710
|
} catch (error) {
|
|
187892
187711
|
console.error("Failed to read circuit JSON:", error);
|
|
187893
187712
|
return;
|
|
187894
187713
|
}
|
|
187895
187714
|
const sourcePath = previewBuild.sourcePath;
|
|
187896
|
-
const sourceBasename =
|
|
187715
|
+
const sourceBasename = path37.basename(sourcePath);
|
|
187897
187716
|
const gltfFilename = sourceBasename.replace(/(\.(board|circuit))?\.tsx?$/, ".gltf");
|
|
187898
|
-
const outputPath =
|
|
187717
|
+
const outputPath = path37.join(distDir, gltfFilename);
|
|
187899
187718
|
try {
|
|
187900
187719
|
console.log("Converting circuit to GLTF...");
|
|
187901
187720
|
const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
|
|
@@ -187903,7 +187722,7 @@ var buildPreviewGltf = async ({
|
|
|
187903
187722
|
format: "gltf"
|
|
187904
187723
|
});
|
|
187905
187724
|
const gltfContent = JSON.stringify(gltfData, null, 2);
|
|
187906
|
-
|
|
187725
|
+
fs36.writeFileSync(outputPath, gltfContent, "utf-8");
|
|
187907
187726
|
console.log(`Written ${gltfFilename}`);
|
|
187908
187727
|
} catch (error) {
|
|
187909
187728
|
console.error("Failed to generate GLTF:", error);
|
|
@@ -187911,8 +187730,8 @@ var buildPreviewGltf = async ({
|
|
|
187911
187730
|
};
|
|
187912
187731
|
|
|
187913
187732
|
// cli/build/generate-kicad-project.ts
|
|
187914
|
-
import
|
|
187915
|
-
import
|
|
187733
|
+
import fs37 from "node:fs";
|
|
187734
|
+
import path38 from "node:path";
|
|
187916
187735
|
var createKicadProContent = ({
|
|
187917
187736
|
projectName,
|
|
187918
187737
|
schematicFileName,
|
|
@@ -187952,10 +187771,10 @@ var generateKicadProject = async ({
|
|
|
187952
187771
|
boardFileName
|
|
187953
187772
|
});
|
|
187954
187773
|
if (writeFiles) {
|
|
187955
|
-
|
|
187956
|
-
|
|
187957
|
-
|
|
187958
|
-
|
|
187774
|
+
fs37.mkdirSync(outputDir, { recursive: true });
|
|
187775
|
+
fs37.writeFileSync(path38.join(outputDir, schematicFileName), schContent);
|
|
187776
|
+
fs37.writeFileSync(path38.join(outputDir, boardFileName), pcbContent);
|
|
187777
|
+
fs37.writeFileSync(path38.join(outputDir, projectFileName), proContent);
|
|
187959
187778
|
}
|
|
187960
187779
|
return {
|
|
187961
187780
|
pcbContent,
|
|
@@ -187967,8 +187786,8 @@ var generateKicadProject = async ({
|
|
|
187967
187786
|
};
|
|
187968
187787
|
|
|
187969
187788
|
// cli/build/transpile/index.ts
|
|
187970
|
-
import
|
|
187971
|
-
import
|
|
187789
|
+
import path40 from "node:path";
|
|
187790
|
+
import fs39 from "node:fs";
|
|
187972
187791
|
import { rollup } from "rollup";
|
|
187973
187792
|
import typescript from "@rollup/plugin-typescript";
|
|
187974
187793
|
import resolve11 from "@rollup/plugin-node-resolve";
|
|
@@ -187977,11 +187796,11 @@ import json from "@rollup/plugin-json";
|
|
|
187977
187796
|
import dts from "rollup-plugin-dts";
|
|
187978
187797
|
|
|
187979
187798
|
// cli/build/transpile/static-asset-plugin.ts
|
|
187980
|
-
import
|
|
187981
|
-
import
|
|
187799
|
+
import fs38 from "node:fs";
|
|
187800
|
+
import path39 from "node:path";
|
|
187982
187801
|
import { createHash } from "node:crypto";
|
|
187983
187802
|
function normalizePathSeparators(filePath) {
|
|
187984
|
-
return filePath.split(
|
|
187803
|
+
return filePath.split(path39.sep).join("/");
|
|
187985
187804
|
}
|
|
187986
187805
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
187987
187806
|
".glb",
|
|
@@ -188012,24 +187831,24 @@ var createStaticAssetPlugin = ({
|
|
|
188012
187831
|
return {
|
|
188013
187832
|
name: "tsci-static-assets",
|
|
188014
187833
|
resolveId(source, importer) {
|
|
188015
|
-
const ext =
|
|
187834
|
+
const ext = path39.extname(source).toLowerCase();
|
|
188016
187835
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
188017
187836
|
return null;
|
|
188018
|
-
if (
|
|
188019
|
-
return
|
|
187837
|
+
if (path39.isAbsolute(source)) {
|
|
187838
|
+
return fs38.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
188020
187839
|
}
|
|
188021
187840
|
if (importer) {
|
|
188022
|
-
const importerNative = importer.split("/").join(
|
|
188023
|
-
const resolvedFromImporter =
|
|
188024
|
-
if (
|
|
187841
|
+
const importerNative = importer.split("/").join(path39.sep);
|
|
187842
|
+
const resolvedFromImporter = path39.resolve(path39.dirname(importerNative), source);
|
|
187843
|
+
if (fs38.existsSync(resolvedFromImporter)) {
|
|
188025
187844
|
return {
|
|
188026
187845
|
id: normalizePathSeparators(resolvedFromImporter),
|
|
188027
187846
|
external: true
|
|
188028
187847
|
};
|
|
188029
187848
|
}
|
|
188030
187849
|
}
|
|
188031
|
-
const resolvedFromProject =
|
|
188032
|
-
if (
|
|
187850
|
+
const resolvedFromProject = path39.resolve(resolvedBaseUrl, source);
|
|
187851
|
+
if (fs38.existsSync(resolvedFromProject)) {
|
|
188033
187852
|
return {
|
|
188034
187853
|
id: normalizePathSeparators(resolvedFromProject),
|
|
188035
187854
|
external: true
|
|
@@ -188042,8 +187861,8 @@ var createStaticAssetPlugin = ({
|
|
|
188042
187861
|
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
188043
187862
|
for (const target of targets) {
|
|
188044
187863
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
188045
|
-
const resolvedTarget =
|
|
188046
|
-
if (
|
|
187864
|
+
const resolvedTarget = path39.resolve(resolvedBaseUrl, targetPath);
|
|
187865
|
+
if (fs38.existsSync(resolvedTarget)) {
|
|
188047
187866
|
return {
|
|
188048
187867
|
id: normalizePathSeparators(resolvedTarget),
|
|
188049
187868
|
external: true
|
|
@@ -188069,18 +187888,18 @@ var createStaticAssetPlugin = ({
|
|
|
188069
187888
|
if (chunk.type !== "chunk")
|
|
188070
187889
|
continue;
|
|
188071
187890
|
for (const importedId of chunk.imports) {
|
|
188072
|
-
const ext =
|
|
187891
|
+
const ext = path39.extname(importedId).toLowerCase();
|
|
188073
187892
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
188074
187893
|
continue;
|
|
188075
187894
|
if (!copiedAssets.has(importedId)) {
|
|
188076
|
-
const assetDir =
|
|
188077
|
-
|
|
188078
|
-
const nativePath = importedId.split("/").join(
|
|
188079
|
-
const fileBuffer =
|
|
187895
|
+
const assetDir = path39.join(outputDir, "assets");
|
|
187896
|
+
fs38.mkdirSync(assetDir, { recursive: true });
|
|
187897
|
+
const nativePath = importedId.split("/").join(path39.sep);
|
|
187898
|
+
const fileBuffer = fs38.readFileSync(nativePath);
|
|
188080
187899
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
188081
|
-
const fileName = `${
|
|
188082
|
-
const outputFilePath =
|
|
188083
|
-
|
|
187900
|
+
const fileName = `${path39.basename(importedId, ext)}-${hash}${ext}`;
|
|
187901
|
+
const outputFilePath = path39.join(assetDir, fileName);
|
|
187902
|
+
fs38.writeFileSync(outputFilePath, fileBuffer);
|
|
188084
187903
|
copiedAssets.set(importedId, `./assets/${fileName}`);
|
|
188085
187904
|
assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
|
|
188086
187905
|
}
|
|
@@ -188102,17 +187921,17 @@ function escapeRegExp(string) {
|
|
|
188102
187921
|
|
|
188103
187922
|
// cli/build/transpile/index.ts
|
|
188104
187923
|
var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
188105
|
-
if (id2.startsWith(".") || id2.startsWith("/") ||
|
|
187924
|
+
if (id2.startsWith(".") || id2.startsWith("/") || path40.isAbsolute(id2)) {
|
|
188106
187925
|
return false;
|
|
188107
187926
|
}
|
|
188108
187927
|
let baseUrl = projectDir;
|
|
188109
187928
|
let pathMappings = {};
|
|
188110
|
-
if (tsconfigPath &&
|
|
187929
|
+
if (tsconfigPath && fs39.existsSync(tsconfigPath)) {
|
|
188111
187930
|
try {
|
|
188112
|
-
const tsconfigContent =
|
|
187931
|
+
const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
|
|
188113
187932
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
188114
187933
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
188115
|
-
baseUrl =
|
|
187934
|
+
baseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
188116
187935
|
}
|
|
188117
187936
|
if (tsconfig.compilerOptions?.paths) {
|
|
188118
187937
|
pathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -188126,17 +187945,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
188126
187945
|
}
|
|
188127
187946
|
}
|
|
188128
187947
|
const potentialPaths = [
|
|
188129
|
-
|
|
188130
|
-
|
|
188131
|
-
|
|
188132
|
-
|
|
188133
|
-
|
|
188134
|
-
|
|
188135
|
-
|
|
188136
|
-
|
|
188137
|
-
|
|
187948
|
+
path40.join(baseUrl, id2),
|
|
187949
|
+
path40.join(baseUrl, `${id2}.ts`),
|
|
187950
|
+
path40.join(baseUrl, `${id2}.tsx`),
|
|
187951
|
+
path40.join(baseUrl, `${id2}.js`),
|
|
187952
|
+
path40.join(baseUrl, `${id2}.jsx`),
|
|
187953
|
+
path40.join(baseUrl, id2, "index.ts"),
|
|
187954
|
+
path40.join(baseUrl, id2, "index.tsx"),
|
|
187955
|
+
path40.join(baseUrl, id2, "index.js"),
|
|
187956
|
+
path40.join(baseUrl, id2, "index.jsx")
|
|
188138
187957
|
];
|
|
188139
|
-
if (potentialPaths.some((p) =>
|
|
187958
|
+
if (potentialPaths.some((p) => fs39.existsSync(p))) {
|
|
188140
187959
|
return false;
|
|
188141
187960
|
}
|
|
188142
187961
|
return true;
|
|
@@ -188147,17 +187966,17 @@ var transpileFile = async ({
|
|
|
188147
187966
|
projectDir
|
|
188148
187967
|
}) => {
|
|
188149
187968
|
try {
|
|
188150
|
-
|
|
188151
|
-
const tsconfigPath =
|
|
188152
|
-
const hasTsConfig =
|
|
187969
|
+
fs39.mkdirSync(outputDir, { recursive: true });
|
|
187970
|
+
const tsconfigPath = path40.join(projectDir, "tsconfig.json");
|
|
187971
|
+
const hasTsConfig = fs39.existsSync(tsconfigPath);
|
|
188153
187972
|
let tsconfigBaseUrl = projectDir;
|
|
188154
187973
|
let tsconfigPathMappings;
|
|
188155
187974
|
if (hasTsConfig) {
|
|
188156
187975
|
try {
|
|
188157
|
-
const tsconfigContent =
|
|
187976
|
+
const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
|
|
188158
187977
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
188159
187978
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
188160
|
-
tsconfigBaseUrl =
|
|
187979
|
+
tsconfigBaseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
188161
187980
|
}
|
|
188162
187981
|
if (tsconfig.compilerOptions?.paths) {
|
|
188163
187982
|
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -188212,27 +188031,27 @@ var transpileFile = async ({
|
|
|
188212
188031
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
188213
188032
|
plugins: getPlugins()
|
|
188214
188033
|
});
|
|
188215
|
-
const esmOutputPath =
|
|
188034
|
+
const esmOutputPath = path40.join(outputDir, "index.js");
|
|
188216
188035
|
await esmBundle.write({
|
|
188217
188036
|
file: esmOutputPath,
|
|
188218
188037
|
format: "es",
|
|
188219
188038
|
sourcemap: false
|
|
188220
188039
|
});
|
|
188221
|
-
console.log(`ESM bundle written to ${
|
|
188040
|
+
console.log(`ESM bundle written to ${path40.relative(projectDir, esmOutputPath)}`);
|
|
188222
188041
|
console.log("Building CommonJS bundle...");
|
|
188223
188042
|
const cjsBundle = await rollup({
|
|
188224
188043
|
input,
|
|
188225
188044
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
188226
188045
|
plugins: getPlugins()
|
|
188227
188046
|
});
|
|
188228
|
-
const cjsOutputPath =
|
|
188047
|
+
const cjsOutputPath = path40.join(outputDir, "index.cjs");
|
|
188229
188048
|
console.log("Writing CJS bundle to:", cjsOutputPath);
|
|
188230
188049
|
await cjsBundle.write({
|
|
188231
188050
|
file: cjsOutputPath,
|
|
188232
188051
|
format: "cjs",
|
|
188233
188052
|
sourcemap: false
|
|
188234
188053
|
});
|
|
188235
|
-
console.log(`CommonJS bundle written to ${
|
|
188054
|
+
console.log(`CommonJS bundle written to ${path40.relative(projectDir, cjsOutputPath)}`);
|
|
188236
188055
|
console.log("Generating type declarations...");
|
|
188237
188056
|
const dtsBundle = await rollup({
|
|
188238
188057
|
input,
|
|
@@ -188257,9 +188076,9 @@ var transpileFile = async ({
|
|
|
188257
188076
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
188258
188077
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
188259
188078
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
188260
|
-
const dtsOutputPath =
|
|
188261
|
-
|
|
188262
|
-
console.log(`Type declarations written to ${
|
|
188079
|
+
const dtsOutputPath = path40.join(outputDir, "index.d.ts");
|
|
188080
|
+
fs39.writeFileSync(dtsOutputPath, dtsContent);
|
|
188081
|
+
console.log(`Type declarations written to ${path40.relative(projectDir, dtsOutputPath)}`);
|
|
188263
188082
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
188264
188083
|
return true;
|
|
188265
188084
|
} catch (err) {
|
|
@@ -188272,17 +188091,17 @@ var transpileFile = async ({
|
|
|
188272
188091
|
};
|
|
188273
188092
|
|
|
188274
188093
|
// cli/utils/validate-main-in-dist.ts
|
|
188275
|
-
import
|
|
188276
|
-
import
|
|
188094
|
+
import fs40 from "node:fs";
|
|
188095
|
+
import path41 from "node:path";
|
|
188277
188096
|
var validateMainInDist = (projectDir, distDir) => {
|
|
188278
|
-
const packageJsonPath =
|
|
188279
|
-
if (!
|
|
188097
|
+
const packageJsonPath = path41.join(projectDir, "package.json");
|
|
188098
|
+
if (!fs40.existsSync(packageJsonPath))
|
|
188280
188099
|
return;
|
|
188281
|
-
const packageJson = JSON.parse(
|
|
188100
|
+
const packageJson = JSON.parse(fs40.readFileSync(packageJsonPath, "utf-8"));
|
|
188282
188101
|
if (typeof packageJson.main !== "string")
|
|
188283
188102
|
return;
|
|
188284
|
-
const resolvedMainPath =
|
|
188285
|
-
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${
|
|
188103
|
+
const resolvedMainPath = path41.resolve(projectDir, packageJson.main);
|
|
188104
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path41.sep}`);
|
|
188286
188105
|
if (!isMainInDist) {
|
|
188287
188106
|
console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
188288
188107
|
}
|
|
@@ -188305,7 +188124,7 @@ async function getLatestTscircuitCdnUrl() {
|
|
|
188305
188124
|
|
|
188306
188125
|
// cli/build/register.ts
|
|
188307
188126
|
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("--
|
|
188127
|
+
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
188128
|
try {
|
|
188310
188129
|
const {
|
|
188311
188130
|
projectDir,
|
|
@@ -188327,8 +188146,8 @@ var registerBuild = (program3) => {
|
|
|
188327
188146
|
}
|
|
188328
188147
|
return config;
|
|
188329
188148
|
})();
|
|
188330
|
-
const distDir =
|
|
188331
|
-
|
|
188149
|
+
const distDir = path42.join(projectDir, "dist");
|
|
188150
|
+
fs41.mkdirSync(distDir, { recursive: true });
|
|
188332
188151
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
188333
188152
|
let hasErrors = false;
|
|
188334
188153
|
const staticFileReferences = [];
|
|
@@ -188336,10 +188155,10 @@ var registerBuild = (program3) => {
|
|
|
188336
188155
|
const kicadProjects = [];
|
|
188337
188156
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
188338
188157
|
for (const filePath of circuitFiles) {
|
|
188339
|
-
const relative10 =
|
|
188158
|
+
const relative10 = path42.relative(projectDir, filePath);
|
|
188340
188159
|
console.log(`Building ${relative10}...`);
|
|
188341
188160
|
const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
188342
|
-
const outputPath =
|
|
188161
|
+
const outputPath = path42.join(distDir, outputDirName, "circuit.json");
|
|
188343
188162
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
188344
188163
|
ignoreErrors: options?.ignoreErrors,
|
|
188345
188164
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -188353,17 +188172,17 @@ var registerBuild = (program3) => {
|
|
|
188353
188172
|
if (!buildOutcome.ok) {
|
|
188354
188173
|
hasErrors = true;
|
|
188355
188174
|
} else if (options?.site) {
|
|
188356
|
-
const normalizedSourcePath = relative10.split(
|
|
188357
|
-
const relativeOutputPath =
|
|
188358
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
188175
|
+
const normalizedSourcePath = relative10.split(path42.sep).join("/");
|
|
188176
|
+
const relativeOutputPath = path42.join(outputDirName, "circuit.json");
|
|
188177
|
+
const normalizedOutputPath = relativeOutputPath.split(path42.sep).join("/");
|
|
188359
188178
|
staticFileReferences.push({
|
|
188360
188179
|
filePath: normalizedSourcePath,
|
|
188361
188180
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
188362
188181
|
});
|
|
188363
188182
|
}
|
|
188364
188183
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
188365
|
-
const projectOutputDir =
|
|
188366
|
-
const projectName =
|
|
188184
|
+
const projectOutputDir = path42.join(distDir, outputDirName, "kicad");
|
|
188185
|
+
const projectName = path42.basename(outputDirName);
|
|
188367
188186
|
const project = await generateKicadProject({
|
|
188368
188187
|
circuitJson: buildOutcome.circuitJson,
|
|
188369
188188
|
outputDir: projectOutputDir,
|
|
@@ -188426,23 +188245,13 @@ var registerBuild = (program3) => {
|
|
|
188426
188245
|
if (options?.useCdnJavascript) {
|
|
188427
188246
|
standaloneScriptSrc = await getLatestTscircuitCdnUrl();
|
|
188428
188247
|
} else {
|
|
188429
|
-
|
|
188248
|
+
fs41.writeFileSync(path42.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
188430
188249
|
}
|
|
188431
188250
|
const indexHtml = getStaticIndexHtmlFile({
|
|
188432
188251
|
files: staticFileReferences,
|
|
188433
188252
|
standaloneScriptSrc
|
|
188434
188253
|
});
|
|
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
|
-
}
|
|
188254
|
+
fs41.writeFileSync(path42.join(distDir, "index.html"), indexHtml);
|
|
188446
188255
|
}
|
|
188447
188256
|
const successCount = builtFiles.filter((f) => f.ok).length;
|
|
188448
188257
|
const failCount = builtFiles.length - successCount;
|
|
@@ -188452,7 +188261,6 @@ var registerBuild = (program3) => {
|
|
|
188452
188261
|
options?.previewImages && "preview-images",
|
|
188453
188262
|
options?.allImages && "all-images",
|
|
188454
188263
|
options?.kicad && "kicad",
|
|
188455
|
-
options?.kicadFootprintLibrary && "kicad-footprint-library",
|
|
188456
188264
|
options?.previewGltf && "preview-gltf"
|
|
188457
188265
|
].filter(Boolean);
|
|
188458
188266
|
console.log("");
|
|
@@ -188461,7 +188269,7 @@ var registerBuild = (program3) => {
|
|
|
188461
188269
|
if (enabledOpts.length > 0) {
|
|
188462
188270
|
console.log(` Options ${kleur_default.cyan(enabledOpts.join(", "))}`);
|
|
188463
188271
|
}
|
|
188464
|
-
console.log(` Output ${kleur_default.dim(
|
|
188272
|
+
console.log(` Output ${kleur_default.dim(path42.relative(process.cwd(), distDir) || "dist")}`);
|
|
188465
188273
|
console.log(hasErrors ? kleur_default.yellow(`
|
|
188466
188274
|
⚠ Build completed with errors`) : kleur_default.green(`
|
|
188467
188275
|
✓ Done`));
|
|
@@ -188475,8 +188283,8 @@ var registerBuild = (program3) => {
|
|
|
188475
188283
|
};
|
|
188476
188284
|
|
|
188477
188285
|
// lib/shared/snapshot-project.ts
|
|
188478
|
-
import
|
|
188479
|
-
import
|
|
188286
|
+
import fs43 from "node:fs";
|
|
188287
|
+
import path43 from "node:path";
|
|
188480
188288
|
import looksSame2 from "looks-same";
|
|
188481
188289
|
import {
|
|
188482
188290
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -188487,7 +188295,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
188487
188295
|
|
|
188488
188296
|
// lib/shared/compare-images.ts
|
|
188489
188297
|
import looksSame from "looks-same";
|
|
188490
|
-
import
|
|
188298
|
+
import fs42 from "node:fs/promises";
|
|
188491
188299
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
188492
188300
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
188493
188301
|
strict: false,
|
|
@@ -188503,7 +188311,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
188503
188311
|
tolerance: 2
|
|
188504
188312
|
});
|
|
188505
188313
|
} else {
|
|
188506
|
-
await
|
|
188314
|
+
await fs42.writeFile(diffPath, buffer2);
|
|
188507
188315
|
}
|
|
188508
188316
|
}
|
|
188509
188317
|
return { equal: equal2 };
|
|
@@ -188528,7 +188336,7 @@ var snapshotProject = async ({
|
|
|
188528
188336
|
...DEFAULT_IGNORED_PATTERNS,
|
|
188529
188337
|
...ignored.map(normalizeIgnorePattern)
|
|
188530
188338
|
];
|
|
188531
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
188339
|
+
const resolvedPaths = filePaths.map((f) => path43.resolve(projectDir, f));
|
|
188532
188340
|
const boardFiles = findBoardFiles({
|
|
188533
188341
|
projectDir,
|
|
188534
188342
|
ignore,
|
|
@@ -188542,7 +188350,7 @@ var snapshotProject = async ({
|
|
|
188542
188350
|
const mismatches = [];
|
|
188543
188351
|
let didUpdate = false;
|
|
188544
188352
|
for (const file of boardFiles) {
|
|
188545
|
-
const relativeFilePath =
|
|
188353
|
+
const relativeFilePath = path43.relative(projectDir, file);
|
|
188546
188354
|
let circuitJson;
|
|
188547
188355
|
let pcbSvg;
|
|
188548
188356
|
let schSvg;
|
|
@@ -188597,17 +188405,17 @@ var snapshotProject = async ({
|
|
|
188597
188405
|
} catch (error) {
|
|
188598
188406
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
188599
188407
|
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 =
|
|
188408
|
+
const fileDir = path43.dirname(file);
|
|
188409
|
+
const relativeDir = path43.relative(projectDir, fileDir);
|
|
188410
|
+
const snapDir2 = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, relativeDir) : path43.join(fileDir, "__snapshots__");
|
|
188411
|
+
const base2 = path43.basename(file).replace(/\.tsx$/, "");
|
|
188412
|
+
const snap3dPath = path43.join(snapDir2, `${base2}-3d.snap.png`);
|
|
188413
|
+
const existing3dSnapshot = fs43.existsSync(snap3dPath);
|
|
188606
188414
|
if (existing3dSnapshot) {
|
|
188607
188415
|
onError(kleur_default.red(`
|
|
188608
188416
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
188609
188417
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
188610
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
188418
|
+
`) + kleur_default.red(` Existing snapshot: ${path43.relative(projectDir, snap3dPath)}
|
|
188611
188419
|
`));
|
|
188612
188420
|
return onExit2(1);
|
|
188613
188421
|
} else {
|
|
@@ -188623,9 +188431,9 @@ var snapshotProject = async ({
|
|
|
188623
188431
|
}
|
|
188624
188432
|
}
|
|
188625
188433
|
}
|
|
188626
|
-
const snapDir = snapshotsDirName ?
|
|
188627
|
-
|
|
188628
|
-
const base =
|
|
188434
|
+
const snapDir = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, path43.relative(projectDir, path43.dirname(file))) : path43.join(path43.dirname(file), "__snapshots__");
|
|
188435
|
+
fs43.mkdirSync(snapDir, { recursive: true });
|
|
188436
|
+
const base = path43.basename(file).replace(/\.tsx$/, "");
|
|
188629
188437
|
const snapshots = [];
|
|
188630
188438
|
if (pcbOnly || !schematicOnly) {
|
|
188631
188439
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -188643,31 +188451,31 @@ var snapshotProject = async ({
|
|
|
188643
188451
|
for (const snapshot of snapshots) {
|
|
188644
188452
|
const { type } = snapshot;
|
|
188645
188453
|
const is3d = type === "3d";
|
|
188646
|
-
const snapPath =
|
|
188647
|
-
const existing =
|
|
188454
|
+
const snapPath = path43.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
188455
|
+
const existing = fs43.existsSync(snapPath);
|
|
188648
188456
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
188649
188457
|
const newContentForFile = snapshot.content;
|
|
188650
188458
|
if (!existing) {
|
|
188651
|
-
|
|
188652
|
-
console.log("✅", kleur_default.gray(
|
|
188459
|
+
fs43.writeFileSync(snapPath, newContentForFile);
|
|
188460
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188653
188461
|
didUpdate = true;
|
|
188654
188462
|
continue;
|
|
188655
188463
|
}
|
|
188656
|
-
const oldContentBuffer =
|
|
188464
|
+
const oldContentBuffer = fs43.readFileSync(snapPath);
|
|
188657
188465
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
188658
188466
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
188659
188467
|
if (update) {
|
|
188660
188468
|
if (!forceUpdate && equal2) {
|
|
188661
|
-
console.log("✅", kleur_default.gray(
|
|
188469
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188662
188470
|
} else {
|
|
188663
|
-
|
|
188664
|
-
console.log("✅", kleur_default.gray(
|
|
188471
|
+
fs43.writeFileSync(snapPath, newContentForFile);
|
|
188472
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188665
188473
|
didUpdate = true;
|
|
188666
188474
|
}
|
|
188667
188475
|
} else if (!equal2) {
|
|
188668
188476
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
188669
188477
|
} else {
|
|
188670
|
-
console.log("✅", kleur_default.gray(
|
|
188478
|
+
console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
|
|
188671
188479
|
}
|
|
188672
188480
|
}
|
|
188673
188481
|
}
|
|
@@ -188706,22 +188514,22 @@ var registerSnapshot = (program3) => {
|
|
|
188706
188514
|
};
|
|
188707
188515
|
|
|
188708
188516
|
// lib/shared/setup-github-actions.ts
|
|
188709
|
-
import
|
|
188710
|
-
import
|
|
188517
|
+
import fs44 from "node:fs";
|
|
188518
|
+
import path44 from "node:path";
|
|
188711
188519
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
188712
188520
|
const findGitRoot = (startDir) => {
|
|
188713
|
-
let dir =
|
|
188714
|
-
while (dir !==
|
|
188715
|
-
if (
|
|
188521
|
+
let dir = path44.resolve(startDir);
|
|
188522
|
+
while (dir !== path44.parse(dir).root) {
|
|
188523
|
+
if (fs44.existsSync(path44.join(dir, ".git"))) {
|
|
188716
188524
|
return dir;
|
|
188717
188525
|
}
|
|
188718
|
-
dir =
|
|
188526
|
+
dir = path44.dirname(dir);
|
|
188719
188527
|
}
|
|
188720
188528
|
return null;
|
|
188721
188529
|
};
|
|
188722
188530
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
188723
|
-
const workflowsDir =
|
|
188724
|
-
|
|
188531
|
+
const workflowsDir = path44.join(gitRoot, ".github", "workflows");
|
|
188532
|
+
fs44.mkdirSync(workflowsDir, { recursive: true });
|
|
188725
188533
|
const buildWorkflow = `name: tscircuit Build
|
|
188726
188534
|
|
|
188727
188535
|
on:
|
|
@@ -188760,8 +188568,8 @@ jobs:
|
|
|
188760
188568
|
- run: bun install
|
|
188761
188569
|
- run: bunx tsci snapshot
|
|
188762
188570
|
`;
|
|
188763
|
-
writeFileIfNotExists(
|
|
188764
|
-
writeFileIfNotExists(
|
|
188571
|
+
writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
188572
|
+
writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
188765
188573
|
};
|
|
188766
188574
|
|
|
188767
188575
|
// cli/setup/register.ts
|
|
@@ -188799,8 +188607,8 @@ function registerAuthSetupNpmrc(program3) {
|
|
|
188799
188607
|
}
|
|
188800
188608
|
|
|
188801
188609
|
// cli/convert/register.ts
|
|
188802
|
-
import
|
|
188803
|
-
import
|
|
188610
|
+
import fs45 from "node:fs/promises";
|
|
188611
|
+
import path45 from "node:path";
|
|
188804
188612
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
188805
188613
|
|
|
188806
188614
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -188920,15 +188728,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
188920
188728
|
var registerConvert = (program3) => {
|
|
188921
188729
|
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
188730
|
try {
|
|
188923
|
-
const inputPath =
|
|
188924
|
-
const modContent = await
|
|
188731
|
+
const inputPath = path45.resolve(file);
|
|
188732
|
+
const modContent = await fs45.readFile(inputPath, "utf-8");
|
|
188925
188733
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
188926
|
-
const componentName = options.name ??
|
|
188734
|
+
const componentName = options.name ?? path45.basename(inputPath, ".kicad_mod");
|
|
188927
188735
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
188928
188736
|
componentName
|
|
188929
188737
|
});
|
|
188930
|
-
const outputPath = options.output ?
|
|
188931
|
-
await
|
|
188738
|
+
const outputPath = options.output ? path45.resolve(options.output) : path45.join(path45.dirname(inputPath), `${componentName}.tsx`);
|
|
188739
|
+
await fs45.writeFile(outputPath, tsx);
|
|
188932
188740
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
188933
188741
|
} catch (error) {
|
|
188934
188742
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|
|
@@ -189024,12 +188832,12 @@ var registerSimulate = (program3) => {
|
|
|
189024
188832
|
};
|
|
189025
188833
|
|
|
189026
188834
|
// 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
188835
|
import fs47 from "node:fs";
|
|
189032
188836
|
import path47 from "node:path";
|
|
188837
|
+
|
|
188838
|
+
// lib/shared/collect-tsci-dependencies.ts
|
|
188839
|
+
import fs46 from "node:fs";
|
|
188840
|
+
import path46 from "node:path";
|
|
189033
188841
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
189034
188842
|
var DEFAULT_IGNORES = [
|
|
189035
188843
|
"**/node_modules/**",
|
|
@@ -189044,7 +188852,7 @@ function collectTsciDependencies({
|
|
|
189044
188852
|
patterns = DEFAULT_PATTERNS,
|
|
189045
188853
|
ignore = DEFAULT_IGNORES
|
|
189046
188854
|
} = {}) {
|
|
189047
|
-
const searchRoot =
|
|
188855
|
+
const searchRoot = path46.resolve(cwd);
|
|
189048
188856
|
const files = globbySync(patterns, {
|
|
189049
188857
|
cwd: searchRoot,
|
|
189050
188858
|
absolute: true,
|
|
@@ -189054,7 +188862,7 @@ function collectTsciDependencies({
|
|
|
189054
188862
|
const dependencies2 = new Set;
|
|
189055
188863
|
for (const filePath of files) {
|
|
189056
188864
|
try {
|
|
189057
|
-
const fileContents =
|
|
188865
|
+
const fileContents = fs46.readFileSync(filePath, "utf-8");
|
|
189058
188866
|
let match;
|
|
189059
188867
|
while (true) {
|
|
189060
188868
|
match = IMPORT_PATTERN.exec(fileContents);
|
|
@@ -189071,26 +188879,26 @@ function collectTsciDependencies({
|
|
|
189071
188879
|
async function installProjectDependencies({
|
|
189072
188880
|
cwd = process.cwd()
|
|
189073
188881
|
} = {}) {
|
|
189074
|
-
const projectRoot =
|
|
189075
|
-
const packageJsonPath =
|
|
189076
|
-
const npmrcPath =
|
|
188882
|
+
const projectRoot = path47.resolve(cwd);
|
|
188883
|
+
const packageJsonPath = path47.join(projectRoot, "package.json");
|
|
188884
|
+
const npmrcPath = path47.join(projectRoot, ".npmrc");
|
|
189077
188885
|
const packageManager = getPackageManager();
|
|
189078
|
-
if (!
|
|
188886
|
+
if (!fs47.existsSync(projectRoot)) {
|
|
189079
188887
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
189080
188888
|
}
|
|
189081
188889
|
let packageJsonCreated = false;
|
|
189082
|
-
if (!
|
|
188890
|
+
if (!fs47.existsSync(packageJsonPath)) {
|
|
189083
188891
|
console.log("No package.json found. Generating a new one.");
|
|
189084
188892
|
generatePackageJson(projectRoot);
|
|
189085
188893
|
packageJsonCreated = true;
|
|
189086
188894
|
} else {
|
|
189087
188895
|
console.log("Found existing package.json.");
|
|
189088
188896
|
}
|
|
189089
|
-
if (!
|
|
188897
|
+
if (!fs47.existsSync(npmrcPath)) {
|
|
189090
188898
|
console.log("Creating .npmrc with tscircuit registry configuration.");
|
|
189091
|
-
|
|
188899
|
+
fs47.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
|
|
189092
188900
|
}
|
|
189093
|
-
const packageJson = JSON.parse(
|
|
188901
|
+
const packageJson = JSON.parse(fs47.readFileSync(packageJsonPath, "utf-8"));
|
|
189094
188902
|
if (packageJsonCreated) {
|
|
189095
188903
|
const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
|
|
189096
188904
|
if (tsciDependencies.length > 0) {
|
|
@@ -189105,7 +188913,7 @@ async function installProjectDependencies({
|
|
|
189105
188913
|
console.log("No @tsci dependencies detected in circuit files.");
|
|
189106
188914
|
}
|
|
189107
188915
|
}
|
|
189108
|
-
|
|
188916
|
+
fs47.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
189109
188917
|
`);
|
|
189110
188918
|
console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
|
|
189111
188919
|
try {
|
|
@@ -189140,7 +188948,7 @@ var registerInstall = (program3) => {
|
|
|
189140
188948
|
};
|
|
189141
188949
|
|
|
189142
188950
|
// cli/transpile/register.ts
|
|
189143
|
-
import
|
|
188951
|
+
import path48 from "node:path";
|
|
189144
188952
|
var registerTranspile = (program3) => {
|
|
189145
188953
|
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
188954
|
try {
|
|
@@ -189148,7 +188956,7 @@ var registerTranspile = (program3) => {
|
|
|
189148
188956
|
fileOrDir: file,
|
|
189149
188957
|
includeBoardFiles: false
|
|
189150
188958
|
});
|
|
189151
|
-
const distDir =
|
|
188959
|
+
const distDir = path48.join(projectDir, "dist");
|
|
189152
188960
|
validateMainInDist(projectDir, distDir);
|
|
189153
188961
|
console.log("Transpiling entry file...");
|
|
189154
188962
|
const entryFile = mainEntrypoint || circuitFiles[0];
|