@tscircuit/cli 0.1.654 → 0.1.655
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 +417 -405
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -80228,8 +80228,8 @@ Successfully cloned to:`));
|
|
|
80228
80228
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
80229
80229
|
|
|
80230
80230
|
// lib/shared/export-snippet.ts
|
|
80231
|
-
import
|
|
80232
|
-
import
|
|
80231
|
+
import fs28 from "node:fs";
|
|
80232
|
+
import path30 from "node:path";
|
|
80233
80233
|
import { promisify as promisify3 } from "node:util";
|
|
80234
80234
|
|
|
80235
80235
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -83746,8 +83746,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
|
|
|
83746
83746
|
|
|
83747
83747
|
// lib/shared/generate-circuit-json.tsx
|
|
83748
83748
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
83749
|
-
import
|
|
83750
|
-
import
|
|
83749
|
+
import path28 from "node:path";
|
|
83750
|
+
import fs26 from "node:fs";
|
|
83751
83751
|
import { pathToFileURL } from "node:url";
|
|
83752
83752
|
import Debug11 from "debug";
|
|
83753
83753
|
|
|
@@ -83766,20 +83766,32 @@ var abbreviateStringifyObject = (obj) => {
|
|
|
83766
83766
|
};
|
|
83767
83767
|
|
|
83768
83768
|
// lib/shared/importFromUserLand.ts
|
|
83769
|
-
import {
|
|
83769
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
83770
|
+
import fs25 from "node:fs";
|
|
83771
|
+
import path27 from "node:path";
|
|
83770
83772
|
async function importFromUserLand(moduleName) {
|
|
83773
|
+
const userModulePath = path27.join(process.cwd(), "node_modules", moduleName);
|
|
83774
|
+
if (fs25.existsSync(userModulePath)) {
|
|
83775
|
+
const userRequire = createRequire2(path27.join(process.cwd(), "noop.js"));
|
|
83776
|
+
try {
|
|
83777
|
+
const resolvedUserPath = userRequire.resolve(moduleName);
|
|
83778
|
+
return await import(resolvedUserPath);
|
|
83779
|
+
} catch (error) {
|
|
83780
|
+
if (error?.code !== "MODULE_NOT_FOUND") {
|
|
83781
|
+
throw error;
|
|
83782
|
+
}
|
|
83783
|
+
}
|
|
83784
|
+
}
|
|
83785
|
+
const cliRequire = createRequire2(import.meta.url);
|
|
83771
83786
|
try {
|
|
83772
|
-
const
|
|
83773
|
-
return await import(
|
|
83787
|
+
const resolvedCliPath = cliRequire.resolve(moduleName);
|
|
83788
|
+
return await import(resolvedCliPath);
|
|
83774
83789
|
} catch (error) {
|
|
83775
|
-
|
|
83776
|
-
|
|
83777
|
-
return await import(modulePath);
|
|
83778
|
-
} catch (error2) {
|
|
83779
|
-
const module2 = await import(moduleName);
|
|
83780
|
-
return module2;
|
|
83790
|
+
if (error?.code !== "MODULE_NOT_FOUND") {
|
|
83791
|
+
throw error;
|
|
83781
83792
|
}
|
|
83782
83793
|
}
|
|
83794
|
+
return import(moduleName);
|
|
83783
83795
|
}
|
|
83784
83796
|
|
|
83785
83797
|
// lib/shared/generate-circuit-json.tsx
|
|
@@ -83810,12 +83822,12 @@ async function generateCircuitJson({
|
|
|
83810
83822
|
const runner = new userLandTscircuit.RootCircuit({
|
|
83811
83823
|
platform: platformConfig
|
|
83812
83824
|
});
|
|
83813
|
-
const absoluteFilePath =
|
|
83814
|
-
const projectDir =
|
|
83825
|
+
const absoluteFilePath = path28.isAbsolute(filePath) ? filePath : path28.resolve(process.cwd(), filePath);
|
|
83826
|
+
const projectDir = path28.dirname(absoluteFilePath);
|
|
83815
83827
|
const resolvedOutputDir = outputDir ?? projectDir;
|
|
83816
|
-
const relativeComponentPath =
|
|
83817
|
-
const baseFileName = outputFileName ||
|
|
83818
|
-
const outputPath =
|
|
83828
|
+
const relativeComponentPath = path28.relative(projectDir, absoluteFilePath);
|
|
83829
|
+
const baseFileName = outputFileName || path28.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
83830
|
+
const outputPath = path28.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
83819
83831
|
debug11(`Project directory: ${projectDir}`);
|
|
83820
83832
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
83821
83833
|
debug11(`Output path: ${outputPath}`);
|
|
@@ -83835,7 +83847,7 @@ async function generateCircuitJson({
|
|
|
83835
83847
|
return false;
|
|
83836
83848
|
if (normalizedFilePath.match(/^\.[^/]/))
|
|
83837
83849
|
return false;
|
|
83838
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
83850
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path28.extname(normalizedFilePath)))
|
|
83839
83851
|
return false;
|
|
83840
83852
|
return true;
|
|
83841
83853
|
},
|
|
@@ -83853,7 +83865,7 @@ async function generateCircuitJson({
|
|
|
83853
83865
|
const circuitJson = await runner.getCircuitJson();
|
|
83854
83866
|
if (saveToFile) {
|
|
83855
83867
|
debug11(`Saving circuit JSON to ${outputPath}`);
|
|
83856
|
-
|
|
83868
|
+
fs26.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
83857
83869
|
}
|
|
83858
83870
|
return {
|
|
83859
83871
|
circuitJson,
|
|
@@ -83862,8 +83874,8 @@ async function generateCircuitJson({
|
|
|
83862
83874
|
}
|
|
83863
83875
|
|
|
83864
83876
|
// cli/build/generate-kicad-footprint-library.ts
|
|
83865
|
-
import
|
|
83866
|
-
import
|
|
83877
|
+
import fs27 from "node:fs";
|
|
83878
|
+
import path29 from "node:path";
|
|
83867
83879
|
import { At as At2, KicadPcb as KicadPcb2, parseKicadSexpr } from "kicadts";
|
|
83868
83880
|
var sanitizeLibraryAndFootprintName = (libraryLink) => {
|
|
83869
83881
|
if (!libraryLink) {
|
|
@@ -83923,8 +83935,8 @@ var generateKicadFootprintLibrary = async ({
|
|
|
83923
83935
|
projects,
|
|
83924
83936
|
distDir
|
|
83925
83937
|
}) => {
|
|
83926
|
-
const libraryRoot =
|
|
83927
|
-
|
|
83938
|
+
const libraryRoot = path29.join(distDir, "kicad-footprints");
|
|
83939
|
+
fs27.mkdirSync(libraryRoot, { recursive: true });
|
|
83928
83940
|
const uniqueFootprints = new Map;
|
|
83929
83941
|
for (const project of projects) {
|
|
83930
83942
|
try {
|
|
@@ -83947,10 +83959,10 @@ var generateKicadFootprintLibrary = async ({
|
|
|
83947
83959
|
const libraryNames = new Set;
|
|
83948
83960
|
for (const entry of uniqueFootprints.values()) {
|
|
83949
83961
|
libraryNames.add(entry.libraryName);
|
|
83950
|
-
const libraryDir =
|
|
83951
|
-
|
|
83952
|
-
const footprintPath =
|
|
83953
|
-
|
|
83962
|
+
const libraryDir = path29.join(libraryRoot, `${entry.libraryName}.pretty`);
|
|
83963
|
+
fs27.mkdirSync(libraryDir, { recursive: true });
|
|
83964
|
+
const footprintPath = path29.join(libraryDir, `${entry.footprintName}.kicad_mod`);
|
|
83965
|
+
fs27.writeFileSync(footprintPath, `${entry.content}
|
|
83954
83966
|
`);
|
|
83955
83967
|
}
|
|
83956
83968
|
if (libraryNames.size > 0) {
|
|
@@ -83960,7 +83972,7 @@ ${libTableEntries.join(`
|
|
|
83960
83972
|
`)}
|
|
83961
83973
|
)
|
|
83962
83974
|
`;
|
|
83963
|
-
|
|
83975
|
+
fs27.writeFileSync(path29.join(libraryRoot, "fp-lib-table"), libTableContent);
|
|
83964
83976
|
}
|
|
83965
83977
|
};
|
|
83966
83978
|
var extractFootprintsFromPcb = (pcbContent) => {
|
|
@@ -83985,7 +83997,7 @@ var extractFootprintsFromPcb = (pcbContent) => {
|
|
|
83985
83997
|
};
|
|
83986
83998
|
|
|
83987
83999
|
// lib/shared/export-snippet.ts
|
|
83988
|
-
var writeFileAsync = promisify3(
|
|
84000
|
+
var writeFileAsync = promisify3(fs28.writeFile);
|
|
83989
84001
|
var ALLOWED_EXPORT_FORMATS = [
|
|
83990
84002
|
"json",
|
|
83991
84003
|
"circuit-json",
|
|
@@ -84030,10 +84042,10 @@ var exportSnippet = async ({
|
|
|
84030
84042
|
onError(`Invalid format: ${format}`);
|
|
84031
84043
|
return onExit(1);
|
|
84032
84044
|
}
|
|
84033
|
-
const projectDir =
|
|
84034
|
-
const outputBaseName =
|
|
84045
|
+
const projectDir = path30.dirname(filePath);
|
|
84046
|
+
const outputBaseName = path30.basename(filePath).replace(/\.[^.]+$/, "");
|
|
84035
84047
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
84036
|
-
const outputDestination =
|
|
84048
|
+
const outputDestination = path30.join(projectDir, outputPath ?? outputFileName);
|
|
84037
84049
|
const circuitData = await generateCircuitJson({
|
|
84038
84050
|
filePath,
|
|
84039
84051
|
saveToFile: format === "circuit-json",
|
|
@@ -84245,12 +84257,12 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
84245
84257
|
};
|
|
84246
84258
|
|
|
84247
84259
|
// lib/eecircuit-engine/run-simulation.ts
|
|
84248
|
-
import { promises as
|
|
84249
|
-
import
|
|
84260
|
+
import { promises as fs29, existsSync as existsSync11 } from "node:fs";
|
|
84261
|
+
import path31 from "node:path";
|
|
84250
84262
|
import os4 from "node:os";
|
|
84251
84263
|
var sim = null;
|
|
84252
84264
|
var fetchSimulation = async () => {
|
|
84253
|
-
const tempFilePath =
|
|
84265
|
+
const tempFilePath = path31.join(os4.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
84254
84266
|
if (!existsSync11(tempFilePath)) {
|
|
84255
84267
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
84256
84268
|
const response = await fetch(url);
|
|
@@ -84258,7 +84270,7 @@ var fetchSimulation = async () => {
|
|
|
84258
84270
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
84259
84271
|
}
|
|
84260
84272
|
const scriptContent = await response.text();
|
|
84261
|
-
await
|
|
84273
|
+
await fs29.writeFile(tempFilePath, scriptContent);
|
|
84262
84274
|
}
|
|
84263
84275
|
const module2 = await import(tempFilePath);
|
|
84264
84276
|
return module2.Simulation;
|
|
@@ -84347,8 +84359,8 @@ var resultToCsv = (result) => {
|
|
|
84347
84359
|
};
|
|
84348
84360
|
|
|
84349
84361
|
// cli/export/register.ts
|
|
84350
|
-
import
|
|
84351
|
-
import { promises as
|
|
84362
|
+
import path32 from "node:path";
|
|
84363
|
+
import { promises as fs30 } from "node:fs";
|
|
84352
84364
|
var registerExport = (program3) => {
|
|
84353
84365
|
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) => {
|
|
84354
84366
|
const formatOption = options.format ?? "json";
|
|
@@ -84360,12 +84372,12 @@ var registerExport = (program3) => {
|
|
|
84360
84372
|
});
|
|
84361
84373
|
if (circuitJson) {
|
|
84362
84374
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
84363
|
-
const outputSpicePath = options.output ??
|
|
84364
|
-
await
|
|
84375
|
+
const outputSpicePath = options.output ?? path32.join(path32.dirname(file), `${path32.basename(file, path32.extname(file))}.spice.cir`);
|
|
84376
|
+
await fs30.writeFile(outputSpicePath, spiceString);
|
|
84365
84377
|
const { result } = await runSimulation(spiceString);
|
|
84366
84378
|
const csvContent = resultToCsv(result);
|
|
84367
84379
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
84368
|
-
await
|
|
84380
|
+
await fs30.writeFile(outputCsvPath, csvContent);
|
|
84369
84381
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
84370
84382
|
}
|
|
84371
84383
|
process.exit(0);
|
|
@@ -84589,14 +84601,14 @@ class KeyStore {
|
|
|
84589
84601
|
}
|
|
84590
84602
|
}
|
|
84591
84603
|
function createKey(key) {
|
|
84592
|
-
let
|
|
84604
|
+
let path33 = null;
|
|
84593
84605
|
let id = null;
|
|
84594
84606
|
let src = null;
|
|
84595
84607
|
let weight = 1;
|
|
84596
84608
|
let getFn = null;
|
|
84597
84609
|
if (isString2(key) || isArray(key)) {
|
|
84598
84610
|
src = key;
|
|
84599
|
-
|
|
84611
|
+
path33 = createKeyPath(key);
|
|
84600
84612
|
id = createKeyId(key);
|
|
84601
84613
|
} else {
|
|
84602
84614
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -84610,11 +84622,11 @@ function createKey(key) {
|
|
|
84610
84622
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
84611
84623
|
}
|
|
84612
84624
|
}
|
|
84613
|
-
|
|
84625
|
+
path33 = createKeyPath(name);
|
|
84614
84626
|
id = createKeyId(name);
|
|
84615
84627
|
getFn = key.getFn;
|
|
84616
84628
|
}
|
|
84617
|
-
return { path:
|
|
84629
|
+
return { path: path33, id, weight, src, getFn };
|
|
84618
84630
|
}
|
|
84619
84631
|
function createKeyPath(key) {
|
|
84620
84632
|
return isArray(key) ? key : key.split(".");
|
|
@@ -84622,34 +84634,34 @@ function createKeyPath(key) {
|
|
|
84622
84634
|
function createKeyId(key) {
|
|
84623
84635
|
return isArray(key) ? key.join(".") : key;
|
|
84624
84636
|
}
|
|
84625
|
-
function get(obj,
|
|
84637
|
+
function get(obj, path33) {
|
|
84626
84638
|
let list = [];
|
|
84627
84639
|
let arr = false;
|
|
84628
|
-
const deepGet = (obj2,
|
|
84640
|
+
const deepGet = (obj2, path34, index) => {
|
|
84629
84641
|
if (!isDefined(obj2)) {
|
|
84630
84642
|
return;
|
|
84631
84643
|
}
|
|
84632
|
-
if (!
|
|
84644
|
+
if (!path34[index]) {
|
|
84633
84645
|
list.push(obj2);
|
|
84634
84646
|
} else {
|
|
84635
|
-
let key =
|
|
84647
|
+
let key = path34[index];
|
|
84636
84648
|
const value = obj2[key];
|
|
84637
84649
|
if (!isDefined(value)) {
|
|
84638
84650
|
return;
|
|
84639
84651
|
}
|
|
84640
|
-
if (index ===
|
|
84652
|
+
if (index === path34.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
84641
84653
|
list.push(toString(value));
|
|
84642
84654
|
} else if (isArray(value)) {
|
|
84643
84655
|
arr = true;
|
|
84644
84656
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
84645
|
-
deepGet(value[i],
|
|
84657
|
+
deepGet(value[i], path34, index + 1);
|
|
84646
84658
|
}
|
|
84647
|
-
} else if (
|
|
84648
|
-
deepGet(value,
|
|
84659
|
+
} else if (path34.length) {
|
|
84660
|
+
deepGet(value, path34, index + 1);
|
|
84649
84661
|
}
|
|
84650
84662
|
}
|
|
84651
84663
|
};
|
|
84652
|
-
deepGet(obj, isString2(
|
|
84664
|
+
deepGet(obj, isString2(path33) ? path33.split(".") : path33, 0);
|
|
84653
84665
|
return arr ? list : list[0];
|
|
84654
84666
|
}
|
|
84655
84667
|
var MatchOptions = {
|
|
@@ -85841,8 +85853,8 @@ var registerSearch = (program3) => {
|
|
|
85841
85853
|
}
|
|
85842
85854
|
if (kicadResults.length) {
|
|
85843
85855
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
85844
|
-
kicadResults.forEach((
|
|
85845
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
85856
|
+
kicadResults.forEach((path33, idx) => {
|
|
85857
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path33.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
85846
85858
|
});
|
|
85847
85859
|
}
|
|
85848
85860
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -91021,7 +91033,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
91021
91033
|
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();
|
|
91022
91034
|
var ms = r(U, "down");
|
|
91023
91035
|
var ns = r(U, "left");
|
|
91024
|
-
var
|
|
91036
|
+
var fs31 = r(U, "up");
|
|
91025
91037
|
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 } } };
|
|
91026
91038
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
91027
91039
|
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();
|
|
@@ -91590,7 +91602,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
91590
91602
|
sb.anchor = "middle_left";
|
|
91591
91603
|
mb.anchor = "middle_right";
|
|
91592
91604
|
var B1 = Cl;
|
|
91593
|
-
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:
|
|
91605
|
+
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 };
|
|
91594
91606
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
91595
91607
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
91596
91608
|
lineThickness = 0
|
|
@@ -93620,11 +93632,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
93620
93632
|
fiber = fiber.next, id2--;
|
|
93621
93633
|
return fiber;
|
|
93622
93634
|
}
|
|
93623
|
-
function copyWithSetImpl(obj,
|
|
93624
|
-
if (index >=
|
|
93635
|
+
function copyWithSetImpl(obj, path33, index, value) {
|
|
93636
|
+
if (index >= path33.length)
|
|
93625
93637
|
return value;
|
|
93626
|
-
var key =
|
|
93627
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
93638
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93639
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index + 1, value);
|
|
93628
93640
|
return updated;
|
|
93629
93641
|
}
|
|
93630
93642
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -93644,11 +93656,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
93644
93656
|
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);
|
|
93645
93657
|
return updated;
|
|
93646
93658
|
}
|
|
93647
|
-
function copyWithDeleteImpl(obj,
|
|
93648
|
-
var key =
|
|
93649
|
-
if (index + 1 ===
|
|
93659
|
+
function copyWithDeleteImpl(obj, path33, index) {
|
|
93660
|
+
var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
93661
|
+
if (index + 1 === path33.length)
|
|
93650
93662
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
93651
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
93663
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index + 1);
|
|
93652
93664
|
return updated;
|
|
93653
93665
|
}
|
|
93654
93666
|
function shouldSuspendImpl() {
|
|
@@ -102679,29 +102691,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
102679
102691
|
var didWarnAboutNestedUpdates = false;
|
|
102680
102692
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
102681
102693
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
102682
|
-
overrideHookState = function(fiber, id2,
|
|
102694
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
102683
102695
|
id2 = findHook(fiber, id2);
|
|
102684
|
-
id2 !== null && (
|
|
102696
|
+
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));
|
|
102685
102697
|
};
|
|
102686
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
102698
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
102687
102699
|
id2 = findHook(fiber, id2);
|
|
102688
|
-
id2 !== null && (
|
|
102700
|
+
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));
|
|
102689
102701
|
};
|
|
102690
102702
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
102691
102703
|
id2 = findHook(fiber, id2);
|
|
102692
102704
|
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));
|
|
102693
102705
|
};
|
|
102694
|
-
overrideProps = function(fiber,
|
|
102695
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
102706
|
+
overrideProps = function(fiber, path33, value) {
|
|
102707
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path33, 0, value);
|
|
102696
102708
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
102697
|
-
|
|
102698
|
-
|
|
102709
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102710
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
102699
102711
|
};
|
|
102700
|
-
overridePropsDeletePath = function(fiber,
|
|
102701
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
102712
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
102713
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path33, 0);
|
|
102702
102714
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
102703
|
-
|
|
102704
|
-
|
|
102715
|
+
path33 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
102716
|
+
path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
|
|
102705
102717
|
};
|
|
102706
102718
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
102707
102719
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -118038,10 +118050,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118038
118050
|
var setErrorHandler = null;
|
|
118039
118051
|
var setSuspenseHandler = null;
|
|
118040
118052
|
{
|
|
118041
|
-
var copyWithDeleteImpl = function(obj,
|
|
118042
|
-
var key =
|
|
118053
|
+
var copyWithDeleteImpl = function(obj, path33, index2) {
|
|
118054
|
+
var key = path33[index2];
|
|
118043
118055
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118044
|
-
if (index2 + 1 ===
|
|
118056
|
+
if (index2 + 1 === path33.length) {
|
|
118045
118057
|
if (isArray2(updated)) {
|
|
118046
118058
|
updated.splice(key, 1);
|
|
118047
118059
|
} else {
|
|
@@ -118049,11 +118061,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118049
118061
|
}
|
|
118050
118062
|
return updated;
|
|
118051
118063
|
}
|
|
118052
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
118064
|
+
updated[key] = copyWithDeleteImpl(obj[key], path33, index2 + 1);
|
|
118053
118065
|
return updated;
|
|
118054
118066
|
};
|
|
118055
|
-
var copyWithDelete = function(obj,
|
|
118056
|
-
return copyWithDeleteImpl(obj,
|
|
118067
|
+
var copyWithDelete = function(obj, path33) {
|
|
118068
|
+
return copyWithDeleteImpl(obj, path33, 0);
|
|
118057
118069
|
};
|
|
118058
118070
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
118059
118071
|
var oldKey = oldPath[index2];
|
|
@@ -118085,17 +118097,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118085
118097
|
}
|
|
118086
118098
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
118087
118099
|
};
|
|
118088
|
-
var copyWithSetImpl = function(obj,
|
|
118089
|
-
if (index2 >=
|
|
118100
|
+
var copyWithSetImpl = function(obj, path33, index2, value) {
|
|
118101
|
+
if (index2 >= path33.length) {
|
|
118090
118102
|
return value;
|
|
118091
118103
|
}
|
|
118092
|
-
var key =
|
|
118104
|
+
var key = path33[index2];
|
|
118093
118105
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
118094
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
118106
|
+
updated[key] = copyWithSetImpl(obj[key], path33, index2 + 1, value);
|
|
118095
118107
|
return updated;
|
|
118096
118108
|
};
|
|
118097
|
-
var copyWithSet = function(obj,
|
|
118098
|
-
return copyWithSetImpl(obj,
|
|
118109
|
+
var copyWithSet = function(obj, path33, value) {
|
|
118110
|
+
return copyWithSetImpl(obj, path33, 0, value);
|
|
118099
118111
|
};
|
|
118100
118112
|
var findHook = function(fiber, id2) {
|
|
118101
118113
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -118105,10 +118117,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118105
118117
|
}
|
|
118106
118118
|
return currentHook2;
|
|
118107
118119
|
};
|
|
118108
|
-
overrideHookState = function(fiber, id2,
|
|
118120
|
+
overrideHookState = function(fiber, id2, path33, value) {
|
|
118109
118121
|
var hook = findHook(fiber, id2);
|
|
118110
118122
|
if (hook !== null) {
|
|
118111
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
118123
|
+
var newState = copyWithSet(hook.memoizedState, path33, value);
|
|
118112
118124
|
hook.memoizedState = newState;
|
|
118113
118125
|
hook.baseState = newState;
|
|
118114
118126
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118118,10 +118130,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118118
118130
|
}
|
|
118119
118131
|
}
|
|
118120
118132
|
};
|
|
118121
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
118133
|
+
overrideHookStateDeletePath = function(fiber, id2, path33) {
|
|
118122
118134
|
var hook = findHook(fiber, id2);
|
|
118123
118135
|
if (hook !== null) {
|
|
118124
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
118136
|
+
var newState = copyWithDelete(hook.memoizedState, path33);
|
|
118125
118137
|
hook.memoizedState = newState;
|
|
118126
118138
|
hook.baseState = newState;
|
|
118127
118139
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -118144,8 +118156,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118144
118156
|
}
|
|
118145
118157
|
}
|
|
118146
118158
|
};
|
|
118147
|
-
overrideProps = function(fiber,
|
|
118148
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
118159
|
+
overrideProps = function(fiber, path33, value) {
|
|
118160
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path33, value);
|
|
118149
118161
|
if (fiber.alternate) {
|
|
118150
118162
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118151
118163
|
}
|
|
@@ -118154,8 +118166,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
118154
118166
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
118155
118167
|
}
|
|
118156
118168
|
};
|
|
118157
|
-
overridePropsDeletePath = function(fiber,
|
|
118158
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
118169
|
+
overridePropsDeletePath = function(fiber, path33) {
|
|
118170
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path33);
|
|
118159
118171
|
if (fiber.alternate) {
|
|
118160
118172
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
118161
118173
|
}
|
|
@@ -124206,7 +124218,7 @@ var parsePin = (pinString) => {
|
|
|
124206
124218
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
124207
124219
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
124208
124220
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
124209
|
-
const
|
|
124221
|
+
const path33 = pathMatch ? pathMatch[1] : "";
|
|
124210
124222
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
124211
124223
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
124212
124224
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -124220,7 +124232,7 @@ var parsePin = (pinString) => {
|
|
|
124220
124232
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
124221
124233
|
label,
|
|
124222
124234
|
labelColor,
|
|
124223
|
-
path:
|
|
124235
|
+
path: path33,
|
|
124224
124236
|
arrow
|
|
124225
124237
|
};
|
|
124226
124238
|
};
|
|
@@ -124660,15 +124672,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
124660
124672
|
}
|
|
124661
124673
|
}
|
|
124662
124674
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
124663
|
-
const
|
|
124675
|
+
const path33 = [];
|
|
124664
124676
|
for (let i = 0;i <= numPoints; i++) {
|
|
124665
124677
|
const t3 = i / numPoints;
|
|
124666
124678
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
124667
124679
|
const x = centerX + radius * Math.cos(angle2);
|
|
124668
124680
|
const y = centerY + radius * Math.sin(angle2);
|
|
124669
|
-
|
|
124681
|
+
path33.push({ x, y });
|
|
124670
124682
|
}
|
|
124671
|
-
return
|
|
124683
|
+
return path33;
|
|
124672
124684
|
}
|
|
124673
124685
|
var __defProp4 = Object.defineProperty;
|
|
124674
124686
|
var __export22 = (target, all) => {
|
|
@@ -126086,7 +126098,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
126086
126098
|
};
|
|
126087
126099
|
};
|
|
126088
126100
|
var silkscreenPin = ({
|
|
126089
|
-
fs:
|
|
126101
|
+
fs: fs32,
|
|
126090
126102
|
pn: pn2,
|
|
126091
126103
|
anchor_x,
|
|
126092
126104
|
anchor_y,
|
|
@@ -126129,7 +126141,7 @@ var silkscreenPin = ({
|
|
|
126129
126141
|
type: "pcb_silkscreen_text",
|
|
126130
126142
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
126131
126143
|
font: "tscircuit2024",
|
|
126132
|
-
font_size:
|
|
126144
|
+
font_size: fs32,
|
|
126133
126145
|
pcb_component_id: "pcb_component_1",
|
|
126134
126146
|
text: `{PIN${pn2}}`,
|
|
126135
126147
|
layer,
|
|
@@ -133745,17 +133757,17 @@ var ObstacleList = class {
|
|
|
133745
133757
|
return obstacles;
|
|
133746
133758
|
}
|
|
133747
133759
|
};
|
|
133748
|
-
function removePathLoops(
|
|
133749
|
-
if (
|
|
133750
|
-
return
|
|
133751
|
-
const result = [{ ...
|
|
133752
|
-
let currentLayer =
|
|
133753
|
-
for (let i = 1;i <
|
|
133754
|
-
const currentSegment = { start:
|
|
133755
|
-
const isVia =
|
|
133756
|
-
if (
|
|
133757
|
-
result.push({ ...
|
|
133758
|
-
currentLayer =
|
|
133760
|
+
function removePathLoops(path33) {
|
|
133761
|
+
if (path33.length < 4)
|
|
133762
|
+
return path33;
|
|
133763
|
+
const result = [{ ...path33[0] }];
|
|
133764
|
+
let currentLayer = path33[0].layer;
|
|
133765
|
+
for (let i = 1;i < path33.length; i++) {
|
|
133766
|
+
const currentSegment = { start: path33[i - 1], end: path33[i] };
|
|
133767
|
+
const isVia = path33[i].route_type === "via" || path33[i - 1].route_type === "via";
|
|
133768
|
+
if (path33[i].layer !== currentLayer || isVia) {
|
|
133769
|
+
result.push({ ...path33[i] });
|
|
133770
|
+
currentLayer = path33[i].layer;
|
|
133759
133771
|
continue;
|
|
133760
133772
|
}
|
|
133761
133773
|
let intersectionFound = false;
|
|
@@ -133784,8 +133796,8 @@ function removePathLoops(path32) {
|
|
|
133784
133796
|
result.push(intersectionPoint);
|
|
133785
133797
|
}
|
|
133786
133798
|
const lastPoint = result[result.length - 1];
|
|
133787
|
-
if (lastPoint.x !==
|
|
133788
|
-
result.push(
|
|
133799
|
+
if (lastPoint.x !== path33[i].x || lastPoint.y !== path33[i].y) {
|
|
133800
|
+
result.push(path33[i]);
|
|
133789
133801
|
}
|
|
133790
133802
|
}
|
|
133791
133803
|
return result;
|
|
@@ -134274,10 +134286,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134274
134286
|
});
|
|
134275
134287
|
}
|
|
134276
134288
|
if (current2.parent) {
|
|
134277
|
-
const
|
|
134289
|
+
const path33 = [];
|
|
134278
134290
|
let p = current2;
|
|
134279
134291
|
while (p) {
|
|
134280
|
-
|
|
134292
|
+
path33.unshift(p);
|
|
134281
134293
|
p = p.parent;
|
|
134282
134294
|
}
|
|
134283
134295
|
debugSolution.push({
|
|
@@ -134285,7 +134297,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
134285
134297
|
pcb_component_id: "",
|
|
134286
134298
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
134287
134299
|
layer: "top",
|
|
134288
|
-
route:
|
|
134300
|
+
route: path33,
|
|
134289
134301
|
stroke_width: 0.01
|
|
134290
134302
|
});
|
|
134291
134303
|
}
|
|
@@ -139207,13 +139219,13 @@ var RBush = class {
|
|
|
139207
139219
|
return this;
|
|
139208
139220
|
let node = this.data;
|
|
139209
139221
|
const bbox = this.toBBox(item);
|
|
139210
|
-
const
|
|
139222
|
+
const path33 = [];
|
|
139211
139223
|
const indexes = [];
|
|
139212
139224
|
let i, parent, goingUp;
|
|
139213
|
-
while (node ||
|
|
139225
|
+
while (node || path33.length) {
|
|
139214
139226
|
if (!node) {
|
|
139215
|
-
node =
|
|
139216
|
-
parent =
|
|
139227
|
+
node = path33.pop();
|
|
139228
|
+
parent = path33[path33.length - 1];
|
|
139217
139229
|
i = indexes.pop();
|
|
139218
139230
|
goingUp = true;
|
|
139219
139231
|
}
|
|
@@ -139221,13 +139233,13 @@ var RBush = class {
|
|
|
139221
139233
|
const index = findItem(item, node.children, equalsFn);
|
|
139222
139234
|
if (index !== -1) {
|
|
139223
139235
|
node.children.splice(index, 1);
|
|
139224
|
-
|
|
139225
|
-
this._condense(
|
|
139236
|
+
path33.push(node);
|
|
139237
|
+
this._condense(path33);
|
|
139226
139238
|
return this;
|
|
139227
139239
|
}
|
|
139228
139240
|
}
|
|
139229
139241
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
139230
|
-
|
|
139242
|
+
path33.push(node);
|
|
139231
139243
|
indexes.push(i);
|
|
139232
139244
|
i = 0;
|
|
139233
139245
|
parent = node;
|
|
@@ -139298,10 +139310,10 @@ var RBush = class {
|
|
|
139298
139310
|
calcBBox(node, this.toBBox);
|
|
139299
139311
|
return node;
|
|
139300
139312
|
}
|
|
139301
|
-
_chooseSubtree(bbox, node, level,
|
|
139313
|
+
_chooseSubtree(bbox, node, level, path33) {
|
|
139302
139314
|
while (true) {
|
|
139303
|
-
|
|
139304
|
-
if (node.leaf ||
|
|
139315
|
+
path33.push(node);
|
|
139316
|
+
if (node.leaf || path33.length - 1 === level)
|
|
139305
139317
|
break;
|
|
139306
139318
|
let minArea = Infinity;
|
|
139307
139319
|
let minEnlargement = Infinity;
|
|
@@ -139410,21 +139422,21 @@ var RBush = class {
|
|
|
139410
139422
|
}
|
|
139411
139423
|
return margin;
|
|
139412
139424
|
}
|
|
139413
|
-
_adjustParentBBoxes(bbox,
|
|
139425
|
+
_adjustParentBBoxes(bbox, path33, level) {
|
|
139414
139426
|
for (let i = level;i >= 0; i--) {
|
|
139415
|
-
extend(
|
|
139427
|
+
extend(path33[i], bbox);
|
|
139416
139428
|
}
|
|
139417
139429
|
}
|
|
139418
|
-
_condense(
|
|
139419
|
-
for (let i =
|
|
139420
|
-
if (
|
|
139430
|
+
_condense(path33) {
|
|
139431
|
+
for (let i = path33.length - 1, siblings;i >= 0; i--) {
|
|
139432
|
+
if (path33[i].children.length === 0) {
|
|
139421
139433
|
if (i > 0) {
|
|
139422
|
-
siblings =
|
|
139423
|
-
siblings.splice(siblings.indexOf(
|
|
139434
|
+
siblings = path33[i - 1].children;
|
|
139435
|
+
siblings.splice(siblings.indexOf(path33[i]), 1);
|
|
139424
139436
|
} else
|
|
139425
139437
|
this.clear();
|
|
139426
139438
|
} else
|
|
139427
|
-
calcBBox(
|
|
139439
|
+
calcBBox(path33[i], this.toBBox);
|
|
139428
139440
|
}
|
|
139429
139441
|
}
|
|
139430
139442
|
};
|
|
@@ -140569,7 +140581,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
140569
140581
|
this.capacityPaths = capacityPaths;
|
|
140570
140582
|
this.colorMap = colorMap ?? {};
|
|
140571
140583
|
this.unprocessedNodeIds = [
|
|
140572
|
-
...new Set(capacityPaths.flatMap((
|
|
140584
|
+
...new Set(capacityPaths.flatMap((path33) => path33.nodeIds))
|
|
140573
140585
|
];
|
|
140574
140586
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
140575
140587
|
}
|
|
@@ -140580,17 +140592,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
140580
140592
|
return;
|
|
140581
140593
|
}
|
|
140582
140594
|
const pathsGoingThroughNode = [];
|
|
140583
|
-
for (const
|
|
140584
|
-
const indexOfNodeInPath =
|
|
140595
|
+
for (const path33 of this.capacityPaths) {
|
|
140596
|
+
const indexOfNodeInPath = path33.nodeIds.indexOf(nodeId);
|
|
140585
140597
|
if (indexOfNodeInPath !== -1) {
|
|
140586
|
-
pathsGoingThroughNode.push({ path:
|
|
140598
|
+
pathsGoingThroughNode.push({ path: path33, indexOfNodeInPath });
|
|
140587
140599
|
}
|
|
140588
140600
|
}
|
|
140589
140601
|
const node = this.nodeMap.get(nodeId);
|
|
140590
140602
|
const nodePortSegments = [];
|
|
140591
|
-
for (const { path:
|
|
140592
|
-
const entryNodeId =
|
|
140593
|
-
const exitNodeId =
|
|
140603
|
+
for (const { path: path33, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
140604
|
+
const entryNodeId = path33.nodeIds[indexOfNodeInPath - 1];
|
|
140605
|
+
const exitNodeId = path33.nodeIds[indexOfNodeInPath + 1];
|
|
140594
140606
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
140595
140607
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
140596
140608
|
if (!adjNode)
|
|
@@ -140603,7 +140615,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
140603
140615
|
capacityMeshNodeId: nodeId,
|
|
140604
140616
|
start: segment2.start,
|
|
140605
140617
|
end: segment2.end,
|
|
140606
|
-
connectionNames: [
|
|
140618
|
+
connectionNames: [path33.connectionName],
|
|
140607
140619
|
availableZ: mutuallyAvailableZ
|
|
140608
140620
|
};
|
|
140609
140621
|
nodePortSegments.push(portSegment);
|
|
@@ -141409,37 +141421,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
141409
141421
|
return neighbors;
|
|
141410
141422
|
}
|
|
141411
141423
|
getNodePath(node) {
|
|
141412
|
-
const
|
|
141424
|
+
const path33 = [];
|
|
141413
141425
|
while (node) {
|
|
141414
|
-
|
|
141426
|
+
path33.push(node);
|
|
141415
141427
|
node = node.parent;
|
|
141416
141428
|
}
|
|
141417
|
-
return
|
|
141429
|
+
return path33;
|
|
141418
141430
|
}
|
|
141419
141431
|
getViasInNodePath(node) {
|
|
141420
|
-
const
|
|
141432
|
+
const path33 = this.getNodePath(node);
|
|
141421
141433
|
const vias = [];
|
|
141422
|
-
for (let i = 0;i <
|
|
141423
|
-
if (
|
|
141424
|
-
vias.push({ x:
|
|
141434
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141435
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141436
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141425
141437
|
}
|
|
141426
141438
|
}
|
|
141427
141439
|
return vias;
|
|
141428
141440
|
}
|
|
141429
141441
|
setSolvedPath(node) {
|
|
141430
|
-
const
|
|
141431
|
-
|
|
141442
|
+
const path33 = this.getNodePath(node);
|
|
141443
|
+
path33.reverse();
|
|
141432
141444
|
const vias = [];
|
|
141433
|
-
for (let i = 0;i <
|
|
141434
|
-
if (
|
|
141435
|
-
vias.push({ x:
|
|
141445
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
141446
|
+
if (path33[i].z !== path33[i + 1].z) {
|
|
141447
|
+
vias.push({ x: path33[i].x, y: path33[i].y });
|
|
141436
141448
|
}
|
|
141437
141449
|
}
|
|
141438
141450
|
this.solvedPath = {
|
|
141439
141451
|
connectionName: this.connectionName,
|
|
141440
141452
|
traceThickness: this.traceThickness,
|
|
141441
141453
|
viaDiameter: this.viaDiameter,
|
|
141442
|
-
route:
|
|
141454
|
+
route: path33.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
141443
141455
|
vias
|
|
141444
141456
|
};
|
|
141445
141457
|
}
|
|
@@ -142247,12 +142259,12 @@ function computeDumbbellPaths({
|
|
|
142247
142259
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
142248
142260
|
};
|
|
142249
142261
|
};
|
|
142250
|
-
const subdivideOptimalPath = (
|
|
142251
|
-
if (
|
|
142252
|
-
return
|
|
142253
|
-
const result = [
|
|
142254
|
-
for (let i = 0;i <
|
|
142255
|
-
const segment2 = { start:
|
|
142262
|
+
const subdivideOptimalPath = (path33, numSubdivisions) => {
|
|
142263
|
+
if (path33.length < 2)
|
|
142264
|
+
return path33;
|
|
142265
|
+
const result = [path33[0]];
|
|
142266
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142267
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
142256
142268
|
const segmentMidpoint = {
|
|
142257
142269
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
142258
142270
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -142314,7 +142326,7 @@ function computeDumbbellPaths({
|
|
|
142314
142326
|
}
|
|
142315
142327
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
142316
142328
|
}
|
|
142317
|
-
result.push(
|
|
142329
|
+
result.push(path33[i + 1]);
|
|
142318
142330
|
}
|
|
142319
142331
|
if (result.length > 1) {
|
|
142320
142332
|
const filteredResult = [result[0]];
|
|
@@ -142549,13 +142561,13 @@ function computeDumbbellPaths({
|
|
|
142549
142561
|
].map((l, index) => ({ ...l, index }));
|
|
142550
142562
|
};
|
|
142551
142563
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
142552
|
-
const
|
|
142553
|
-
if (
|
|
142554
|
-
return
|
|
142564
|
+
const path33 = jLine.points;
|
|
142565
|
+
if (path33.length < 2)
|
|
142566
|
+
return path33;
|
|
142555
142567
|
const minDistThreshold = r3 + m2;
|
|
142556
|
-
const result = [
|
|
142557
|
-
for (let i = 0;i <
|
|
142558
|
-
const segment2 = { start:
|
|
142568
|
+
const result = [path33[0]];
|
|
142569
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
142570
|
+
const segment2 = { start: path33[i], end: path33[i + 1] };
|
|
142559
142571
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
142560
142572
|
if (distToOpposite < minDistThreshold) {
|
|
142561
142573
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -142624,26 +142636,26 @@ function computeDumbbellPaths({
|
|
|
142624
142636
|
return { index: 0, path: [] };
|
|
142625
142637
|
}
|
|
142626
142638
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
142627
|
-
const
|
|
142628
|
-
const firstPoint =
|
|
142629
|
-
const dist3 = distance3(firstPoint,
|
|
142630
|
-
const dist4 = distance3(firstPoint,
|
|
142639
|
+
const path33 = [...optimalPath2.path];
|
|
142640
|
+
const firstPoint = path33[0];
|
|
142641
|
+
const dist3 = distance3(firstPoint, path33[2]);
|
|
142642
|
+
const dist4 = distance3(firstPoint, path33[3]);
|
|
142631
142643
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
142632
|
-
if (dist3 < distance3(firstPoint,
|
|
142633
|
-
|
|
142644
|
+
if (dist3 < distance3(firstPoint, path33[1]) || dist4 < distance3(firstPoint, path33[1])) {
|
|
142645
|
+
path33.splice(1, closerIdx - 1);
|
|
142634
142646
|
}
|
|
142635
|
-
const lastPoint =
|
|
142636
|
-
const distM3 = distance3(lastPoint,
|
|
142637
|
-
const distM4 = distance3(lastPoint,
|
|
142638
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
142639
|
-
if (distM3 < distance3(lastPoint,
|
|
142640
|
-
|
|
142647
|
+
const lastPoint = path33[path33.length - 1];
|
|
142648
|
+
const distM3 = distance3(lastPoint, path33[path33.length - 3]);
|
|
142649
|
+
const distM4 = distance3(lastPoint, path33[path33.length - 4]);
|
|
142650
|
+
const closerLastIdx = distM3 < distM4 ? path33.length - 3 : path33.length - 4;
|
|
142651
|
+
if (distM3 < distance3(lastPoint, path33[path33.length - 2]) || distM4 < distance3(lastPoint, path33[path33.length - 2])) {
|
|
142652
|
+
path33.splice(closerLastIdx + 1, path33.length - closerLastIdx - 2);
|
|
142641
142653
|
}
|
|
142642
142654
|
return {
|
|
142643
142655
|
index: optimalPath2.index,
|
|
142644
|
-
path:
|
|
142645
|
-
startsAt:
|
|
142646
|
-
goesTo:
|
|
142656
|
+
path: path33,
|
|
142657
|
+
startsAt: path33[0] === C2 ? "C" : "D",
|
|
142658
|
+
goesTo: path33[path33.length - 1] === C2 ? "C" : "D"
|
|
142647
142659
|
};
|
|
142648
142660
|
};
|
|
142649
142661
|
const optimalPath = findOptimalPath();
|
|
@@ -144063,9 +144075,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144063
144075
|
let closestIntersection = null;
|
|
144064
144076
|
let intersectedSegmentZ = null;
|
|
144065
144077
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
144066
|
-
for (const
|
|
144067
|
-
for (let i = 0;i <
|
|
144068
|
-
const segment2 = [
|
|
144078
|
+
for (const path33 of pathMap.values()) {
|
|
144079
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144080
|
+
const segment2 = [path33[i], path33[i + 1]];
|
|
144069
144081
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
144070
144082
|
continue;
|
|
144071
144083
|
}
|
|
@@ -144195,11 +144207,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
144195
144207
|
});
|
|
144196
144208
|
}
|
|
144197
144209
|
const drawPath = (pathMap, labelPrefix) => {
|
|
144198
|
-
for (const [connectionName,
|
|
144210
|
+
for (const [connectionName, path33] of pathMap.entries()) {
|
|
144199
144211
|
const color = colorMap[connectionName] ?? "black";
|
|
144200
|
-
for (let i = 0;i <
|
|
144201
|
-
const p12 =
|
|
144202
|
-
const p2 =
|
|
144212
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144213
|
+
const p12 = path33[i];
|
|
144214
|
+
const p2 = path33[i + 1];
|
|
144203
144215
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
144204
144216
|
graphics.circles.push({
|
|
144205
144217
|
center: { x: p12.x, y: p12.y },
|
|
@@ -144797,10 +144809,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
144797
144809
|
const allSegments = [];
|
|
144798
144810
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
144799
144811
|
for (const polyLine of polyLines) {
|
|
144800
|
-
const
|
|
144801
|
-
for (let i = 0;i <
|
|
144802
|
-
const p12 =
|
|
144803
|
-
const p2 =
|
|
144812
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
144813
|
+
for (let i = 0;i < path33.length - 1; i++) {
|
|
144814
|
+
const p12 = path33[i];
|
|
144815
|
+
const p2 = path33[i + 1];
|
|
144804
144816
|
const layer = p12.z2;
|
|
144805
144817
|
allSegments.push({
|
|
144806
144818
|
start: { x: p12.x, y: p12.y },
|
|
@@ -144818,7 +144830,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
144818
144830
|
}
|
|
144819
144831
|
}
|
|
144820
144832
|
}
|
|
144821
|
-
const lastPoint =
|
|
144833
|
+
const lastPoint = path33[path33.length - 1];
|
|
144822
144834
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
144823
144835
|
const key = pointKey2(lastPoint);
|
|
144824
144836
|
if (!viaPoints.has(key)) {
|
|
@@ -145117,14 +145129,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
145117
145129
|
const polyLineVias = [];
|
|
145118
145130
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145119
145131
|
const polyLine = polyLines[i];
|
|
145120
|
-
const
|
|
145132
|
+
const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
145121
145133
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
145122
|
-
for (let i22 = 0;i22 <
|
|
145123
|
-
const segment2 = [
|
|
145134
|
+
for (let i22 = 0;i22 < path33.length - 1; i22++) {
|
|
145135
|
+
const segment2 = [path33[i22], path33[i22 + 1]];
|
|
145124
145136
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
145125
145137
|
}
|
|
145126
145138
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
145127
|
-
polyLineVias.push(
|
|
145139
|
+
polyLineVias.push(path33.filter((p) => p.z1 !== p.z2));
|
|
145128
145140
|
}
|
|
145129
145141
|
for (let i = 0;i < polyLines.length; i++) {
|
|
145130
145142
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -146553,7 +146565,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
146553
146565
|
if (this.failedSolvers.length > 0) {
|
|
146554
146566
|
this.solved = false;
|
|
146555
146567
|
this.failed = true;
|
|
146556
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
146568
|
+
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs32) => fs32.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
|
|
146557
146569
|
return;
|
|
146558
146570
|
}
|
|
146559
146571
|
this.solved = true;
|
|
@@ -149334,13 +149346,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149334
149346
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
149335
149347
|
}
|
|
149336
149348
|
getBacktrackedPath(candidate) {
|
|
149337
|
-
const
|
|
149349
|
+
const path33 = [];
|
|
149338
149350
|
let currentCandidate = candidate;
|
|
149339
149351
|
while (currentCandidate) {
|
|
149340
|
-
|
|
149352
|
+
path33.push(currentCandidate.node);
|
|
149341
149353
|
currentCandidate = currentCandidate.prevCandidate;
|
|
149342
149354
|
}
|
|
149343
|
-
return
|
|
149355
|
+
return path33;
|
|
149344
149356
|
}
|
|
149345
149357
|
getNeighboringNodes(node) {
|
|
149346
149358
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -149348,12 +149360,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
149348
149360
|
getCapacityPaths() {
|
|
149349
149361
|
const capacityPaths = [];
|
|
149350
149362
|
for (const connection of this.connectionsWithNodes) {
|
|
149351
|
-
const
|
|
149352
|
-
if (
|
|
149363
|
+
const path33 = connection.path;
|
|
149364
|
+
if (path33) {
|
|
149353
149365
|
capacityPaths.push({
|
|
149354
149366
|
capacityPathId: connection.connection.name,
|
|
149355
149367
|
connectionName: connection.connection.name,
|
|
149356
|
-
nodeIds:
|
|
149368
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
149357
149369
|
});
|
|
149358
149370
|
}
|
|
149359
149371
|
}
|
|
@@ -150038,10 +150050,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150038
150050
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
150039
150051
|
}
|
|
150040
150052
|
getBacktrackedPath(candidate) {
|
|
150041
|
-
const
|
|
150053
|
+
const path33 = [];
|
|
150042
150054
|
let currentCandidate = candidate;
|
|
150043
150055
|
while (currentCandidate) {
|
|
150044
|
-
|
|
150056
|
+
path33.push(currentCandidate.node);
|
|
150045
150057
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
150046
150058
|
currentCandidate = currentCandidate.prevCandidate;
|
|
150047
150059
|
} else {
|
|
@@ -150049,7 +150061,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150049
150061
|
break;
|
|
150050
150062
|
}
|
|
150051
150063
|
}
|
|
150052
|
-
return
|
|
150064
|
+
return path33.reverse();
|
|
150053
150065
|
}
|
|
150054
150066
|
getNeighboringNodes(node) {
|
|
150055
150067
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -150064,8 +150076,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150064
150076
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
150065
150077
|
return true;
|
|
150066
150078
|
}
|
|
150067
|
-
reduceCapacityAlongPath(
|
|
150068
|
-
for (const pathNode of
|
|
150079
|
+
reduceCapacityAlongPath(path33) {
|
|
150080
|
+
for (const pathNode of path33) {
|
|
150069
150081
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
150070
150082
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
150071
150083
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -150194,9 +150206,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150194
150206
|
this.queuedNodes = null;
|
|
150195
150207
|
}
|
|
150196
150208
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
150197
|
-
const
|
|
150198
|
-
currentTerminal.path =
|
|
150199
|
-
this.reduceCapacityAlongPath(
|
|
150209
|
+
const path33 = this.getBacktrackedPath(currentCandidate);
|
|
150210
|
+
currentTerminal.path = path33;
|
|
150211
|
+
this.reduceCapacityAlongPath(path33);
|
|
150200
150212
|
this.currentConnectionIndex++;
|
|
150201
150213
|
this.candidates = null;
|
|
150202
150214
|
this.visitedNodes = null;
|
|
@@ -150245,10 +150257,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
150245
150257
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
150246
150258
|
topCandidates.forEach((candidate, index) => {
|
|
150247
150259
|
const opacity = 0.8 * (1 - index / 5);
|
|
150248
|
-
const
|
|
150249
|
-
if (
|
|
150260
|
+
const path33 = this.getBacktrackedPath(candidate);
|
|
150261
|
+
if (path33.length > 0) {
|
|
150250
150262
|
baseGraphics.lines.push({
|
|
150251
|
-
points:
|
|
150263
|
+
points: path33.map(({ center: { x, y } }) => ({ x, y })),
|
|
150252
150264
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
150253
150265
|
strokeWidth: 0.05
|
|
150254
150266
|
});
|
|
@@ -150937,12 +150949,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
150937
150949
|
getCapacityPaths() {
|
|
150938
150950
|
const capacityPaths = [];
|
|
150939
150951
|
for (const connection of this.connectionsWithNodes) {
|
|
150940
|
-
const
|
|
150941
|
-
if (
|
|
150952
|
+
const path33 = connection.path;
|
|
150953
|
+
if (path33) {
|
|
150942
150954
|
capacityPaths.push({
|
|
150943
150955
|
capacityPathId: connection.connection.name,
|
|
150944
150956
|
connectionName: connection.connection.name,
|
|
150945
|
-
nodeIds:
|
|
150957
|
+
nodeIds: path33.map((node) => node.capacityMeshNodeId)
|
|
150946
150958
|
});
|
|
150947
150959
|
}
|
|
150948
150960
|
}
|
|
@@ -151963,22 +151975,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
151963
151975
|
return null;
|
|
151964
151976
|
}
|
|
151965
151977
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
151966
|
-
for (const
|
|
151967
|
-
const fullPath =
|
|
151978
|
+
for (const path33 of possiblePaths) {
|
|
151979
|
+
const fullPath = path33.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
151968
151980
|
if (this.isValidPath(fullPath)) {
|
|
151969
151981
|
return fullPath;
|
|
151970
151982
|
}
|
|
151971
151983
|
}
|
|
151972
151984
|
return null;
|
|
151973
151985
|
}
|
|
151974
|
-
addPathToResult(
|
|
151975
|
-
if (
|
|
151986
|
+
addPathToResult(path33) {
|
|
151987
|
+
if (path33.length === 0)
|
|
151976
151988
|
return;
|
|
151977
|
-
for (let i = 0;i <
|
|
151978
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
151989
|
+
for (let i = 0;i < path33.length; i++) {
|
|
151990
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path33[i])) {
|
|
151979
151991
|
continue;
|
|
151980
151992
|
}
|
|
151981
|
-
this.newRoute.push(
|
|
151993
|
+
this.newRoute.push(path33[i]);
|
|
151982
151994
|
}
|
|
151983
151995
|
this.currentStepSize = this.maxStepSize;
|
|
151984
151996
|
}
|
|
@@ -179385,7 +179397,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179385
179397
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
179386
179398
|
const start = portsWithPosition[i];
|
|
179387
179399
|
const end = portsWithPosition[i + 1];
|
|
179388
|
-
const
|
|
179400
|
+
const path33 = calculateElbow({
|
|
179389
179401
|
x: start.position.x,
|
|
179390
179402
|
y: start.position.y,
|
|
179391
179403
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -179394,8 +179406,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
179394
179406
|
y: end.position.y,
|
|
179395
179407
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
179396
179408
|
});
|
|
179397
|
-
for (let j4 = 0;j4 <
|
|
179398
|
-
elbowEdges.push({ from:
|
|
179409
|
+
for (let j4 = 0;j4 < path33.length - 1; j4++) {
|
|
179410
|
+
elbowEdges.push({ from: path33[j4], to: path33[j4 + 1] });
|
|
179399
179411
|
}
|
|
179400
179412
|
}
|
|
179401
179413
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -185583,8 +185595,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
185583
185595
|
*/
|
|
185584
185596
|
|
|
185585
185597
|
// lib/import/import-component-from-jlcpcb.ts
|
|
185586
|
-
import
|
|
185587
|
-
import
|
|
185598
|
+
import fs32 from "node:fs/promises";
|
|
185599
|
+
import path33 from "node:path";
|
|
185588
185600
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
185589
185601
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
185590
185602
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -185592,10 +185604,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
185592
185604
|
if (!fileName) {
|
|
185593
185605
|
throw new Error("Could not determine file name of converted component");
|
|
185594
185606
|
}
|
|
185595
|
-
const importsDir =
|
|
185596
|
-
await
|
|
185597
|
-
const filePath =
|
|
185598
|
-
await
|
|
185607
|
+
const importsDir = path33.join(projectDir, "imports");
|
|
185608
|
+
await fs32.mkdir(importsDir, { recursive: true });
|
|
185609
|
+
const filePath = path33.join(importsDir, `${fileName}.tsx`);
|
|
185610
|
+
await fs32.writeFile(filePath, tsx);
|
|
185599
185611
|
return { filePath };
|
|
185600
185612
|
};
|
|
185601
185613
|
|
|
@@ -186960,12 +186972,12 @@ var registerRemove = (program3) => {
|
|
|
186960
186972
|
};
|
|
186961
186973
|
|
|
186962
186974
|
// cli/build/register.ts
|
|
186963
|
-
import
|
|
186964
|
-
import
|
|
186975
|
+
import path41 from "node:path";
|
|
186976
|
+
import fs40 from "node:fs";
|
|
186965
186977
|
|
|
186966
186978
|
// cli/build/build-file.ts
|
|
186967
|
-
import
|
|
186968
|
-
import
|
|
186979
|
+
import path34 from "node:path";
|
|
186980
|
+
import fs33 from "node:fs";
|
|
186969
186981
|
|
|
186970
186982
|
// lib/shared/circuit-json-diagnostics.ts
|
|
186971
186983
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -187027,9 +187039,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
187027
187039
|
filePath: input,
|
|
187028
187040
|
platformConfig: completePlatformConfig
|
|
187029
187041
|
});
|
|
187030
|
-
|
|
187031
|
-
|
|
187032
|
-
console.log(`Circuit JSON written to ${
|
|
187042
|
+
fs33.mkdirSync(path34.dirname(output), { recursive: true });
|
|
187043
|
+
fs33.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
187044
|
+
console.log(`Circuit JSON written to ${path34.relative(projectDir, output)}`);
|
|
187033
187045
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
187034
187046
|
if (!options?.ignoreWarnings) {
|
|
187035
187047
|
for (const warn of warnings) {
|
|
@@ -187067,7 +187079,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187067
187079
|
if (!match)
|
|
187068
187080
|
return;
|
|
187069
187081
|
const [, exportName, fromSpecifier] = match;
|
|
187070
|
-
const entryFileName =
|
|
187082
|
+
const entryFileName = path34.basename(entryFilePath);
|
|
187071
187083
|
console.error([
|
|
187072
187084
|
"",
|
|
187073
187085
|
`It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
|
|
@@ -187080,20 +187092,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
187080
187092
|
};
|
|
187081
187093
|
|
|
187082
187094
|
// cli/build/get-build-entrypoints.ts
|
|
187083
|
-
import
|
|
187084
|
-
import
|
|
187095
|
+
import fs34 from "node:fs";
|
|
187096
|
+
import path35 from "node:path";
|
|
187085
187097
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
187086
|
-
const relative9 =
|
|
187087
|
-
return relative9 === "" || !relative9.startsWith("..") && !
|
|
187098
|
+
const relative9 = path35.relative(maybeParent, maybeChild);
|
|
187099
|
+
return relative9 === "" || !relative9.startsWith("..") && !path35.isAbsolute(relative9);
|
|
187088
187100
|
};
|
|
187089
187101
|
var findProjectRoot = (startDir) => {
|
|
187090
187102
|
let currentDir = startDir;
|
|
187091
|
-
while (currentDir !==
|
|
187092
|
-
const packageJsonPath =
|
|
187093
|
-
if (
|
|
187103
|
+
while (currentDir !== path35.dirname(currentDir)) {
|
|
187104
|
+
const packageJsonPath = path35.join(currentDir, "package.json");
|
|
187105
|
+
if (fs34.existsSync(packageJsonPath)) {
|
|
187094
187106
|
return currentDir;
|
|
187095
187107
|
}
|
|
187096
|
-
currentDir =
|
|
187108
|
+
currentDir = path35.dirname(currentDir);
|
|
187097
187109
|
}
|
|
187098
187110
|
return startDir;
|
|
187099
187111
|
};
|
|
@@ -187102,7 +187114,7 @@ async function getBuildEntrypoints({
|
|
|
187102
187114
|
rootDir = process.cwd(),
|
|
187103
187115
|
includeBoardFiles = true
|
|
187104
187116
|
}) {
|
|
187105
|
-
const resolvedRoot =
|
|
187117
|
+
const resolvedRoot = path35.resolve(rootDir);
|
|
187106
187118
|
const includeBoardFilePatterns = includeBoardFiles ? getBoardFilePatterns(resolvedRoot) : [];
|
|
187107
187119
|
const buildFromProjectDir = async () => {
|
|
187108
187120
|
if (includeBoardFiles) {
|
|
@@ -187136,8 +187148,8 @@ async function getBuildEntrypoints({
|
|
|
187136
187148
|
};
|
|
187137
187149
|
};
|
|
187138
187150
|
if (fileOrDir) {
|
|
187139
|
-
const resolved =
|
|
187140
|
-
if (
|
|
187151
|
+
const resolved = path35.resolve(resolvedRoot, fileOrDir);
|
|
187152
|
+
if (fs34.existsSync(resolved) && fs34.statSync(resolved).isDirectory()) {
|
|
187141
187153
|
if (includeBoardFiles) {
|
|
187142
187154
|
const circuitFiles = findBoardFiles({
|
|
187143
187155
|
projectDir: resolvedRoot,
|
|
@@ -187167,7 +187179,7 @@ async function getBuildEntrypoints({
|
|
|
187167
187179
|
circuitFiles: mainEntrypoint ? [mainEntrypoint] : []
|
|
187168
187180
|
};
|
|
187169
187181
|
}
|
|
187170
|
-
const fileDir =
|
|
187182
|
+
const fileDir = path35.dirname(resolved);
|
|
187171
187183
|
const projectDir = findProjectRoot(fileDir);
|
|
187172
187184
|
return { projectDir, circuitFiles: [resolved] };
|
|
187173
187185
|
}
|
|
@@ -187204,8 +187216,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
187204
187216
|
};
|
|
187205
187217
|
|
|
187206
187218
|
// cli/build/build-preview-images.ts
|
|
187207
|
-
import
|
|
187208
|
-
import
|
|
187219
|
+
import fs35 from "node:fs";
|
|
187220
|
+
import path36 from "node:path";
|
|
187209
187221
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
187210
187222
|
import {
|
|
187211
187223
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
@@ -187278,21 +187290,21 @@ var generatePreviewAssets = async ({
|
|
|
187278
187290
|
outputDir,
|
|
187279
187291
|
distDir
|
|
187280
187292
|
}) => {
|
|
187281
|
-
const prefixRelative =
|
|
187293
|
+
const prefixRelative = path36.relative(distDir, outputDir) || ".";
|
|
187282
187294
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
187283
187295
|
let circuitJson;
|
|
187284
187296
|
try {
|
|
187285
|
-
const circuitJsonRaw =
|
|
187297
|
+
const circuitJsonRaw = fs35.readFileSync(build.outputPath, "utf-8");
|
|
187286
187298
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
187287
187299
|
} catch (error) {
|
|
187288
187300
|
console.error(`${prefix}Failed to read circuit JSON:`, error);
|
|
187289
187301
|
return;
|
|
187290
187302
|
}
|
|
187291
|
-
|
|
187303
|
+
fs35.mkdirSync(outputDir, { recursive: true });
|
|
187292
187304
|
try {
|
|
187293
187305
|
console.log(`${prefix}Generating PCB SVG...`);
|
|
187294
187306
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
187295
|
-
|
|
187307
|
+
fs35.writeFileSync(path36.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
187296
187308
|
console.log(`${prefix}Written pcb.svg`);
|
|
187297
187309
|
} catch (error) {
|
|
187298
187310
|
console.error(`${prefix}Failed to generate PCB SVG:`, error);
|
|
@@ -187300,7 +187312,7 @@ var generatePreviewAssets = async ({
|
|
|
187300
187312
|
try {
|
|
187301
187313
|
console.log(`${prefix}Generating schematic SVG...`);
|
|
187302
187314
|
const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
|
|
187303
|
-
|
|
187315
|
+
fs35.writeFileSync(path36.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
187304
187316
|
console.log(`${prefix}Written schematic.svg`);
|
|
187305
187317
|
} catch (error) {
|
|
187306
187318
|
console.error(`${prefix}Failed to generate schematic SVG:`, error);
|
|
@@ -187317,7 +187329,7 @@ var generatePreviewAssets = async ({
|
|
|
187317
187329
|
camPos: [10, 10, 10],
|
|
187318
187330
|
lookAt: [0, 0, 0]
|
|
187319
187331
|
});
|
|
187320
|
-
|
|
187332
|
+
fs35.writeFileSync(path36.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
187321
187333
|
console.log(`${prefix}Written 3d.png`);
|
|
187322
187334
|
} catch (error) {
|
|
187323
187335
|
console.error(`${prefix}Failed to generate 3D PNG:`, error);
|
|
@@ -187330,14 +187342,14 @@ var buildPreviewImages = async ({
|
|
|
187330
187342
|
allImages
|
|
187331
187343
|
}) => {
|
|
187332
187344
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
187333
|
-
const normalizedMainEntrypoint = mainEntrypoint ?
|
|
187345
|
+
const normalizedMainEntrypoint = mainEntrypoint ? path36.resolve(mainEntrypoint) : undefined;
|
|
187334
187346
|
if (allImages) {
|
|
187335
187347
|
if (successfulBuilds.length === 0) {
|
|
187336
187348
|
console.warn("No successful build output available for preview image generation.");
|
|
187337
187349
|
return;
|
|
187338
187350
|
}
|
|
187339
187351
|
for (const build of successfulBuilds) {
|
|
187340
|
-
const outputDir =
|
|
187352
|
+
const outputDir = path36.dirname(build.outputPath);
|
|
187341
187353
|
await generatePreviewAssets({
|
|
187342
187354
|
build,
|
|
187343
187355
|
outputDir,
|
|
@@ -187348,7 +187360,7 @@ var buildPreviewImages = async ({
|
|
|
187348
187360
|
}
|
|
187349
187361
|
const previewBuild = (() => {
|
|
187350
187362
|
if (normalizedMainEntrypoint) {
|
|
187351
|
-
const match = successfulBuilds.find((built) =>
|
|
187363
|
+
const match = successfulBuilds.find((built) => path36.resolve(built.sourcePath) === normalizedMainEntrypoint);
|
|
187352
187364
|
if (match)
|
|
187353
187365
|
return match;
|
|
187354
187366
|
}
|
|
@@ -187366,8 +187378,8 @@ var buildPreviewImages = async ({
|
|
|
187366
187378
|
};
|
|
187367
187379
|
|
|
187368
187380
|
// cli/build/generate-kicad-project.ts
|
|
187369
|
-
import
|
|
187370
|
-
import
|
|
187381
|
+
import fs36 from "node:fs";
|
|
187382
|
+
import path37 from "node:path";
|
|
187371
187383
|
var createKicadProContent = ({
|
|
187372
187384
|
projectName,
|
|
187373
187385
|
schematicFileName,
|
|
@@ -187407,10 +187419,10 @@ var generateKicadProject = async ({
|
|
|
187407
187419
|
boardFileName
|
|
187408
187420
|
});
|
|
187409
187421
|
if (writeFiles) {
|
|
187410
|
-
|
|
187411
|
-
|
|
187412
|
-
|
|
187413
|
-
|
|
187422
|
+
fs36.mkdirSync(outputDir, { recursive: true });
|
|
187423
|
+
fs36.writeFileSync(path37.join(outputDir, schematicFileName), schContent);
|
|
187424
|
+
fs36.writeFileSync(path37.join(outputDir, boardFileName), pcbContent);
|
|
187425
|
+
fs36.writeFileSync(path37.join(outputDir, projectFileName), proContent);
|
|
187414
187426
|
}
|
|
187415
187427
|
return {
|
|
187416
187428
|
pcbContent,
|
|
@@ -187422,8 +187434,8 @@ var generateKicadProject = async ({
|
|
|
187422
187434
|
};
|
|
187423
187435
|
|
|
187424
187436
|
// cli/build/transpile/index.ts
|
|
187425
|
-
import
|
|
187426
|
-
import
|
|
187437
|
+
import path39 from "node:path";
|
|
187438
|
+
import fs38 from "node:fs";
|
|
187427
187439
|
import { rollup } from "rollup";
|
|
187428
187440
|
import typescript from "@rollup/plugin-typescript";
|
|
187429
187441
|
import resolve11 from "@rollup/plugin-node-resolve";
|
|
@@ -187432,11 +187444,11 @@ import json from "@rollup/plugin-json";
|
|
|
187432
187444
|
import dts from "rollup-plugin-dts";
|
|
187433
187445
|
|
|
187434
187446
|
// cli/build/transpile/static-asset-plugin.ts
|
|
187435
|
-
import
|
|
187436
|
-
import
|
|
187447
|
+
import fs37 from "node:fs";
|
|
187448
|
+
import path38 from "node:path";
|
|
187437
187449
|
import { createHash } from "node:crypto";
|
|
187438
187450
|
function normalizePathSeparators(filePath) {
|
|
187439
|
-
return filePath.split(
|
|
187451
|
+
return filePath.split(path38.sep).join("/");
|
|
187440
187452
|
}
|
|
187441
187453
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
187442
187454
|
".glb",
|
|
@@ -187467,24 +187479,24 @@ var createStaticAssetPlugin = ({
|
|
|
187467
187479
|
return {
|
|
187468
187480
|
name: "tsci-static-assets",
|
|
187469
187481
|
resolveId(source, importer) {
|
|
187470
|
-
const ext =
|
|
187482
|
+
const ext = path38.extname(source).toLowerCase();
|
|
187471
187483
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
187472
187484
|
return null;
|
|
187473
|
-
if (
|
|
187474
|
-
return
|
|
187485
|
+
if (path38.isAbsolute(source)) {
|
|
187486
|
+
return fs37.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
187475
187487
|
}
|
|
187476
187488
|
if (importer) {
|
|
187477
|
-
const importerNative = importer.split("/").join(
|
|
187478
|
-
const resolvedFromImporter =
|
|
187479
|
-
if (
|
|
187489
|
+
const importerNative = importer.split("/").join(path38.sep);
|
|
187490
|
+
const resolvedFromImporter = path38.resolve(path38.dirname(importerNative), source);
|
|
187491
|
+
if (fs37.existsSync(resolvedFromImporter)) {
|
|
187480
187492
|
return {
|
|
187481
187493
|
id: normalizePathSeparators(resolvedFromImporter),
|
|
187482
187494
|
external: true
|
|
187483
187495
|
};
|
|
187484
187496
|
}
|
|
187485
187497
|
}
|
|
187486
|
-
const resolvedFromProject =
|
|
187487
|
-
if (
|
|
187498
|
+
const resolvedFromProject = path38.resolve(resolvedBaseUrl, source);
|
|
187499
|
+
if (fs37.existsSync(resolvedFromProject)) {
|
|
187488
187500
|
return {
|
|
187489
187501
|
id: normalizePathSeparators(resolvedFromProject),
|
|
187490
187502
|
external: true
|
|
@@ -187497,8 +187509,8 @@ var createStaticAssetPlugin = ({
|
|
|
187497
187509
|
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
187498
187510
|
for (const target of targets) {
|
|
187499
187511
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
187500
|
-
const resolvedTarget =
|
|
187501
|
-
if (
|
|
187512
|
+
const resolvedTarget = path38.resolve(resolvedBaseUrl, targetPath);
|
|
187513
|
+
if (fs37.existsSync(resolvedTarget)) {
|
|
187502
187514
|
return {
|
|
187503
187515
|
id: normalizePathSeparators(resolvedTarget),
|
|
187504
187516
|
external: true
|
|
@@ -187524,18 +187536,18 @@ var createStaticAssetPlugin = ({
|
|
|
187524
187536
|
if (chunk.type !== "chunk")
|
|
187525
187537
|
continue;
|
|
187526
187538
|
for (const importedId of chunk.imports) {
|
|
187527
|
-
const ext =
|
|
187539
|
+
const ext = path38.extname(importedId).toLowerCase();
|
|
187528
187540
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
187529
187541
|
continue;
|
|
187530
187542
|
if (!copiedAssets.has(importedId)) {
|
|
187531
|
-
const assetDir =
|
|
187532
|
-
|
|
187533
|
-
const nativePath = importedId.split("/").join(
|
|
187534
|
-
const fileBuffer =
|
|
187543
|
+
const assetDir = path38.join(outputDir, "assets");
|
|
187544
|
+
fs37.mkdirSync(assetDir, { recursive: true });
|
|
187545
|
+
const nativePath = importedId.split("/").join(path38.sep);
|
|
187546
|
+
const fileBuffer = fs37.readFileSync(nativePath);
|
|
187535
187547
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
187536
|
-
const fileName = `${
|
|
187537
|
-
const outputFilePath =
|
|
187538
|
-
|
|
187548
|
+
const fileName = `${path38.basename(importedId, ext)}-${hash}${ext}`;
|
|
187549
|
+
const outputFilePath = path38.join(assetDir, fileName);
|
|
187550
|
+
fs37.writeFileSync(outputFilePath, fileBuffer);
|
|
187539
187551
|
copiedAssets.set(importedId, `./assets/${fileName}`);
|
|
187540
187552
|
assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
|
|
187541
187553
|
}
|
|
@@ -187557,17 +187569,17 @@ function escapeRegExp(string) {
|
|
|
187557
187569
|
|
|
187558
187570
|
// cli/build/transpile/index.ts
|
|
187559
187571
|
var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
187560
|
-
if (id2.startsWith(".") || id2.startsWith("/") ||
|
|
187572
|
+
if (id2.startsWith(".") || id2.startsWith("/") || path39.isAbsolute(id2)) {
|
|
187561
187573
|
return false;
|
|
187562
187574
|
}
|
|
187563
187575
|
let baseUrl = projectDir;
|
|
187564
187576
|
let pathMappings = {};
|
|
187565
|
-
if (tsconfigPath &&
|
|
187577
|
+
if (tsconfigPath && fs38.existsSync(tsconfigPath)) {
|
|
187566
187578
|
try {
|
|
187567
|
-
const tsconfigContent =
|
|
187579
|
+
const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
|
|
187568
187580
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
187569
187581
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
187570
|
-
baseUrl =
|
|
187582
|
+
baseUrl = path39.resolve(path39.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
187571
187583
|
}
|
|
187572
187584
|
if (tsconfig.compilerOptions?.paths) {
|
|
187573
187585
|
pathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -187581,17 +187593,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
187581
187593
|
}
|
|
187582
187594
|
}
|
|
187583
187595
|
const potentialPaths = [
|
|
187584
|
-
|
|
187585
|
-
|
|
187586
|
-
|
|
187587
|
-
|
|
187588
|
-
|
|
187589
|
-
|
|
187590
|
-
|
|
187591
|
-
|
|
187592
|
-
|
|
187596
|
+
path39.join(baseUrl, id2),
|
|
187597
|
+
path39.join(baseUrl, `${id2}.ts`),
|
|
187598
|
+
path39.join(baseUrl, `${id2}.tsx`),
|
|
187599
|
+
path39.join(baseUrl, `${id2}.js`),
|
|
187600
|
+
path39.join(baseUrl, `${id2}.jsx`),
|
|
187601
|
+
path39.join(baseUrl, id2, "index.ts"),
|
|
187602
|
+
path39.join(baseUrl, id2, "index.tsx"),
|
|
187603
|
+
path39.join(baseUrl, id2, "index.js"),
|
|
187604
|
+
path39.join(baseUrl, id2, "index.jsx")
|
|
187593
187605
|
];
|
|
187594
|
-
if (potentialPaths.some((p) =>
|
|
187606
|
+
if (potentialPaths.some((p) => fs38.existsSync(p))) {
|
|
187595
187607
|
return false;
|
|
187596
187608
|
}
|
|
187597
187609
|
return true;
|
|
@@ -187602,17 +187614,17 @@ var transpileFile = async ({
|
|
|
187602
187614
|
projectDir
|
|
187603
187615
|
}) => {
|
|
187604
187616
|
try {
|
|
187605
|
-
|
|
187606
|
-
const tsconfigPath =
|
|
187607
|
-
const hasTsConfig =
|
|
187617
|
+
fs38.mkdirSync(outputDir, { recursive: true });
|
|
187618
|
+
const tsconfigPath = path39.join(projectDir, "tsconfig.json");
|
|
187619
|
+
const hasTsConfig = fs38.existsSync(tsconfigPath);
|
|
187608
187620
|
let tsconfigBaseUrl = projectDir;
|
|
187609
187621
|
let tsconfigPathMappings;
|
|
187610
187622
|
if (hasTsConfig) {
|
|
187611
187623
|
try {
|
|
187612
|
-
const tsconfigContent =
|
|
187624
|
+
const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
|
|
187613
187625
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
187614
187626
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
187615
|
-
tsconfigBaseUrl =
|
|
187627
|
+
tsconfigBaseUrl = path39.resolve(path39.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
187616
187628
|
}
|
|
187617
187629
|
if (tsconfig.compilerOptions?.paths) {
|
|
187618
187630
|
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -187667,27 +187679,27 @@ var transpileFile = async ({
|
|
|
187667
187679
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
187668
187680
|
plugins: getPlugins()
|
|
187669
187681
|
});
|
|
187670
|
-
const esmOutputPath =
|
|
187682
|
+
const esmOutputPath = path39.join(outputDir, "index.js");
|
|
187671
187683
|
await esmBundle.write({
|
|
187672
187684
|
file: esmOutputPath,
|
|
187673
187685
|
format: "es",
|
|
187674
187686
|
sourcemap: false
|
|
187675
187687
|
});
|
|
187676
|
-
console.log(`ESM bundle written to ${
|
|
187688
|
+
console.log(`ESM bundle written to ${path39.relative(projectDir, esmOutputPath)}`);
|
|
187677
187689
|
console.log("Building CommonJS bundle...");
|
|
187678
187690
|
const cjsBundle = await rollup({
|
|
187679
187691
|
input,
|
|
187680
187692
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
187681
187693
|
plugins: getPlugins()
|
|
187682
187694
|
});
|
|
187683
|
-
const cjsOutputPath =
|
|
187695
|
+
const cjsOutputPath = path39.join(outputDir, "index.cjs");
|
|
187684
187696
|
console.log("Writing CJS bundle to:", cjsOutputPath);
|
|
187685
187697
|
await cjsBundle.write({
|
|
187686
187698
|
file: cjsOutputPath,
|
|
187687
187699
|
format: "cjs",
|
|
187688
187700
|
sourcemap: false
|
|
187689
187701
|
});
|
|
187690
|
-
console.log(`CommonJS bundle written to ${
|
|
187702
|
+
console.log(`CommonJS bundle written to ${path39.relative(projectDir, cjsOutputPath)}`);
|
|
187691
187703
|
console.log("Generating type declarations...");
|
|
187692
187704
|
const dtsBundle = await rollup({
|
|
187693
187705
|
input,
|
|
@@ -187712,9 +187724,9 @@ var transpileFile = async ({
|
|
|
187712
187724
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
187713
187725
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
187714
187726
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
187715
|
-
const dtsOutputPath =
|
|
187716
|
-
|
|
187717
|
-
console.log(`Type declarations written to ${
|
|
187727
|
+
const dtsOutputPath = path39.join(outputDir, "index.d.ts");
|
|
187728
|
+
fs38.writeFileSync(dtsOutputPath, dtsContent);
|
|
187729
|
+
console.log(`Type declarations written to ${path39.relative(projectDir, dtsOutputPath)}`);
|
|
187718
187730
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
187719
187731
|
return true;
|
|
187720
187732
|
} catch (err) {
|
|
@@ -187727,17 +187739,17 @@ var transpileFile = async ({
|
|
|
187727
187739
|
};
|
|
187728
187740
|
|
|
187729
187741
|
// cli/utils/validate-main-in-dist.ts
|
|
187730
|
-
import
|
|
187731
|
-
import
|
|
187742
|
+
import fs39 from "node:fs";
|
|
187743
|
+
import path40 from "node:path";
|
|
187732
187744
|
var validateMainInDist = (projectDir, distDir) => {
|
|
187733
|
-
const packageJsonPath =
|
|
187734
|
-
if (!
|
|
187745
|
+
const packageJsonPath = path40.join(projectDir, "package.json");
|
|
187746
|
+
if (!fs39.existsSync(packageJsonPath))
|
|
187735
187747
|
return;
|
|
187736
|
-
const packageJson = JSON.parse(
|
|
187748
|
+
const packageJson = JSON.parse(fs39.readFileSync(packageJsonPath, "utf-8"));
|
|
187737
187749
|
if (typeof packageJson.main !== "string")
|
|
187738
187750
|
return;
|
|
187739
|
-
const resolvedMainPath =
|
|
187740
|
-
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${
|
|
187751
|
+
const resolvedMainPath = path40.resolve(projectDir, packageJson.main);
|
|
187752
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path40.sep}`);
|
|
187741
187753
|
if (!isMainInDist) {
|
|
187742
187754
|
console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
187743
187755
|
}
|
|
@@ -187762,8 +187774,8 @@ var registerBuild = (program3) => {
|
|
|
187762
187774
|
}
|
|
187763
187775
|
return config;
|
|
187764
187776
|
})();
|
|
187765
|
-
const distDir =
|
|
187766
|
-
|
|
187777
|
+
const distDir = path41.join(projectDir, "dist");
|
|
187778
|
+
fs40.mkdirSync(distDir, { recursive: true });
|
|
187767
187779
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
187768
187780
|
let hasErrors = false;
|
|
187769
187781
|
const staticFileReferences = [];
|
|
@@ -187771,10 +187783,10 @@ var registerBuild = (program3) => {
|
|
|
187771
187783
|
const kicadProjects = [];
|
|
187772
187784
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
187773
187785
|
for (const filePath of circuitFiles) {
|
|
187774
|
-
const relative9 =
|
|
187786
|
+
const relative9 = path41.relative(projectDir, filePath);
|
|
187775
187787
|
console.log(`Building ${relative9}...`);
|
|
187776
187788
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
187777
|
-
const outputPath =
|
|
187789
|
+
const outputPath = path41.join(distDir, outputDirName, "circuit.json");
|
|
187778
187790
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
187779
187791
|
ignoreErrors: options?.ignoreErrors,
|
|
187780
187792
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -187788,17 +187800,17 @@ var registerBuild = (program3) => {
|
|
|
187788
187800
|
if (!buildOutcome.ok) {
|
|
187789
187801
|
hasErrors = true;
|
|
187790
187802
|
} else if (options?.site) {
|
|
187791
|
-
const normalizedSourcePath = relative9.split(
|
|
187792
|
-
const relativeOutputPath =
|
|
187793
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
187803
|
+
const normalizedSourcePath = relative9.split(path41.sep).join("/");
|
|
187804
|
+
const relativeOutputPath = path41.join(outputDirName, "circuit.json");
|
|
187805
|
+
const normalizedOutputPath = relativeOutputPath.split(path41.sep).join("/");
|
|
187794
187806
|
staticFileReferences.push({
|
|
187795
187807
|
filePath: normalizedSourcePath,
|
|
187796
187808
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
187797
187809
|
});
|
|
187798
187810
|
}
|
|
187799
187811
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
187800
|
-
const projectOutputDir =
|
|
187801
|
-
const projectName =
|
|
187812
|
+
const projectOutputDir = path41.join(distDir, outputDirName, "kicad");
|
|
187813
|
+
const projectName = path41.basename(outputDirName);
|
|
187802
187814
|
const project = await generateKicadProject({
|
|
187803
187815
|
circuitJson: buildOutcome.circuitJson,
|
|
187804
187816
|
outputDir: projectOutputDir,
|
|
@@ -187851,8 +187863,8 @@ var registerBuild = (program3) => {
|
|
|
187851
187863
|
files: staticFileReferences,
|
|
187852
187864
|
standaloneScriptSrc: "./standalone.min.js"
|
|
187853
187865
|
});
|
|
187854
|
-
|
|
187855
|
-
|
|
187866
|
+
fs40.writeFileSync(path41.join(distDir, "index.html"), indexHtml);
|
|
187867
|
+
fs40.writeFileSync(path41.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
187856
187868
|
}
|
|
187857
187869
|
if (options?.kicadFootprintLibrary) {
|
|
187858
187870
|
if (kicadProjects.length === 0) {
|
|
@@ -187875,8 +187887,8 @@ var registerBuild = (program3) => {
|
|
|
187875
187887
|
};
|
|
187876
187888
|
|
|
187877
187889
|
// lib/shared/snapshot-project.ts
|
|
187878
|
-
import
|
|
187879
|
-
import
|
|
187890
|
+
import fs42 from "node:fs";
|
|
187891
|
+
import path42 from "node:path";
|
|
187880
187892
|
import looksSame2 from "looks-same";
|
|
187881
187893
|
import {
|
|
187882
187894
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -187887,7 +187899,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
187887
187899
|
|
|
187888
187900
|
// lib/shared/compare-images.ts
|
|
187889
187901
|
import looksSame from "looks-same";
|
|
187890
|
-
import
|
|
187902
|
+
import fs41 from "node:fs/promises";
|
|
187891
187903
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
187892
187904
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
187893
187905
|
strict: false,
|
|
@@ -187903,7 +187915,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
187903
187915
|
tolerance: 2
|
|
187904
187916
|
});
|
|
187905
187917
|
} else {
|
|
187906
|
-
await
|
|
187918
|
+
await fs41.writeFile(diffPath, buffer2);
|
|
187907
187919
|
}
|
|
187908
187920
|
}
|
|
187909
187921
|
return { equal: equal2 };
|
|
@@ -187928,7 +187940,7 @@ var snapshotProject = async ({
|
|
|
187928
187940
|
...DEFAULT_IGNORED_PATTERNS,
|
|
187929
187941
|
...ignored.map(normalizeIgnorePattern)
|
|
187930
187942
|
];
|
|
187931
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
187943
|
+
const resolvedPaths = filePaths.map((f) => path42.resolve(projectDir, f));
|
|
187932
187944
|
const boardFiles = findBoardFiles({
|
|
187933
187945
|
projectDir,
|
|
187934
187946
|
ignore,
|
|
@@ -187942,7 +187954,7 @@ var snapshotProject = async ({
|
|
|
187942
187954
|
const mismatches = [];
|
|
187943
187955
|
let didUpdate = false;
|
|
187944
187956
|
for (const file of boardFiles) {
|
|
187945
|
-
const relativeFilePath =
|
|
187957
|
+
const relativeFilePath = path42.relative(projectDir, file);
|
|
187946
187958
|
let circuitJson;
|
|
187947
187959
|
let pcbSvg;
|
|
187948
187960
|
let schSvg;
|
|
@@ -187997,17 +188009,17 @@ var snapshotProject = async ({
|
|
|
187997
188009
|
} catch (error) {
|
|
187998
188010
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
187999
188011
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
188000
|
-
const fileDir =
|
|
188001
|
-
const relativeDir =
|
|
188002
|
-
const snapDir2 = snapshotsDirName ?
|
|
188003
|
-
const base2 =
|
|
188004
|
-
const snap3dPath =
|
|
188005
|
-
const existing3dSnapshot =
|
|
188012
|
+
const fileDir = path42.dirname(file);
|
|
188013
|
+
const relativeDir = path42.relative(projectDir, fileDir);
|
|
188014
|
+
const snapDir2 = snapshotsDirName ? path42.join(projectDir, snapshotsDirName, relativeDir) : path42.join(fileDir, "__snapshots__");
|
|
188015
|
+
const base2 = path42.basename(file).replace(/\.tsx$/, "");
|
|
188016
|
+
const snap3dPath = path42.join(snapDir2, `${base2}-3d.snap.png`);
|
|
188017
|
+
const existing3dSnapshot = fs42.existsSync(snap3dPath);
|
|
188006
188018
|
if (existing3dSnapshot) {
|
|
188007
188019
|
onError(kleur_default.red(`
|
|
188008
188020
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
188009
188021
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
188010
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
188022
|
+
`) + kleur_default.red(` Existing snapshot: ${path42.relative(projectDir, snap3dPath)}
|
|
188011
188023
|
`));
|
|
188012
188024
|
return onExit2(1);
|
|
188013
188025
|
} else {
|
|
@@ -188023,9 +188035,9 @@ var snapshotProject = async ({
|
|
|
188023
188035
|
}
|
|
188024
188036
|
}
|
|
188025
188037
|
}
|
|
188026
|
-
const snapDir = snapshotsDirName ?
|
|
188027
|
-
|
|
188028
|
-
const base =
|
|
188038
|
+
const snapDir = snapshotsDirName ? path42.join(projectDir, snapshotsDirName, path42.relative(projectDir, path42.dirname(file))) : path42.join(path42.dirname(file), "__snapshots__");
|
|
188039
|
+
fs42.mkdirSync(snapDir, { recursive: true });
|
|
188040
|
+
const base = path42.basename(file).replace(/\.tsx$/, "");
|
|
188029
188041
|
const snapshots = [];
|
|
188030
188042
|
if (pcbOnly || !schematicOnly) {
|
|
188031
188043
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -188043,31 +188055,31 @@ var snapshotProject = async ({
|
|
|
188043
188055
|
for (const snapshot of snapshots) {
|
|
188044
188056
|
const { type } = snapshot;
|
|
188045
188057
|
const is3d = type === "3d";
|
|
188046
|
-
const snapPath =
|
|
188047
|
-
const existing =
|
|
188058
|
+
const snapPath = path42.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
188059
|
+
const existing = fs42.existsSync(snapPath);
|
|
188048
188060
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
188049
188061
|
const newContentForFile = snapshot.content;
|
|
188050
188062
|
if (!existing) {
|
|
188051
|
-
|
|
188052
|
-
console.log("✅", kleur_default.gray(
|
|
188063
|
+
fs42.writeFileSync(snapPath, newContentForFile);
|
|
188064
|
+
console.log("✅", kleur_default.gray(path42.relative(projectDir, snapPath)));
|
|
188053
188065
|
didUpdate = true;
|
|
188054
188066
|
continue;
|
|
188055
188067
|
}
|
|
188056
|
-
const oldContentBuffer =
|
|
188068
|
+
const oldContentBuffer = fs42.readFileSync(snapPath);
|
|
188057
188069
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
188058
188070
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
188059
188071
|
if (update) {
|
|
188060
188072
|
if (!forceUpdate && equal2) {
|
|
188061
|
-
console.log("✅", kleur_default.gray(
|
|
188073
|
+
console.log("✅", kleur_default.gray(path42.relative(projectDir, snapPath)));
|
|
188062
188074
|
} else {
|
|
188063
|
-
|
|
188064
|
-
console.log("✅", kleur_default.gray(
|
|
188075
|
+
fs42.writeFileSync(snapPath, newContentForFile);
|
|
188076
|
+
console.log("✅", kleur_default.gray(path42.relative(projectDir, snapPath)));
|
|
188065
188077
|
didUpdate = true;
|
|
188066
188078
|
}
|
|
188067
188079
|
} else if (!equal2) {
|
|
188068
188080
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
188069
188081
|
} else {
|
|
188070
|
-
console.log("✅", kleur_default.gray(
|
|
188082
|
+
console.log("✅", kleur_default.gray(path42.relative(projectDir, snapPath)));
|
|
188071
188083
|
}
|
|
188072
188084
|
}
|
|
188073
188085
|
}
|
|
@@ -188106,22 +188118,22 @@ var registerSnapshot = (program3) => {
|
|
|
188106
188118
|
};
|
|
188107
188119
|
|
|
188108
188120
|
// lib/shared/setup-github-actions.ts
|
|
188109
|
-
import
|
|
188110
|
-
import
|
|
188121
|
+
import fs43 from "node:fs";
|
|
188122
|
+
import path43 from "node:path";
|
|
188111
188123
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
188112
188124
|
const findGitRoot = (startDir) => {
|
|
188113
|
-
let dir =
|
|
188114
|
-
while (dir !==
|
|
188115
|
-
if (
|
|
188125
|
+
let dir = path43.resolve(startDir);
|
|
188126
|
+
while (dir !== path43.parse(dir).root) {
|
|
188127
|
+
if (fs43.existsSync(path43.join(dir, ".git"))) {
|
|
188116
188128
|
return dir;
|
|
188117
188129
|
}
|
|
188118
|
-
dir =
|
|
188130
|
+
dir = path43.dirname(dir);
|
|
188119
188131
|
}
|
|
188120
188132
|
return null;
|
|
188121
188133
|
};
|
|
188122
188134
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
188123
|
-
const workflowsDir =
|
|
188124
|
-
|
|
188135
|
+
const workflowsDir = path43.join(gitRoot, ".github", "workflows");
|
|
188136
|
+
fs43.mkdirSync(workflowsDir, { recursive: true });
|
|
188125
188137
|
const buildWorkflow = `name: tscircuit Build
|
|
188126
188138
|
|
|
188127
188139
|
on:
|
|
@@ -188160,8 +188172,8 @@ jobs:
|
|
|
188160
188172
|
- run: bun install
|
|
188161
188173
|
- run: bunx tsci snapshot
|
|
188162
188174
|
`;
|
|
188163
|
-
writeFileIfNotExists(
|
|
188164
|
-
writeFileIfNotExists(
|
|
188175
|
+
writeFileIfNotExists(path43.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
188176
|
+
writeFileIfNotExists(path43.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
188165
188177
|
};
|
|
188166
188178
|
|
|
188167
188179
|
// cli/setup/register.ts
|
|
@@ -188199,8 +188211,8 @@ function registerAuthSetupNpmrc(program3) {
|
|
|
188199
188211
|
}
|
|
188200
188212
|
|
|
188201
188213
|
// cli/convert/register.ts
|
|
188202
|
-
import
|
|
188203
|
-
import
|
|
188214
|
+
import fs44 from "node:fs/promises";
|
|
188215
|
+
import path44 from "node:path";
|
|
188204
188216
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
188205
188217
|
|
|
188206
188218
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -188320,15 +188332,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
188320
188332
|
var registerConvert = (program3) => {
|
|
188321
188333
|
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) => {
|
|
188322
188334
|
try {
|
|
188323
|
-
const inputPath =
|
|
188324
|
-
const modContent = await
|
|
188335
|
+
const inputPath = path44.resolve(file);
|
|
188336
|
+
const modContent = await fs44.readFile(inputPath, "utf-8");
|
|
188325
188337
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
188326
|
-
const componentName = options.name ??
|
|
188338
|
+
const componentName = options.name ?? path44.basename(inputPath, ".kicad_mod");
|
|
188327
188339
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
188328
188340
|
componentName
|
|
188329
188341
|
});
|
|
188330
|
-
const outputPath = options.output ?
|
|
188331
|
-
await
|
|
188342
|
+
const outputPath = options.output ? path44.resolve(options.output) : path44.join(path44.dirname(inputPath), `${componentName}.tsx`);
|
|
188343
|
+
await fs44.writeFile(outputPath, tsx);
|
|
188332
188344
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
188333
188345
|
} catch (error) {
|
|
188334
188346
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|
|
@@ -188424,12 +188436,12 @@ var registerSimulate = (program3) => {
|
|
|
188424
188436
|
};
|
|
188425
188437
|
|
|
188426
188438
|
// lib/shared/install-project-dependencies.ts
|
|
188427
|
-
import
|
|
188428
|
-
import
|
|
188439
|
+
import fs46 from "node:fs";
|
|
188440
|
+
import path46 from "node:path";
|
|
188429
188441
|
|
|
188430
188442
|
// lib/shared/collect-tsci-dependencies.ts
|
|
188431
|
-
import
|
|
188432
|
-
import
|
|
188443
|
+
import fs45 from "node:fs";
|
|
188444
|
+
import path45 from "node:path";
|
|
188433
188445
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
188434
188446
|
var DEFAULT_IGNORES = [
|
|
188435
188447
|
"**/node_modules/**",
|
|
@@ -188444,7 +188456,7 @@ function collectTsciDependencies({
|
|
|
188444
188456
|
patterns = DEFAULT_PATTERNS,
|
|
188445
188457
|
ignore = DEFAULT_IGNORES
|
|
188446
188458
|
} = {}) {
|
|
188447
|
-
const searchRoot =
|
|
188459
|
+
const searchRoot = path45.resolve(cwd);
|
|
188448
188460
|
const files = globbySync(patterns, {
|
|
188449
188461
|
cwd: searchRoot,
|
|
188450
188462
|
absolute: true,
|
|
@@ -188454,7 +188466,7 @@ function collectTsciDependencies({
|
|
|
188454
188466
|
const dependencies2 = new Set;
|
|
188455
188467
|
for (const filePath of files) {
|
|
188456
188468
|
try {
|
|
188457
|
-
const fileContents =
|
|
188469
|
+
const fileContents = fs45.readFileSync(filePath, "utf-8");
|
|
188458
188470
|
let match;
|
|
188459
188471
|
while (true) {
|
|
188460
188472
|
match = IMPORT_PATTERN.exec(fileContents);
|
|
@@ -188471,26 +188483,26 @@ function collectTsciDependencies({
|
|
|
188471
188483
|
async function installProjectDependencies({
|
|
188472
188484
|
cwd = process.cwd()
|
|
188473
188485
|
} = {}) {
|
|
188474
|
-
const projectRoot =
|
|
188475
|
-
const packageJsonPath =
|
|
188476
|
-
const npmrcPath =
|
|
188486
|
+
const projectRoot = path46.resolve(cwd);
|
|
188487
|
+
const packageJsonPath = path46.join(projectRoot, "package.json");
|
|
188488
|
+
const npmrcPath = path46.join(projectRoot, ".npmrc");
|
|
188477
188489
|
const packageManager = getPackageManager();
|
|
188478
|
-
if (!
|
|
188490
|
+
if (!fs46.existsSync(projectRoot)) {
|
|
188479
188491
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
188480
188492
|
}
|
|
188481
188493
|
let packageJsonCreated = false;
|
|
188482
|
-
if (!
|
|
188494
|
+
if (!fs46.existsSync(packageJsonPath)) {
|
|
188483
188495
|
console.log("No package.json found. Generating a new one.");
|
|
188484
188496
|
generatePackageJson(projectRoot);
|
|
188485
188497
|
packageJsonCreated = true;
|
|
188486
188498
|
} else {
|
|
188487
188499
|
console.log("Found existing package.json.");
|
|
188488
188500
|
}
|
|
188489
|
-
if (!
|
|
188501
|
+
if (!fs46.existsSync(npmrcPath)) {
|
|
188490
188502
|
console.log("Creating .npmrc with tscircuit registry configuration.");
|
|
188491
|
-
|
|
188503
|
+
fs46.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
|
|
188492
188504
|
}
|
|
188493
|
-
const packageJson = JSON.parse(
|
|
188505
|
+
const packageJson = JSON.parse(fs46.readFileSync(packageJsonPath, "utf-8"));
|
|
188494
188506
|
if (packageJsonCreated) {
|
|
188495
188507
|
const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
|
|
188496
188508
|
if (tsciDependencies.length > 0) {
|
|
@@ -188505,7 +188517,7 @@ async function installProjectDependencies({
|
|
|
188505
188517
|
console.log("No @tsci dependencies detected in circuit files.");
|
|
188506
188518
|
}
|
|
188507
188519
|
}
|
|
188508
|
-
|
|
188520
|
+
fs46.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
188509
188521
|
`);
|
|
188510
188522
|
console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
|
|
188511
188523
|
try {
|
|
@@ -188540,7 +188552,7 @@ var registerInstall = (program3) => {
|
|
|
188540
188552
|
};
|
|
188541
188553
|
|
|
188542
188554
|
// cli/transpile/register.ts
|
|
188543
|
-
import
|
|
188555
|
+
import path47 from "node:path";
|
|
188544
188556
|
var registerTranspile = (program3) => {
|
|
188545
188557
|
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
188546
188558
|
try {
|
|
@@ -188548,7 +188560,7 @@ var registerTranspile = (program3) => {
|
|
|
188548
188560
|
fileOrDir: file,
|
|
188549
188561
|
includeBoardFiles: false
|
|
188550
188562
|
});
|
|
188551
|
-
const distDir =
|
|
188563
|
+
const distDir = path47.join(projectDir, "dist");
|
|
188552
188564
|
validateMainInDist(projectDir, distDir);
|
|
188553
188565
|
console.log("Transpiling entry file...");
|
|
188554
188566
|
const entryFile = mainEntrypoint || circuitFiles[0];
|