@tscircuit/cli 0.1.625 → 0.1.627
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 +578 -500
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -60652,8 +60652,8 @@ var require_utils6 = __commonJS((exports2) => {
|
|
|
60652
60652
|
var result = transform[inputType][outputType](input);
|
|
60653
60653
|
return result;
|
|
60654
60654
|
};
|
|
60655
|
-
exports2.resolve = function(
|
|
60656
|
-
var parts =
|
|
60655
|
+
exports2.resolve = function(path23) {
|
|
60656
|
+
var parts = path23.split("/");
|
|
60657
60657
|
var result = [];
|
|
60658
60658
|
for (var index = 0;index < parts.length; index++) {
|
|
60659
60659
|
var part = parts[index];
|
|
@@ -66103,18 +66103,18 @@ var require_object = __commonJS((exports2, module2) => {
|
|
|
66103
66103
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
66104
66104
|
this.files[name] = object;
|
|
66105
66105
|
};
|
|
66106
|
-
var parentFolder = function(
|
|
66107
|
-
if (
|
|
66108
|
-
|
|
66106
|
+
var parentFolder = function(path23) {
|
|
66107
|
+
if (path23.slice(-1) === "/") {
|
|
66108
|
+
path23 = path23.substring(0, path23.length - 1);
|
|
66109
66109
|
}
|
|
66110
|
-
var lastSlash =
|
|
66111
|
-
return lastSlash > 0 ?
|
|
66110
|
+
var lastSlash = path23.lastIndexOf("/");
|
|
66111
|
+
return lastSlash > 0 ? path23.substring(0, lastSlash) : "";
|
|
66112
66112
|
};
|
|
66113
|
-
var forceTrailingSlash = function(
|
|
66114
|
-
if (
|
|
66115
|
-
|
|
66113
|
+
var forceTrailingSlash = function(path23) {
|
|
66114
|
+
if (path23.slice(-1) !== "/") {
|
|
66115
|
+
path23 += "/";
|
|
66116
66116
|
}
|
|
66117
|
-
return
|
|
66117
|
+
return path23;
|
|
66118
66118
|
};
|
|
66119
66119
|
var folderAdd = function(name, createFolders) {
|
|
66120
66120
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -67193,7 +67193,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67193
67193
|
});
|
|
67194
67194
|
};
|
|
67195
67195
|
traverse(program3, []);
|
|
67196
|
-
return allCommandPaths.filter((
|
|
67196
|
+
return allCommandPaths.filter((path26) => path26 !== "");
|
|
67197
67197
|
};
|
|
67198
67198
|
var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
|
|
67199
67199
|
var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
|
|
@@ -67201,7 +67201,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
67201
67201
|
return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
|
|
67202
67202
|
};
|
|
67203
67203
|
var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
|
|
67204
|
-
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((
|
|
67204
|
+
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path26) => normalizeCommandName(path26));
|
|
67205
67205
|
const commandPath = [];
|
|
67206
67206
|
for (const elm of commandPathAndPositionalArgs) {
|
|
67207
67207
|
if (elm.startsWith("-"))
|
|
@@ -67488,7 +67488,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67488
67488
|
"node_modules/fs.realpath/old.js"(exports3) {
|
|
67489
67489
|
var pathModule = __require("path");
|
|
67490
67490
|
var isWindows2 = process.platform === "win32";
|
|
67491
|
-
var
|
|
67491
|
+
var fs24 = __require("fs");
|
|
67492
67492
|
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
67493
67493
|
function rethrow() {
|
|
67494
67494
|
var callback;
|
|
@@ -67553,7 +67553,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67553
67553
|
base = m2[0];
|
|
67554
67554
|
previous = "";
|
|
67555
67555
|
if (isWindows2 && !knownHard[base]) {
|
|
67556
|
-
|
|
67556
|
+
fs24.lstatSync(base);
|
|
67557
67557
|
knownHard[base] = true;
|
|
67558
67558
|
}
|
|
67559
67559
|
}
|
|
@@ -67571,7 +67571,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67571
67571
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
67572
67572
|
resolvedLink = cache[base];
|
|
67573
67573
|
} else {
|
|
67574
|
-
var stat4 =
|
|
67574
|
+
var stat4 = fs24.lstatSync(base);
|
|
67575
67575
|
if (!stat4.isSymbolicLink()) {
|
|
67576
67576
|
knownHard[base] = true;
|
|
67577
67577
|
if (cache)
|
|
@@ -67586,8 +67586,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67586
67586
|
}
|
|
67587
67587
|
}
|
|
67588
67588
|
if (linkTarget === null) {
|
|
67589
|
-
|
|
67590
|
-
linkTarget =
|
|
67589
|
+
fs24.statSync(base);
|
|
67590
|
+
linkTarget = fs24.readlinkSync(base);
|
|
67591
67591
|
}
|
|
67592
67592
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
67593
67593
|
if (cache)
|
|
@@ -67624,7 +67624,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67624
67624
|
base = m2[0];
|
|
67625
67625
|
previous = "";
|
|
67626
67626
|
if (isWindows2 && !knownHard[base]) {
|
|
67627
|
-
|
|
67627
|
+
fs24.lstat(base, function(err) {
|
|
67628
67628
|
if (err)
|
|
67629
67629
|
return cb(err);
|
|
67630
67630
|
knownHard[base] = true;
|
|
@@ -67652,7 +67652,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67652
67652
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
67653
67653
|
return gotResolvedLink(cache[base]);
|
|
67654
67654
|
}
|
|
67655
|
-
return
|
|
67655
|
+
return fs24.lstat(base, gotStat);
|
|
67656
67656
|
}
|
|
67657
67657
|
function gotStat(err, stat4) {
|
|
67658
67658
|
if (err)
|
|
@@ -67669,10 +67669,10 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67669
67669
|
return gotTarget(null, seenLinks[id], base);
|
|
67670
67670
|
}
|
|
67671
67671
|
}
|
|
67672
|
-
|
|
67672
|
+
fs24.stat(base, function(err2) {
|
|
67673
67673
|
if (err2)
|
|
67674
67674
|
return cb(err2);
|
|
67675
|
-
|
|
67675
|
+
fs24.readlink(base, function(err3, target) {
|
|
67676
67676
|
if (!isWindows2)
|
|
67677
67677
|
seenLinks[id] = target;
|
|
67678
67678
|
gotTarget(err3, target);
|
|
@@ -67702,9 +67702,9 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67702
67702
|
realpath2.realpathSync = realpathSync;
|
|
67703
67703
|
realpath2.monkeypatch = monkeypatch;
|
|
67704
67704
|
realpath2.unmonkeypatch = unmonkeypatch;
|
|
67705
|
-
var
|
|
67706
|
-
var origRealpath =
|
|
67707
|
-
var origRealpathSync =
|
|
67705
|
+
var fs24 = __require("fs");
|
|
67706
|
+
var origRealpath = fs24.realpath;
|
|
67707
|
+
var origRealpathSync = fs24.realpathSync;
|
|
67708
67708
|
var version2 = process.version;
|
|
67709
67709
|
var ok = /^v[0-5]\./.test(version2);
|
|
67710
67710
|
var old = require_old();
|
|
@@ -67742,12 +67742,12 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67742
67742
|
}
|
|
67743
67743
|
}
|
|
67744
67744
|
function monkeypatch() {
|
|
67745
|
-
|
|
67746
|
-
|
|
67745
|
+
fs24.realpath = realpath2;
|
|
67746
|
+
fs24.realpathSync = realpathSync;
|
|
67747
67747
|
}
|
|
67748
67748
|
function unmonkeypatch() {
|
|
67749
|
-
|
|
67750
|
-
|
|
67749
|
+
fs24.realpath = origRealpath;
|
|
67750
|
+
fs24.realpathSync = origRealpathSync;
|
|
67751
67751
|
}
|
|
67752
67752
|
}
|
|
67753
67753
|
});
|
|
@@ -67973,8 +67973,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
|
|
|
67973
67973
|
return new Minimatch(pattern, options).match(p);
|
|
67974
67974
|
};
|
|
67975
67975
|
module22.exports = minimatch;
|
|
67976
|
-
var
|
|
67977
|
-
minimatch.sep =
|
|
67976
|
+
var path26 = require_path2();
|
|
67977
|
+
minimatch.sep = path26.sep;
|
|
67978
67978
|
var GLOBSTAR = Symbol("globstar **");
|
|
67979
67979
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
67980
67980
|
var expand = require_brace_expansion();
|
|
@@ -68465,8 +68465,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68465
68465
|
if (f === "/" && partial)
|
|
68466
68466
|
return true;
|
|
68467
68467
|
const options = this.options;
|
|
68468
|
-
if (
|
|
68469
|
-
f = f.split(
|
|
68468
|
+
if (path26.sep !== "/") {
|
|
68469
|
+
f = f.split(path26.sep).join("/");
|
|
68470
68470
|
}
|
|
68471
68471
|
f = f.split(slashSplit);
|
|
68472
68472
|
this.debug(this.pattern, "split", f);
|
|
@@ -68556,8 +68556,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68556
68556
|
function ownProp(obj, field) {
|
|
68557
68557
|
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
68558
68558
|
}
|
|
68559
|
-
var
|
|
68560
|
-
var
|
|
68559
|
+
var fs24 = __require("fs");
|
|
68560
|
+
var path26 = __require("path");
|
|
68561
68561
|
var minimatch = require_minimatch();
|
|
68562
68562
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68563
68563
|
var Minimatch = minimatch.Minimatch;
|
|
@@ -68611,7 +68611,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68611
68611
|
self2.stat = !!options.stat;
|
|
68612
68612
|
self2.noprocess = !!options.noprocess;
|
|
68613
68613
|
self2.absolute = !!options.absolute;
|
|
68614
|
-
self2.fs = options.fs ||
|
|
68614
|
+
self2.fs = options.fs || fs24;
|
|
68615
68615
|
self2.maxLength = options.maxLength || Infinity;
|
|
68616
68616
|
self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
|
68617
68617
|
self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
|
@@ -68620,13 +68620,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68620
68620
|
self2.changedCwd = false;
|
|
68621
68621
|
var cwd = process.cwd();
|
|
68622
68622
|
if (!ownProp(options, "cwd"))
|
|
68623
|
-
self2.cwd =
|
|
68623
|
+
self2.cwd = path26.resolve(cwd);
|
|
68624
68624
|
else {
|
|
68625
|
-
self2.cwd =
|
|
68625
|
+
self2.cwd = path26.resolve(options.cwd);
|
|
68626
68626
|
self2.changedCwd = self2.cwd !== cwd;
|
|
68627
68627
|
}
|
|
68628
|
-
self2.root = options.root ||
|
|
68629
|
-
self2.root =
|
|
68628
|
+
self2.root = options.root || path26.resolve(self2.cwd, "/");
|
|
68629
|
+
self2.root = path26.resolve(self2.root);
|
|
68630
68630
|
self2.cwdAbs = isAbsolute3(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
|
|
68631
68631
|
self2.nomount = !!options.nomount;
|
|
68632
68632
|
if (process.platform === "win32") {
|
|
@@ -68709,13 +68709,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68709
68709
|
function makeAbs(self2, f) {
|
|
68710
68710
|
var abs = f;
|
|
68711
68711
|
if (f.charAt(0) === "/") {
|
|
68712
|
-
abs =
|
|
68712
|
+
abs = path26.join(self2.root, f);
|
|
68713
68713
|
} else if (isAbsolute3(f) || f === "") {
|
|
68714
68714
|
abs = f;
|
|
68715
68715
|
} else if (self2.changedCwd) {
|
|
68716
|
-
abs =
|
|
68716
|
+
abs = path26.resolve(self2.cwd, f);
|
|
68717
68717
|
} else {
|
|
68718
|
-
abs =
|
|
68718
|
+
abs = path26.resolve(f);
|
|
68719
68719
|
}
|
|
68720
68720
|
if (process.platform === "win32")
|
|
68721
68721
|
abs = abs.replace(/\\/g, "/");
|
|
@@ -68746,7 +68746,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
|
|
|
68746
68746
|
var Minimatch = minimatch.Minimatch;
|
|
68747
68747
|
var Glob = require_glob().Glob;
|
|
68748
68748
|
var util = __require("util");
|
|
68749
|
-
var
|
|
68749
|
+
var path26 = __require("path");
|
|
68750
68750
|
var assert2 = __require("assert");
|
|
68751
68751
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
68752
68752
|
var common = require_common4();
|
|
@@ -68876,7 +68876,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
68876
68876
|
e = prefix + e;
|
|
68877
68877
|
}
|
|
68878
68878
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
68879
|
-
e =
|
|
68879
|
+
e = path26.join(this.root, e);
|
|
68880
68880
|
}
|
|
68881
68881
|
this._emitMatch(index, e);
|
|
68882
68882
|
}
|
|
@@ -69025,9 +69025,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69025
69025
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
69026
69026
|
var trail = /[\/\\]$/.test(prefix);
|
|
69027
69027
|
if (prefix.charAt(0) === "/") {
|
|
69028
|
-
prefix =
|
|
69028
|
+
prefix = path26.join(this.root, prefix);
|
|
69029
69029
|
} else {
|
|
69030
|
-
prefix =
|
|
69030
|
+
prefix = path26.resolve(this.root, prefix);
|
|
69031
69031
|
if (trail)
|
|
69032
69032
|
prefix += "/";
|
|
69033
69033
|
}
|
|
@@ -69214,7 +69214,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69214
69214
|
var Minimatch = minimatch.Minimatch;
|
|
69215
69215
|
var inherits = require_inherits2();
|
|
69216
69216
|
var EE = __require("events").EventEmitter;
|
|
69217
|
-
var
|
|
69217
|
+
var path26 = __require("path");
|
|
69218
69218
|
var assert2 = __require("assert");
|
|
69219
69219
|
var isAbsolute3 = __require("path").isAbsolute;
|
|
69220
69220
|
var globSync = require_sync7();
|
|
@@ -69497,7 +69497,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69497
69497
|
e = prefix + e;
|
|
69498
69498
|
}
|
|
69499
69499
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
69500
|
-
e =
|
|
69500
|
+
e = path26.join(this.root, e);
|
|
69501
69501
|
}
|
|
69502
69502
|
this._emitMatch(index, e);
|
|
69503
69503
|
}
|
|
@@ -69684,9 +69684,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
69684
69684
|
if (prefix && isAbsolute3(prefix) && !this.nomount) {
|
|
69685
69685
|
var trail = /[\/\\]$/.test(prefix);
|
|
69686
69686
|
if (prefix.charAt(0) === "/") {
|
|
69687
|
-
prefix =
|
|
69687
|
+
prefix = path26.join(this.root, prefix);
|
|
69688
69688
|
} else {
|
|
69689
|
-
prefix =
|
|
69689
|
+
prefix = path26.resolve(this.root, prefix);
|
|
69690
69690
|
if (trail)
|
|
69691
69691
|
prefix += "/";
|
|
69692
69692
|
}
|
|
@@ -69870,7 +69870,7 @@ export default {
|
|
|
69870
69870
|
}
|
|
69871
69871
|
case "export-pathlist": {
|
|
69872
69872
|
return `export default [
|
|
69873
|
-
` + Object.keys(vfs).map((
|
|
69873
|
+
` + Object.keys(vfs).map((path26) => ` "${path26}"`).join(`,
|
|
69874
69874
|
`) + `
|
|
69875
69875
|
]`;
|
|
69876
69876
|
}
|
|
@@ -78109,6 +78109,70 @@ function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}
|
|
|
78109
78109
|
var delay2 = createDelay();
|
|
78110
78110
|
var delay_default = delay2;
|
|
78111
78111
|
|
|
78112
|
+
// cli/auth/setup-npmrc/setup-npmrc.ts
|
|
78113
|
+
import * as fs20 from "node:fs";
|
|
78114
|
+
import * as path22 from "node:path";
|
|
78115
|
+
import * as os2 from "node:os";
|
|
78116
|
+
var REGISTRY_URL = "npm.tscircuit.com";
|
|
78117
|
+
function findGlobalNpmrc() {
|
|
78118
|
+
const possiblePaths = [
|
|
78119
|
+
path22.join(os2.homedir(), ".npmrc"),
|
|
78120
|
+
process.env.USERPROFILE ? path22.join(process.env.USERPROFILE, ".npmrc") : null
|
|
78121
|
+
].filter(Boolean);
|
|
78122
|
+
for (const npmrcPath of possiblePaths) {
|
|
78123
|
+
if (fs20.existsSync(npmrcPath)) {
|
|
78124
|
+
return npmrcPath;
|
|
78125
|
+
}
|
|
78126
|
+
}
|
|
78127
|
+
return path22.join(os2.homedir(), ".npmrc");
|
|
78128
|
+
}
|
|
78129
|
+
function printManualInstructions(sessionToken) {
|
|
78130
|
+
console.log(kleur_default.yellow(`
|
|
78131
|
+
Manual setup instructions:`));
|
|
78132
|
+
console.log(kleur_default.gray("─".repeat(50)));
|
|
78133
|
+
console.log(`
|
|
78134
|
+
1. Open or create your global .npmrc file:`);
|
|
78135
|
+
console.log(kleur_default.cyan(` ${path22.join(os2.homedir(), ".npmrc")}`));
|
|
78136
|
+
console.log(`
|
|
78137
|
+
2. Add the following line:`);
|
|
78138
|
+
console.log(kleur_default.cyan(` //${REGISTRY_URL}/:_authToken=${sessionToken}`));
|
|
78139
|
+
}
|
|
78140
|
+
function setupNpmrc(sessionToken) {
|
|
78141
|
+
const authLine = `//${REGISTRY_URL}/:_authToken=${sessionToken}`;
|
|
78142
|
+
const npmrcPath = findGlobalNpmrc();
|
|
78143
|
+
if (!npmrcPath) {
|
|
78144
|
+
console.log(kleur_default.red("Could not find your global .npmrc file location."));
|
|
78145
|
+
printManualInstructions(sessionToken);
|
|
78146
|
+
return false;
|
|
78147
|
+
}
|
|
78148
|
+
try {
|
|
78149
|
+
let existingContent = "";
|
|
78150
|
+
if (fs20.existsSync(npmrcPath)) {
|
|
78151
|
+
existingContent = fs20.readFileSync(npmrcPath, "utf-8");
|
|
78152
|
+
const authLineRegex = new RegExp(`^//${REGISTRY_URL.replace(/\./g, "\\.")}/:_authToken=.+$`, "m");
|
|
78153
|
+
if (authLineRegex.test(existingContent)) {
|
|
78154
|
+
const updatedContent = existingContent.replace(authLineRegex, authLine);
|
|
78155
|
+
fs20.writeFileSync(npmrcPath, updatedContent, "utf-8");
|
|
78156
|
+
console.log(kleur_default.green(`Updated authentication token in ${npmrcPath}`));
|
|
78157
|
+
return true;
|
|
78158
|
+
}
|
|
78159
|
+
}
|
|
78160
|
+
const newContent = existingContent ? existingContent.endsWith(`
|
|
78161
|
+
`) ? `${existingContent}${authLine}
|
|
78162
|
+
` : `${existingContent}
|
|
78163
|
+
${authLine}
|
|
78164
|
+
` : `${authLine}
|
|
78165
|
+
`;
|
|
78166
|
+
fs20.writeFileSync(npmrcPath, newContent, "utf-8");
|
|
78167
|
+
console.log(kleur_default.green(`Added authentication token to ${npmrcPath}`));
|
|
78168
|
+
return true;
|
|
78169
|
+
} catch (error) {
|
|
78170
|
+
console.log(kleur_default.red(`Could not modify .npmrc file: ${error instanceof Error ? error.message : String(error)}`));
|
|
78171
|
+
printManualInstructions(sessionToken);
|
|
78172
|
+
return false;
|
|
78173
|
+
}
|
|
78174
|
+
}
|
|
78175
|
+
|
|
78112
78176
|
// cli/auth/login/register.ts
|
|
78113
78177
|
var registerAuthLogin = (program3) => {
|
|
78114
78178
|
const loginAction = async () => {
|
|
@@ -78152,6 +78216,7 @@ var registerAuthLogin = (program3) => {
|
|
|
78152
78216
|
setSessionToken(session.token);
|
|
78153
78217
|
console.log(`
|
|
78154
78218
|
Ready to use!`);
|
|
78219
|
+
setupNpmrc(session.token);
|
|
78155
78220
|
};
|
|
78156
78221
|
program3.commands.find((c) => c.name() === "auth").command("login").description("Authenticate CLI, login to registry").action(loginAction);
|
|
78157
78222
|
program3.command("login").description("Login to tscircuit registry").action(loginAction);
|
|
@@ -78190,26 +78255,26 @@ var registerConfigPrint = (program3) => {
|
|
|
78190
78255
|
};
|
|
78191
78256
|
|
|
78192
78257
|
// cli/clone/register.ts
|
|
78193
|
-
import * as
|
|
78194
|
-
import * as
|
|
78258
|
+
import * as fs23 from "node:fs";
|
|
78259
|
+
import * as path25 from "node:path";
|
|
78195
78260
|
|
|
78196
78261
|
// cli/clone/clone-bug-report.ts
|
|
78197
78262
|
var import_jszip = __toESM2(require_lib4(), 1);
|
|
78198
78263
|
var import_prompts7 = __toESM2(require_prompts3(), 1);
|
|
78199
|
-
import * as
|
|
78200
|
-
import * as
|
|
78264
|
+
import * as fs22 from "node:fs";
|
|
78265
|
+
import * as path24 from "node:path";
|
|
78201
78266
|
|
|
78202
78267
|
// cli/clone/handle-existing-directory.ts
|
|
78203
78268
|
var import_prompts6 = __toESM2(require_prompts3(), 1);
|
|
78204
|
-
import * as
|
|
78205
|
-
import * as
|
|
78269
|
+
import * as fs21 from "node:fs";
|
|
78270
|
+
import * as path23 from "node:path";
|
|
78206
78271
|
var handleExistingDirectory = async (dirPath) => {
|
|
78207
|
-
if (!
|
|
78272
|
+
if (!fs21.existsSync(dirPath))
|
|
78208
78273
|
return;
|
|
78209
78274
|
const response = await import_prompts6.default({
|
|
78210
78275
|
type: "select",
|
|
78211
78276
|
name: "action",
|
|
78212
|
-
message: `Directory "${
|
|
78277
|
+
message: `Directory "${path23.basename(dirPath)}" already exists. What would you like to do?`,
|
|
78213
78278
|
choices: [
|
|
78214
78279
|
{ title: "Merge files into existing directory", value: "merge" },
|
|
78215
78280
|
{
|
|
@@ -78224,7 +78289,7 @@ var handleExistingDirectory = async (dirPath) => {
|
|
|
78224
78289
|
process.exit(0);
|
|
78225
78290
|
}
|
|
78226
78291
|
if (response.action === "delete") {
|
|
78227
|
-
|
|
78292
|
+
fs21.rmSync(dirPath, { recursive: true, force: true });
|
|
78228
78293
|
console.log(`Deleted existing directory: ${dirPath}`);
|
|
78229
78294
|
} else if (response.action === "merge") {
|
|
78230
78295
|
console.log(`Merging files into existing directory: ${dirPath}`);
|
|
@@ -78250,12 +78315,12 @@ var getCommonDirectoryPrefix = (paths) => {
|
|
|
78250
78315
|
return commonSegments.join("/");
|
|
78251
78316
|
};
|
|
78252
78317
|
var sanitizeRelativePath = (relativePath) => {
|
|
78253
|
-
const normalizedPath =
|
|
78318
|
+
const normalizedPath = path24.normalize(relativePath);
|
|
78254
78319
|
if (!normalizedPath)
|
|
78255
78320
|
return null;
|
|
78256
|
-
if (
|
|
78321
|
+
if (path24.isAbsolute(normalizedPath))
|
|
78257
78322
|
return null;
|
|
78258
|
-
const segments = normalizedPath.split(
|
|
78323
|
+
const segments = normalizedPath.split(path24.sep);
|
|
78259
78324
|
if (segments.some((segment) => segment === ".." || segment === "")) {
|
|
78260
78325
|
return null;
|
|
78261
78326
|
}
|
|
@@ -78270,7 +78335,7 @@ var cloneBugReport = async ({
|
|
|
78270
78335
|
console.error("Bug report ID must not be empty.");
|
|
78271
78336
|
process.exit(1);
|
|
78272
78337
|
}
|
|
78273
|
-
let dirPath =
|
|
78338
|
+
let dirPath = path24.resolve(`bug-report-${trimmedBugReportId}`);
|
|
78274
78339
|
await handleExistingDirectory(dirPath);
|
|
78275
78340
|
const ky2 = getRegistryApiKy();
|
|
78276
78341
|
let zipBuffer;
|
|
@@ -78288,7 +78353,7 @@ var cloneBugReport = async ({
|
|
|
78288
78353
|
}
|
|
78289
78354
|
process.exit(1);
|
|
78290
78355
|
}
|
|
78291
|
-
|
|
78356
|
+
fs22.mkdirSync(dirPath, { recursive: true });
|
|
78292
78357
|
const zip = await import_jszip.default.loadAsync(zipBuffer);
|
|
78293
78358
|
const fileEntries = Object.entries(zip.files).filter(([, entry]) => !entry.dir);
|
|
78294
78359
|
const commonPrefix = getCommonDirectoryPrefix(fileEntries.map(([fileName]) => fileName));
|
|
@@ -78300,29 +78365,29 @@ var cloneBugReport = async ({
|
|
|
78300
78365
|
console.warn(`Skipping potentially unsafe path: ${fileName}`);
|
|
78301
78366
|
continue;
|
|
78302
78367
|
}
|
|
78303
|
-
const fullPath =
|
|
78304
|
-
|
|
78368
|
+
const fullPath = path24.join(dirPath, sanitizedRelativePath);
|
|
78369
|
+
fs22.mkdirSync(path24.dirname(fullPath), { recursive: true });
|
|
78305
78370
|
const fileContent = await entry.async("nodebuffer");
|
|
78306
|
-
|
|
78371
|
+
fs22.writeFileSync(fullPath, fileContent);
|
|
78307
78372
|
}
|
|
78308
|
-
const packageJsonPath =
|
|
78309
|
-
if (
|
|
78373
|
+
const packageJsonPath = path24.join(dirPath, "package.json");
|
|
78374
|
+
if (fs22.existsSync(packageJsonPath)) {
|
|
78310
78375
|
try {
|
|
78311
|
-
const packageJson = JSON.parse(
|
|
78376
|
+
const packageJson = JSON.parse(fs22.readFileSync(packageJsonPath, "utf-8"));
|
|
78312
78377
|
const packageName = packageJson?.name;
|
|
78313
78378
|
if (typeof packageName === "string" && packageName.trim()) {
|
|
78314
78379
|
const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
|
|
78315
|
-
const suggestedDirPath =
|
|
78380
|
+
const suggestedDirPath = path24.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
|
|
78316
78381
|
if (suggestedDirPath !== dirPath) {
|
|
78317
78382
|
const response = await import_prompts7.default({
|
|
78318
78383
|
type: "confirm",
|
|
78319
78384
|
name: "rename",
|
|
78320
78385
|
initial: true,
|
|
78321
|
-
message: `Rename the directory to "${
|
|
78386
|
+
message: `Rename the directory to "${path24.basename(suggestedDirPath)}"?`
|
|
78322
78387
|
});
|
|
78323
78388
|
if (response.rename) {
|
|
78324
78389
|
await handleExistingDirectory(suggestedDirPath);
|
|
78325
|
-
|
|
78390
|
+
fs22.renameSync(dirPath, suggestedDirPath);
|
|
78326
78391
|
dirPath = suggestedDirPath;
|
|
78327
78392
|
}
|
|
78328
78393
|
}
|
|
@@ -78331,9 +78396,9 @@ var cloneBugReport = async ({
|
|
|
78331
78396
|
console.warn("Unable to read package name for renaming:", error);
|
|
78332
78397
|
}
|
|
78333
78398
|
}
|
|
78334
|
-
|
|
78399
|
+
fs22.writeFileSync(path24.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
78335
78400
|
generateTsConfig(dirPath);
|
|
78336
|
-
const relativeDirPath =
|
|
78401
|
+
const relativeDirPath = path24.relative(originalCwd, dirPath);
|
|
78337
78402
|
console.log(kleur_default.green(`
|
|
78338
78403
|
Successfully cloned bug report to:`));
|
|
78339
78404
|
console.log(` ${dirPath}/
|
|
@@ -78372,7 +78437,7 @@ var registerClone = (program3) => {
|
|
|
78372
78437
|
const [, author, packageName] = match;
|
|
78373
78438
|
console.log(`Cloning ${author}/${packageName}...`);
|
|
78374
78439
|
const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
|
|
78375
|
-
const dirPath = userSettingToIncludeAuthor ?
|
|
78440
|
+
const dirPath = userSettingToIncludeAuthor ? path25.resolve(`${author}.${packageName}`) : path25.resolve(packageName);
|
|
78376
78441
|
await handleExistingDirectory(dirPath);
|
|
78377
78442
|
const ky2 = getRegistryApiKy();
|
|
78378
78443
|
let packageFileList = {
|
|
@@ -78393,13 +78458,13 @@ var registerClone = (program3) => {
|
|
|
78393
78458
|
console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
|
|
78394
78459
|
process.exit(1);
|
|
78395
78460
|
}
|
|
78396
|
-
|
|
78461
|
+
fs23.mkdirSync(dirPath, { recursive: true });
|
|
78397
78462
|
for (const fileInfo of packageFileList.package_files) {
|
|
78398
78463
|
const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
|
|
78399
78464
|
if (!filePath)
|
|
78400
78465
|
continue;
|
|
78401
|
-
const fullPath =
|
|
78402
|
-
|
|
78466
|
+
const fullPath = path25.join(dirPath, filePath);
|
|
78467
|
+
fs23.mkdirSync(path25.dirname(fullPath), { recursive: true });
|
|
78403
78468
|
try {
|
|
78404
78469
|
const fileContent = await ky2.get("package_files/get", {
|
|
78405
78470
|
searchParams: {
|
|
@@ -78408,15 +78473,15 @@ var registerClone = (program3) => {
|
|
|
78408
78473
|
file_path: fileInfo.file_path
|
|
78409
78474
|
}
|
|
78410
78475
|
}).json();
|
|
78411
|
-
|
|
78476
|
+
fs23.writeFileSync(fullPath, fileContent.package_file.content_text);
|
|
78412
78477
|
} catch (error) {
|
|
78413
78478
|
console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
|
|
78414
78479
|
}
|
|
78415
78480
|
}
|
|
78416
|
-
|
|
78481
|
+
fs23.writeFileSync(path25.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
78417
78482
|
generateTsConfig(dirPath);
|
|
78418
78483
|
await setupTsciProject(dirPath);
|
|
78419
|
-
const relativeDirPath =
|
|
78484
|
+
const relativeDirPath = path25.relative(originalCwd, dirPath);
|
|
78420
78485
|
console.log(kleur_default.green(`
|
|
78421
78486
|
Successfully cloned to:`));
|
|
78422
78487
|
console.log(` ${dirPath}/
|
|
@@ -78432,8 +78497,8 @@ Successfully cloned to:`));
|
|
|
78432
78497
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
78433
78498
|
|
|
78434
78499
|
// lib/shared/export-snippet.ts
|
|
78435
|
-
import
|
|
78436
|
-
import
|
|
78500
|
+
import fs26 from "node:fs";
|
|
78501
|
+
import path28 from "node:path";
|
|
78437
78502
|
import { promisify as promisify3 } from "node:util";
|
|
78438
78503
|
|
|
78439
78504
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -79612,9 +79677,9 @@ var stringifyDsnJson = (dsnJson) => {
|
|
|
79612
79677
|
const stringifyCoordinates = (coordinates) => {
|
|
79613
79678
|
return coordinates.join(" ");
|
|
79614
79679
|
};
|
|
79615
|
-
const stringifyPath = (
|
|
79680
|
+
const stringifyPath = (path26, level) => {
|
|
79616
79681
|
const padding = indent.repeat(level);
|
|
79617
|
-
return `${padding}(path ${
|
|
79682
|
+
return `${padding}(path ${path26.layer} ${path26.width} ${stringifyCoordinates(path26.coordinates)})`;
|
|
79618
79683
|
};
|
|
79619
79684
|
result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
|
|
79620
79685
|
`;
|
|
@@ -80312,10 +80377,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
80312
80377
|
}
|
|
80313
80378
|
const instances = new SymbolInstances;
|
|
80314
80379
|
const project = new SymbolInstancesProject("");
|
|
80315
|
-
const
|
|
80316
|
-
|
|
80317
|
-
|
|
80318
|
-
project.paths.push(
|
|
80380
|
+
const path26 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
|
|
80381
|
+
path26.reference = reference;
|
|
80382
|
+
path26.unit = 1;
|
|
80383
|
+
project.paths.push(path26);
|
|
80319
80384
|
instances.projects.push(project);
|
|
80320
80385
|
symbol._sxInstances = instances;
|
|
80321
80386
|
symbols3.push(symbol);
|
|
@@ -80523,11 +80588,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
80523
80588
|
throw new Error("KicadSch instance not initialized in context");
|
|
80524
80589
|
}
|
|
80525
80590
|
const sheetInstances = new SheetInstances;
|
|
80526
|
-
const
|
|
80527
|
-
|
|
80591
|
+
const path26 = new SheetInstancesRootPath;
|
|
80592
|
+
path26.value = "/";
|
|
80528
80593
|
const page = new SheetInstancesRootPage("1");
|
|
80529
|
-
|
|
80530
|
-
sheetInstances.paths = [
|
|
80594
|
+
path26.pages = [page];
|
|
80595
|
+
sheetInstances.paths = [path26];
|
|
80531
80596
|
kicadSch.sheetInstances = sheetInstances;
|
|
80532
80597
|
kicadSch.embeddedFonts = new EmbeddedFonts3(false);
|
|
80533
80598
|
this.finished = true;
|
|
@@ -80882,12 +80947,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
80882
80947
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
80883
80948
|
}
|
|
80884
80949
|
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
|
|
80885
|
-
for (const
|
|
80886
|
-
if (!
|
|
80950
|
+
for (const path26 of pcbSilkscreenPaths) {
|
|
80951
|
+
if (!path26.route || path26.route.length < 2)
|
|
80887
80952
|
continue;
|
|
80888
|
-
for (let i = 0;i <
|
|
80889
|
-
const startPoint =
|
|
80890
|
-
const endPoint =
|
|
80953
|
+
for (let i = 0;i < path26.route.length - 1; i++) {
|
|
80954
|
+
const startPoint = path26.route[i];
|
|
80955
|
+
const endPoint = path26.route[i + 1];
|
|
80891
80956
|
if (!startPoint || !endPoint)
|
|
80892
80957
|
continue;
|
|
80893
80958
|
const transformedStart = applyToPoint62(c2kMatPcb, {
|
|
@@ -80902,12 +80967,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
80902
80967
|
top: "F.SilkS",
|
|
80903
80968
|
bottom: "B.SilkS"
|
|
80904
80969
|
};
|
|
80905
|
-
const kicadLayer = layerMap[
|
|
80970
|
+
const kicadLayer = layerMap[path26.layer] || path26.layer || "F.SilkS";
|
|
80906
80971
|
const grLine = new GrLine({
|
|
80907
80972
|
start: { x: transformedStart.x, y: transformedStart.y },
|
|
80908
80973
|
end: { x: transformedEnd.x, y: transformedEnd.y },
|
|
80909
80974
|
layer: kicadLayer,
|
|
80910
|
-
width:
|
|
80975
|
+
width: path26.stroke_width || 0.15
|
|
80911
80976
|
});
|
|
80912
80977
|
const graphicLines = kicadPcb.graphicLines;
|
|
80913
80978
|
graphicLines.push(grLine);
|
|
@@ -81015,8 +81080,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
|
|
|
81015
81080
|
|
|
81016
81081
|
// lib/shared/generate-circuit-json.tsx
|
|
81017
81082
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
81018
|
-
import
|
|
81019
|
-
import
|
|
81083
|
+
import path26 from "node:path";
|
|
81084
|
+
import fs24 from "node:fs";
|
|
81020
81085
|
import { pathToFileURL } from "node:url";
|
|
81021
81086
|
import Debug11 from "debug";
|
|
81022
81087
|
|
|
@@ -81079,12 +81144,12 @@ async function generateCircuitJson({
|
|
|
81079
81144
|
const runner = new userLandTscircuit.RootCircuit({
|
|
81080
81145
|
platform: platformConfig
|
|
81081
81146
|
});
|
|
81082
|
-
const absoluteFilePath =
|
|
81083
|
-
const projectDir =
|
|
81147
|
+
const absoluteFilePath = path26.isAbsolute(filePath) ? filePath : path26.resolve(process.cwd(), filePath);
|
|
81148
|
+
const projectDir = path26.dirname(absoluteFilePath);
|
|
81084
81149
|
const resolvedOutputDir = outputDir ?? projectDir;
|
|
81085
|
-
const relativeComponentPath =
|
|
81086
|
-
const baseFileName = outputFileName ||
|
|
81087
|
-
const outputPath =
|
|
81150
|
+
const relativeComponentPath = path26.relative(projectDir, absoluteFilePath);
|
|
81151
|
+
const baseFileName = outputFileName || path26.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
81152
|
+
const outputPath = path26.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
81088
81153
|
debug11(`Project directory: ${projectDir}`);
|
|
81089
81154
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
81090
81155
|
debug11(`Output path: ${outputPath}`);
|
|
@@ -81104,7 +81169,7 @@ async function generateCircuitJson({
|
|
|
81104
81169
|
return false;
|
|
81105
81170
|
if (normalizedFilePath.match(/^\.[^/]/))
|
|
81106
81171
|
return false;
|
|
81107
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
81172
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path26.extname(normalizedFilePath)))
|
|
81108
81173
|
return false;
|
|
81109
81174
|
return true;
|
|
81110
81175
|
},
|
|
@@ -81122,7 +81187,7 @@ async function generateCircuitJson({
|
|
|
81122
81187
|
const circuitJson = await runner.getCircuitJson();
|
|
81123
81188
|
if (saveToFile) {
|
|
81124
81189
|
debug11(`Saving circuit JSON to ${outputPath}`);
|
|
81125
|
-
|
|
81190
|
+
fs24.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
81126
81191
|
}
|
|
81127
81192
|
return {
|
|
81128
81193
|
circuitJson,
|
|
@@ -81131,8 +81196,8 @@ async function generateCircuitJson({
|
|
|
81131
81196
|
}
|
|
81132
81197
|
|
|
81133
81198
|
// cli/build/generate-kicad-footprint-library.ts
|
|
81134
|
-
import
|
|
81135
|
-
import
|
|
81199
|
+
import fs25 from "node:fs";
|
|
81200
|
+
import path27 from "node:path";
|
|
81136
81201
|
import { At, KicadPcb as KicadPcb2, parseKicadSexpr } from "kicadts";
|
|
81137
81202
|
var sanitizeLibraryAndFootprintName = (libraryLink) => {
|
|
81138
81203
|
if (!libraryLink) {
|
|
@@ -81192,8 +81257,8 @@ var generateKicadFootprintLibrary = async ({
|
|
|
81192
81257
|
projects,
|
|
81193
81258
|
distDir
|
|
81194
81259
|
}) => {
|
|
81195
|
-
const libraryRoot =
|
|
81196
|
-
|
|
81260
|
+
const libraryRoot = path27.join(distDir, "kicad-footprints");
|
|
81261
|
+
fs25.mkdirSync(libraryRoot, { recursive: true });
|
|
81197
81262
|
const uniqueFootprints = new Map;
|
|
81198
81263
|
for (const project of projects) {
|
|
81199
81264
|
try {
|
|
@@ -81216,10 +81281,10 @@ var generateKicadFootprintLibrary = async ({
|
|
|
81216
81281
|
const libraryNames = new Set;
|
|
81217
81282
|
for (const entry of uniqueFootprints.values()) {
|
|
81218
81283
|
libraryNames.add(entry.libraryName);
|
|
81219
|
-
const libraryDir =
|
|
81220
|
-
|
|
81221
|
-
const footprintPath =
|
|
81222
|
-
|
|
81284
|
+
const libraryDir = path27.join(libraryRoot, `${entry.libraryName}.pretty`);
|
|
81285
|
+
fs25.mkdirSync(libraryDir, { recursive: true });
|
|
81286
|
+
const footprintPath = path27.join(libraryDir, `${entry.footprintName}.kicad_mod`);
|
|
81287
|
+
fs25.writeFileSync(footprintPath, `${entry.content}
|
|
81223
81288
|
`);
|
|
81224
81289
|
}
|
|
81225
81290
|
if (libraryNames.size > 0) {
|
|
@@ -81229,7 +81294,7 @@ ${libTableEntries.join(`
|
|
|
81229
81294
|
`)}
|
|
81230
81295
|
)
|
|
81231
81296
|
`;
|
|
81232
|
-
|
|
81297
|
+
fs25.writeFileSync(path27.join(libraryRoot, "fp-lib-table"), libTableContent);
|
|
81233
81298
|
}
|
|
81234
81299
|
};
|
|
81235
81300
|
var extractFootprintsFromPcb = (pcbContent) => {
|
|
@@ -81254,7 +81319,7 @@ var extractFootprintsFromPcb = (pcbContent) => {
|
|
|
81254
81319
|
};
|
|
81255
81320
|
|
|
81256
81321
|
// lib/shared/export-snippet.ts
|
|
81257
|
-
var writeFileAsync = promisify3(
|
|
81322
|
+
var writeFileAsync = promisify3(fs26.writeFile);
|
|
81258
81323
|
var ALLOWED_EXPORT_FORMATS = [
|
|
81259
81324
|
"json",
|
|
81260
81325
|
"circuit-json",
|
|
@@ -81299,10 +81364,10 @@ var exportSnippet = async ({
|
|
|
81299
81364
|
onError(`Invalid format: ${format}`);
|
|
81300
81365
|
return onExit(1);
|
|
81301
81366
|
}
|
|
81302
|
-
const projectDir =
|
|
81303
|
-
const outputBaseName =
|
|
81367
|
+
const projectDir = path28.dirname(filePath);
|
|
81368
|
+
const outputBaseName = path28.basename(filePath).replace(/\.[^.]+$/, "");
|
|
81304
81369
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
81305
|
-
const outputDestination =
|
|
81370
|
+
const outputDestination = path28.join(projectDir, outputPath ?? outputFileName);
|
|
81306
81371
|
const circuitData = await generateCircuitJson({
|
|
81307
81372
|
filePath,
|
|
81308
81373
|
saveToFile: format === "circuit-json",
|
|
@@ -81514,20 +81579,20 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
81514
81579
|
};
|
|
81515
81580
|
|
|
81516
81581
|
// lib/eecircuit-engine/run-simulation.ts
|
|
81517
|
-
import { promises as
|
|
81518
|
-
import
|
|
81519
|
-
import
|
|
81582
|
+
import { promises as fs27, existsSync as existsSync11 } from "node:fs";
|
|
81583
|
+
import path29 from "node:path";
|
|
81584
|
+
import os3 from "node:os";
|
|
81520
81585
|
var sim = null;
|
|
81521
81586
|
var fetchSimulation = async () => {
|
|
81522
|
-
const tempFilePath =
|
|
81523
|
-
if (!
|
|
81587
|
+
const tempFilePath = path29.join(os3.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
81588
|
+
if (!existsSync11(tempFilePath)) {
|
|
81524
81589
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
81525
81590
|
const response = await fetch(url);
|
|
81526
81591
|
if (!response.ok) {
|
|
81527
81592
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
81528
81593
|
}
|
|
81529
81594
|
const scriptContent = await response.text();
|
|
81530
|
-
await
|
|
81595
|
+
await fs27.writeFile(tempFilePath, scriptContent);
|
|
81531
81596
|
}
|
|
81532
81597
|
const module2 = await import(tempFilePath);
|
|
81533
81598
|
return module2.Simulation;
|
|
@@ -81616,8 +81681,8 @@ var resultToCsv = (result) => {
|
|
|
81616
81681
|
};
|
|
81617
81682
|
|
|
81618
81683
|
// cli/export/register.ts
|
|
81619
|
-
import
|
|
81620
|
-
import { promises as
|
|
81684
|
+
import path30 from "node:path";
|
|
81685
|
+
import { promises as fs28 } from "node:fs";
|
|
81621
81686
|
var registerExport = (program3) => {
|
|
81622
81687
|
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) => {
|
|
81623
81688
|
const formatOption = options.format ?? "json";
|
|
@@ -81629,12 +81694,12 @@ var registerExport = (program3) => {
|
|
|
81629
81694
|
});
|
|
81630
81695
|
if (circuitJson) {
|
|
81631
81696
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
81632
|
-
const outputSpicePath = options.output ??
|
|
81633
|
-
await
|
|
81697
|
+
const outputSpicePath = options.output ?? path30.join(path30.dirname(file), `${path30.basename(file, path30.extname(file))}.spice.cir`);
|
|
81698
|
+
await fs28.writeFile(outputSpicePath, spiceString);
|
|
81634
81699
|
const { result } = await runSimulation(spiceString);
|
|
81635
81700
|
const csvContent = resultToCsv(result);
|
|
81636
81701
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
81637
|
-
await
|
|
81702
|
+
await fs28.writeFile(outputCsvPath, csvContent);
|
|
81638
81703
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
81639
81704
|
}
|
|
81640
81705
|
process.exit(0);
|
|
@@ -81866,14 +81931,14 @@ class KeyStore {
|
|
|
81866
81931
|
}
|
|
81867
81932
|
}
|
|
81868
81933
|
function createKey(key) {
|
|
81869
|
-
let
|
|
81934
|
+
let path31 = null;
|
|
81870
81935
|
let id = null;
|
|
81871
81936
|
let src = null;
|
|
81872
81937
|
let weight = 1;
|
|
81873
81938
|
let getFn = null;
|
|
81874
81939
|
if (isString2(key) || isArray(key)) {
|
|
81875
81940
|
src = key;
|
|
81876
|
-
|
|
81941
|
+
path31 = createKeyPath(key);
|
|
81877
81942
|
id = createKeyId(key);
|
|
81878
81943
|
} else {
|
|
81879
81944
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -81887,11 +81952,11 @@ function createKey(key) {
|
|
|
81887
81952
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
81888
81953
|
}
|
|
81889
81954
|
}
|
|
81890
|
-
|
|
81955
|
+
path31 = createKeyPath(name);
|
|
81891
81956
|
id = createKeyId(name);
|
|
81892
81957
|
getFn = key.getFn;
|
|
81893
81958
|
}
|
|
81894
|
-
return { path:
|
|
81959
|
+
return { path: path31, id, weight, src, getFn };
|
|
81895
81960
|
}
|
|
81896
81961
|
function createKeyPath(key) {
|
|
81897
81962
|
return isArray(key) ? key : key.split(".");
|
|
@@ -81899,34 +81964,34 @@ function createKeyPath(key) {
|
|
|
81899
81964
|
function createKeyId(key) {
|
|
81900
81965
|
return isArray(key) ? key.join(".") : key;
|
|
81901
81966
|
}
|
|
81902
|
-
function get(obj,
|
|
81967
|
+
function get(obj, path31) {
|
|
81903
81968
|
let list = [];
|
|
81904
81969
|
let arr = false;
|
|
81905
|
-
const deepGet = (obj2,
|
|
81970
|
+
const deepGet = (obj2, path32, index) => {
|
|
81906
81971
|
if (!isDefined(obj2)) {
|
|
81907
81972
|
return;
|
|
81908
81973
|
}
|
|
81909
|
-
if (!
|
|
81974
|
+
if (!path32[index]) {
|
|
81910
81975
|
list.push(obj2);
|
|
81911
81976
|
} else {
|
|
81912
|
-
let key =
|
|
81977
|
+
let key = path32[index];
|
|
81913
81978
|
const value = obj2[key];
|
|
81914
81979
|
if (!isDefined(value)) {
|
|
81915
81980
|
return;
|
|
81916
81981
|
}
|
|
81917
|
-
if (index ===
|
|
81982
|
+
if (index === path32.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
81918
81983
|
list.push(toString(value));
|
|
81919
81984
|
} else if (isArray(value)) {
|
|
81920
81985
|
arr = true;
|
|
81921
81986
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
81922
|
-
deepGet(value[i],
|
|
81987
|
+
deepGet(value[i], path32, index + 1);
|
|
81923
81988
|
}
|
|
81924
|
-
} else if (
|
|
81925
|
-
deepGet(value,
|
|
81989
|
+
} else if (path32.length) {
|
|
81990
|
+
deepGet(value, path32, index + 1);
|
|
81926
81991
|
}
|
|
81927
81992
|
}
|
|
81928
81993
|
};
|
|
81929
|
-
deepGet(obj, isString2(
|
|
81994
|
+
deepGet(obj, isString2(path31) ? path31.split(".") : path31, 0);
|
|
81930
81995
|
return arr ? list : list[0];
|
|
81931
81996
|
}
|
|
81932
81997
|
var MatchOptions = {
|
|
@@ -83118,8 +83183,8 @@ var registerSearch = (program3) => {
|
|
|
83118
83183
|
}
|
|
83119
83184
|
if (kicadResults.length) {
|
|
83120
83185
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
83121
|
-
kicadResults.forEach((
|
|
83122
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
83186
|
+
kicadResults.forEach((path31, idx) => {
|
|
83187
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path31.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
83123
83188
|
});
|
|
83124
83189
|
}
|
|
83125
83190
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -88278,7 +88343,7 @@ var zo = rs.find((t2) => t2.text === "{REF}");
|
|
|
88278
88343
|
zo.y = 0;
|
|
88279
88344
|
zo.x = 0.35;
|
|
88280
88345
|
zo.anchor = "middle_left";
|
|
88281
|
-
var
|
|
88346
|
+
var os4 = es;
|
|
88282
88347
|
var is = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, path40: { type: "path", points: [{ x: 0.07, y: 0.19 }, { x: 0.07, y: -0.18 }], color: "primary", fill: false }, "path12-1": { type: "path", points: [{ x: 0.28, y: 0.53 }, { x: 0.28, y: 0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: -0.53 }, { x: 0.29, y: -0.1 }], color: "primary", fill: false }, path2: { type: "path", points: [{ x: 0.07, y: 0.11 }, { x: 0.29, y: 0.11 }], color: "primary", fill: false }, "path2-5": { type: "path", points: [{ x: 0.07, y: -0.1 }, { x: 0.29, y: -0.1 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: -0.08, y: 0.06 }, { x: -0.08, y: -0.07 }, { x: 0.01, y: 0 }, { x: -0.08, y: 0.06 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.15, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: 0.04, y: -0.42 } }, refblocks: { top1: { x: 0.28, 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: { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
88283
88348
|
var { paths: ud, texts: ls, bounds: Ke, refblocks: Oo, circles: vd } = is;
|
|
88284
88349
|
var t0 = s({ primitives: [...Object.values(ud), ...Object.values(vd), { ...ls.top1, anchor: "middle_right", x: 0 }, { ...ls.bottom1, anchor: "middle_right", x: 0 }], ports: [{ ...Oo.top1, labels: ["1", "drain"] }, { ...Oo.bottom1, labels: ["2", "source"] }, { ...Oo.left1, labels: ["3", "gate"] }], size: { width: Ke.width, height: Ke.height }, center: { x: Ke.centerX, y: Ke.centerY } });
|
|
@@ -88298,7 +88363,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
88298
88363
|
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();
|
|
88299
88364
|
var ms = r(U, "down");
|
|
88300
88365
|
var ns = r(U, "left");
|
|
88301
|
-
var
|
|
88366
|
+
var fs29 = r(U, "up");
|
|
88302
88367
|
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 } } };
|
|
88303
88368
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
88304
88369
|
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();
|
|
@@ -88867,7 +88932,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
88867
88932
|
sb.anchor = "middle_left";
|
|
88868
88933
|
mb.anchor = "middle_right";
|
|
88869
88934
|
var B1 = Cl;
|
|
88870
|
-
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: At2, 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:
|
|
88935
|
+
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: At2, 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: os4, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs29, 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 };
|
|
88871
88936
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
88872
88937
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
88873
88938
|
lineThickness = 0
|
|
@@ -90897,11 +90962,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
90897
90962
|
fiber = fiber.next, id2--;
|
|
90898
90963
|
return fiber;
|
|
90899
90964
|
}
|
|
90900
|
-
function copyWithSetImpl(obj,
|
|
90901
|
-
if (index >=
|
|
90965
|
+
function copyWithSetImpl(obj, path31, index, value) {
|
|
90966
|
+
if (index >= path31.length)
|
|
90902
90967
|
return value;
|
|
90903
|
-
var key =
|
|
90904
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
90968
|
+
var key = path31[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
90969
|
+
updated[key] = copyWithSetImpl(obj[key], path31, index + 1, value);
|
|
90905
90970
|
return updated;
|
|
90906
90971
|
}
|
|
90907
90972
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -90921,11 +90986,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
90921
90986
|
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);
|
|
90922
90987
|
return updated;
|
|
90923
90988
|
}
|
|
90924
|
-
function copyWithDeleteImpl(obj,
|
|
90925
|
-
var key =
|
|
90926
|
-
if (index + 1 ===
|
|
90989
|
+
function copyWithDeleteImpl(obj, path31, index) {
|
|
90990
|
+
var key = path31[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
90991
|
+
if (index + 1 === path31.length)
|
|
90927
90992
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
90928
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
90993
|
+
updated[key] = copyWithDeleteImpl(obj[key], path31, index + 1);
|
|
90929
90994
|
return updated;
|
|
90930
90995
|
}
|
|
90931
90996
|
function shouldSuspendImpl() {
|
|
@@ -99956,29 +100021,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
99956
100021
|
var didWarnAboutNestedUpdates = false;
|
|
99957
100022
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
99958
100023
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
99959
|
-
overrideHookState = function(fiber, id2,
|
|
100024
|
+
overrideHookState = function(fiber, id2, path31, value) {
|
|
99960
100025
|
id2 = findHook(fiber, id2);
|
|
99961
|
-
id2 !== null && (
|
|
100026
|
+
id2 !== null && (path31 = copyWithSetImpl(id2.memoizedState, path31, 0, value), id2.memoizedState = path31, id2.baseState = path31, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path31 = enqueueConcurrentRenderForLane(fiber, 2), path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2));
|
|
99962
100027
|
};
|
|
99963
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
100028
|
+
overrideHookStateDeletePath = function(fiber, id2, path31) {
|
|
99964
100029
|
id2 = findHook(fiber, id2);
|
|
99965
|
-
id2 !== null && (
|
|
100030
|
+
id2 !== null && (path31 = copyWithDeleteImpl(id2.memoizedState, path31, 0), id2.memoizedState = path31, id2.baseState = path31, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path31 = enqueueConcurrentRenderForLane(fiber, 2), path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2));
|
|
99966
100031
|
};
|
|
99967
100032
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
99968
100033
|
id2 = findHook(fiber, id2);
|
|
99969
100034
|
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));
|
|
99970
100035
|
};
|
|
99971
|
-
overrideProps = function(fiber,
|
|
99972
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
100036
|
+
overrideProps = function(fiber, path31, value) {
|
|
100037
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path31, 0, value);
|
|
99973
100038
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
99974
|
-
|
|
99975
|
-
|
|
100039
|
+
path31 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
100040
|
+
path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2);
|
|
99976
100041
|
};
|
|
99977
|
-
overridePropsDeletePath = function(fiber,
|
|
99978
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
100042
|
+
overridePropsDeletePath = function(fiber, path31) {
|
|
100043
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path31, 0);
|
|
99979
100044
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
99980
|
-
|
|
99981
|
-
|
|
100045
|
+
path31 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
100046
|
+
path31 !== null && scheduleUpdateOnFiber(path31, fiber, 2);
|
|
99982
100047
|
};
|
|
99983
100048
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
99984
100049
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -115315,10 +115380,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115315
115380
|
var setErrorHandler = null;
|
|
115316
115381
|
var setSuspenseHandler = null;
|
|
115317
115382
|
{
|
|
115318
|
-
var copyWithDeleteImpl = function(obj,
|
|
115319
|
-
var key =
|
|
115383
|
+
var copyWithDeleteImpl = function(obj, path31, index2) {
|
|
115384
|
+
var key = path31[index2];
|
|
115320
115385
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
115321
|
-
if (index2 + 1 ===
|
|
115386
|
+
if (index2 + 1 === path31.length) {
|
|
115322
115387
|
if (isArray2(updated)) {
|
|
115323
115388
|
updated.splice(key, 1);
|
|
115324
115389
|
} else {
|
|
@@ -115326,11 +115391,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115326
115391
|
}
|
|
115327
115392
|
return updated;
|
|
115328
115393
|
}
|
|
115329
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
115394
|
+
updated[key] = copyWithDeleteImpl(obj[key], path31, index2 + 1);
|
|
115330
115395
|
return updated;
|
|
115331
115396
|
};
|
|
115332
|
-
var copyWithDelete = function(obj,
|
|
115333
|
-
return copyWithDeleteImpl(obj,
|
|
115397
|
+
var copyWithDelete = function(obj, path31) {
|
|
115398
|
+
return copyWithDeleteImpl(obj, path31, 0);
|
|
115334
115399
|
};
|
|
115335
115400
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
115336
115401
|
var oldKey = oldPath[index2];
|
|
@@ -115362,17 +115427,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115362
115427
|
}
|
|
115363
115428
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
115364
115429
|
};
|
|
115365
|
-
var copyWithSetImpl = function(obj,
|
|
115366
|
-
if (index2 >=
|
|
115430
|
+
var copyWithSetImpl = function(obj, path31, index2, value) {
|
|
115431
|
+
if (index2 >= path31.length) {
|
|
115367
115432
|
return value;
|
|
115368
115433
|
}
|
|
115369
|
-
var key =
|
|
115434
|
+
var key = path31[index2];
|
|
115370
115435
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
115371
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
115436
|
+
updated[key] = copyWithSetImpl(obj[key], path31, index2 + 1, value);
|
|
115372
115437
|
return updated;
|
|
115373
115438
|
};
|
|
115374
|
-
var copyWithSet = function(obj,
|
|
115375
|
-
return copyWithSetImpl(obj,
|
|
115439
|
+
var copyWithSet = function(obj, path31, value) {
|
|
115440
|
+
return copyWithSetImpl(obj, path31, 0, value);
|
|
115376
115441
|
};
|
|
115377
115442
|
var findHook = function(fiber, id2) {
|
|
115378
115443
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -115382,10 +115447,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115382
115447
|
}
|
|
115383
115448
|
return currentHook2;
|
|
115384
115449
|
};
|
|
115385
|
-
overrideHookState = function(fiber, id2,
|
|
115450
|
+
overrideHookState = function(fiber, id2, path31, value) {
|
|
115386
115451
|
var hook = findHook(fiber, id2);
|
|
115387
115452
|
if (hook !== null) {
|
|
115388
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
115453
|
+
var newState = copyWithSet(hook.memoizedState, path31, value);
|
|
115389
115454
|
hook.memoizedState = newState;
|
|
115390
115455
|
hook.baseState = newState;
|
|
115391
115456
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -115395,10 +115460,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115395
115460
|
}
|
|
115396
115461
|
}
|
|
115397
115462
|
};
|
|
115398
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
115463
|
+
overrideHookStateDeletePath = function(fiber, id2, path31) {
|
|
115399
115464
|
var hook = findHook(fiber, id2);
|
|
115400
115465
|
if (hook !== null) {
|
|
115401
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
115466
|
+
var newState = copyWithDelete(hook.memoizedState, path31);
|
|
115402
115467
|
hook.memoizedState = newState;
|
|
115403
115468
|
hook.baseState = newState;
|
|
115404
115469
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -115421,8 +115486,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115421
115486
|
}
|
|
115422
115487
|
}
|
|
115423
115488
|
};
|
|
115424
|
-
overrideProps = function(fiber,
|
|
115425
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
115489
|
+
overrideProps = function(fiber, path31, value) {
|
|
115490
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path31, value);
|
|
115426
115491
|
if (fiber.alternate) {
|
|
115427
115492
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
115428
115493
|
}
|
|
@@ -115431,8 +115496,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
115431
115496
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
115432
115497
|
}
|
|
115433
115498
|
};
|
|
115434
|
-
overridePropsDeletePath = function(fiber,
|
|
115435
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
115499
|
+
overridePropsDeletePath = function(fiber, path31) {
|
|
115500
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path31);
|
|
115436
115501
|
if (fiber.alternate) {
|
|
115437
115502
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
115438
115503
|
}
|
|
@@ -121483,7 +121548,7 @@ var parsePin = (pinString) => {
|
|
|
121483
121548
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
121484
121549
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
121485
121550
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
121486
|
-
const
|
|
121551
|
+
const path31 = pathMatch ? pathMatch[1] : "";
|
|
121487
121552
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
121488
121553
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
121489
121554
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -121497,7 +121562,7 @@ var parsePin = (pinString) => {
|
|
|
121497
121562
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
121498
121563
|
label,
|
|
121499
121564
|
labelColor,
|
|
121500
|
-
path:
|
|
121565
|
+
path: path31,
|
|
121501
121566
|
arrow
|
|
121502
121567
|
};
|
|
121503
121568
|
};
|
|
@@ -121937,15 +122002,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
121937
122002
|
}
|
|
121938
122003
|
}
|
|
121939
122004
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
121940
|
-
const
|
|
122005
|
+
const path31 = [];
|
|
121941
122006
|
for (let i = 0;i <= numPoints; i++) {
|
|
121942
122007
|
const t3 = i / numPoints;
|
|
121943
122008
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
121944
122009
|
const x = centerX + radius * Math.cos(angle2);
|
|
121945
122010
|
const y = centerY + radius * Math.sin(angle2);
|
|
121946
|
-
|
|
122011
|
+
path31.push({ x, y });
|
|
121947
122012
|
}
|
|
121948
|
-
return
|
|
122013
|
+
return path31;
|
|
121949
122014
|
}
|
|
121950
122015
|
var __defProp4 = Object.defineProperty;
|
|
121951
122016
|
var __export22 = (target, all) => {
|
|
@@ -123363,7 +123428,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
123363
123428
|
};
|
|
123364
123429
|
};
|
|
123365
123430
|
var silkscreenPin = ({
|
|
123366
|
-
fs:
|
|
123431
|
+
fs: fs30,
|
|
123367
123432
|
pn: pn2,
|
|
123368
123433
|
anchor_x,
|
|
123369
123434
|
anchor_y,
|
|
@@ -123406,7 +123471,7 @@ var silkscreenPin = ({
|
|
|
123406
123471
|
type: "pcb_silkscreen_text",
|
|
123407
123472
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
123408
123473
|
font: "tscircuit2024",
|
|
123409
|
-
font_size:
|
|
123474
|
+
font_size: fs30,
|
|
123410
123475
|
pcb_component_id: "pcb_component_1",
|
|
123411
123476
|
text: `{PIN${pn2}}`,
|
|
123412
123477
|
layer,
|
|
@@ -131022,17 +131087,17 @@ var ObstacleList = class {
|
|
|
131022
131087
|
return obstacles;
|
|
131023
131088
|
}
|
|
131024
131089
|
};
|
|
131025
|
-
function removePathLoops(
|
|
131026
|
-
if (
|
|
131027
|
-
return
|
|
131028
|
-
const result = [{ ...
|
|
131029
|
-
let currentLayer =
|
|
131030
|
-
for (let i = 1;i <
|
|
131031
|
-
const currentSegment = { start:
|
|
131032
|
-
const isVia =
|
|
131033
|
-
if (
|
|
131034
|
-
result.push({ ...
|
|
131035
|
-
currentLayer =
|
|
131090
|
+
function removePathLoops(path31) {
|
|
131091
|
+
if (path31.length < 4)
|
|
131092
|
+
return path31;
|
|
131093
|
+
const result = [{ ...path31[0] }];
|
|
131094
|
+
let currentLayer = path31[0].layer;
|
|
131095
|
+
for (let i = 1;i < path31.length; i++) {
|
|
131096
|
+
const currentSegment = { start: path31[i - 1], end: path31[i] };
|
|
131097
|
+
const isVia = path31[i].route_type === "via" || path31[i - 1].route_type === "via";
|
|
131098
|
+
if (path31[i].layer !== currentLayer || isVia) {
|
|
131099
|
+
result.push({ ...path31[i] });
|
|
131100
|
+
currentLayer = path31[i].layer;
|
|
131036
131101
|
continue;
|
|
131037
131102
|
}
|
|
131038
131103
|
let intersectionFound = false;
|
|
@@ -131061,8 +131126,8 @@ function removePathLoops(path30) {
|
|
|
131061
131126
|
result.push(intersectionPoint);
|
|
131062
131127
|
}
|
|
131063
131128
|
const lastPoint = result[result.length - 1];
|
|
131064
|
-
if (lastPoint.x !==
|
|
131065
|
-
result.push(
|
|
131129
|
+
if (lastPoint.x !== path31[i].x || lastPoint.y !== path31[i].y) {
|
|
131130
|
+
result.push(path31[i]);
|
|
131066
131131
|
}
|
|
131067
131132
|
}
|
|
131068
131133
|
return result;
|
|
@@ -131551,10 +131616,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
131551
131616
|
});
|
|
131552
131617
|
}
|
|
131553
131618
|
if (current2.parent) {
|
|
131554
|
-
const
|
|
131619
|
+
const path31 = [];
|
|
131555
131620
|
let p = current2;
|
|
131556
131621
|
while (p) {
|
|
131557
|
-
|
|
131622
|
+
path31.unshift(p);
|
|
131558
131623
|
p = p.parent;
|
|
131559
131624
|
}
|
|
131560
131625
|
debugSolution.push({
|
|
@@ -131562,7 +131627,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
131562
131627
|
pcb_component_id: "",
|
|
131563
131628
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
131564
131629
|
layer: "top",
|
|
131565
|
-
route:
|
|
131630
|
+
route: path31,
|
|
131566
131631
|
stroke_width: 0.01
|
|
131567
131632
|
});
|
|
131568
131633
|
}
|
|
@@ -136484,13 +136549,13 @@ var RBush = class {
|
|
|
136484
136549
|
return this;
|
|
136485
136550
|
let node = this.data;
|
|
136486
136551
|
const bbox = this.toBBox(item);
|
|
136487
|
-
const
|
|
136552
|
+
const path31 = [];
|
|
136488
136553
|
const indexes = [];
|
|
136489
136554
|
let i, parent, goingUp;
|
|
136490
|
-
while (node ||
|
|
136555
|
+
while (node || path31.length) {
|
|
136491
136556
|
if (!node) {
|
|
136492
|
-
node =
|
|
136493
|
-
parent =
|
|
136557
|
+
node = path31.pop();
|
|
136558
|
+
parent = path31[path31.length - 1];
|
|
136494
136559
|
i = indexes.pop();
|
|
136495
136560
|
goingUp = true;
|
|
136496
136561
|
}
|
|
@@ -136498,13 +136563,13 @@ var RBush = class {
|
|
|
136498
136563
|
const index = findItem(item, node.children, equalsFn);
|
|
136499
136564
|
if (index !== -1) {
|
|
136500
136565
|
node.children.splice(index, 1);
|
|
136501
|
-
|
|
136502
|
-
this._condense(
|
|
136566
|
+
path31.push(node);
|
|
136567
|
+
this._condense(path31);
|
|
136503
136568
|
return this;
|
|
136504
136569
|
}
|
|
136505
136570
|
}
|
|
136506
136571
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
136507
|
-
|
|
136572
|
+
path31.push(node);
|
|
136508
136573
|
indexes.push(i);
|
|
136509
136574
|
i = 0;
|
|
136510
136575
|
parent = node;
|
|
@@ -136575,10 +136640,10 @@ var RBush = class {
|
|
|
136575
136640
|
calcBBox(node, this.toBBox);
|
|
136576
136641
|
return node;
|
|
136577
136642
|
}
|
|
136578
|
-
_chooseSubtree(bbox, node, level,
|
|
136643
|
+
_chooseSubtree(bbox, node, level, path31) {
|
|
136579
136644
|
while (true) {
|
|
136580
|
-
|
|
136581
|
-
if (node.leaf ||
|
|
136645
|
+
path31.push(node);
|
|
136646
|
+
if (node.leaf || path31.length - 1 === level)
|
|
136582
136647
|
break;
|
|
136583
136648
|
let minArea = Infinity;
|
|
136584
136649
|
let minEnlargement = Infinity;
|
|
@@ -136687,21 +136752,21 @@ var RBush = class {
|
|
|
136687
136752
|
}
|
|
136688
136753
|
return margin;
|
|
136689
136754
|
}
|
|
136690
|
-
_adjustParentBBoxes(bbox,
|
|
136755
|
+
_adjustParentBBoxes(bbox, path31, level) {
|
|
136691
136756
|
for (let i = level;i >= 0; i--) {
|
|
136692
|
-
extend(
|
|
136757
|
+
extend(path31[i], bbox);
|
|
136693
136758
|
}
|
|
136694
136759
|
}
|
|
136695
|
-
_condense(
|
|
136696
|
-
for (let i =
|
|
136697
|
-
if (
|
|
136760
|
+
_condense(path31) {
|
|
136761
|
+
for (let i = path31.length - 1, siblings;i >= 0; i--) {
|
|
136762
|
+
if (path31[i].children.length === 0) {
|
|
136698
136763
|
if (i > 0) {
|
|
136699
|
-
siblings =
|
|
136700
|
-
siblings.splice(siblings.indexOf(
|
|
136764
|
+
siblings = path31[i - 1].children;
|
|
136765
|
+
siblings.splice(siblings.indexOf(path31[i]), 1);
|
|
136701
136766
|
} else
|
|
136702
136767
|
this.clear();
|
|
136703
136768
|
} else
|
|
136704
|
-
calcBBox(
|
|
136769
|
+
calcBBox(path31[i], this.toBBox);
|
|
136705
136770
|
}
|
|
136706
136771
|
}
|
|
136707
136772
|
};
|
|
@@ -137846,7 +137911,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137846
137911
|
this.capacityPaths = capacityPaths;
|
|
137847
137912
|
this.colorMap = colorMap ?? {};
|
|
137848
137913
|
this.unprocessedNodeIds = [
|
|
137849
|
-
...new Set(capacityPaths.flatMap((
|
|
137914
|
+
...new Set(capacityPaths.flatMap((path31) => path31.nodeIds))
|
|
137850
137915
|
];
|
|
137851
137916
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
137852
137917
|
}
|
|
@@ -137857,17 +137922,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137857
137922
|
return;
|
|
137858
137923
|
}
|
|
137859
137924
|
const pathsGoingThroughNode = [];
|
|
137860
|
-
for (const
|
|
137861
|
-
const indexOfNodeInPath =
|
|
137925
|
+
for (const path31 of this.capacityPaths) {
|
|
137926
|
+
const indexOfNodeInPath = path31.nodeIds.indexOf(nodeId);
|
|
137862
137927
|
if (indexOfNodeInPath !== -1) {
|
|
137863
|
-
pathsGoingThroughNode.push({ path:
|
|
137928
|
+
pathsGoingThroughNode.push({ path: path31, indexOfNodeInPath });
|
|
137864
137929
|
}
|
|
137865
137930
|
}
|
|
137866
137931
|
const node = this.nodeMap.get(nodeId);
|
|
137867
137932
|
const nodePortSegments = [];
|
|
137868
|
-
for (const { path:
|
|
137869
|
-
const entryNodeId =
|
|
137870
|
-
const exitNodeId =
|
|
137933
|
+
for (const { path: path31, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
137934
|
+
const entryNodeId = path31.nodeIds[indexOfNodeInPath - 1];
|
|
137935
|
+
const exitNodeId = path31.nodeIds[indexOfNodeInPath + 1];
|
|
137871
137936
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
137872
137937
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
137873
137938
|
if (!adjNode)
|
|
@@ -137880,7 +137945,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
137880
137945
|
capacityMeshNodeId: nodeId,
|
|
137881
137946
|
start: segment2.start,
|
|
137882
137947
|
end: segment2.end,
|
|
137883
|
-
connectionNames: [
|
|
137948
|
+
connectionNames: [path31.connectionName],
|
|
137884
137949
|
availableZ: mutuallyAvailableZ
|
|
137885
137950
|
};
|
|
137886
137951
|
nodePortSegments.push(portSegment);
|
|
@@ -138686,37 +138751,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
138686
138751
|
return neighbors;
|
|
138687
138752
|
}
|
|
138688
138753
|
getNodePath(node) {
|
|
138689
|
-
const
|
|
138754
|
+
const path31 = [];
|
|
138690
138755
|
while (node) {
|
|
138691
|
-
|
|
138756
|
+
path31.push(node);
|
|
138692
138757
|
node = node.parent;
|
|
138693
138758
|
}
|
|
138694
|
-
return
|
|
138759
|
+
return path31;
|
|
138695
138760
|
}
|
|
138696
138761
|
getViasInNodePath(node) {
|
|
138697
|
-
const
|
|
138762
|
+
const path31 = this.getNodePath(node);
|
|
138698
138763
|
const vias = [];
|
|
138699
|
-
for (let i = 0;i <
|
|
138700
|
-
if (
|
|
138701
|
-
vias.push({ x:
|
|
138764
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
138765
|
+
if (path31[i].z !== path31[i + 1].z) {
|
|
138766
|
+
vias.push({ x: path31[i].x, y: path31[i].y });
|
|
138702
138767
|
}
|
|
138703
138768
|
}
|
|
138704
138769
|
return vias;
|
|
138705
138770
|
}
|
|
138706
138771
|
setSolvedPath(node) {
|
|
138707
|
-
const
|
|
138708
|
-
|
|
138772
|
+
const path31 = this.getNodePath(node);
|
|
138773
|
+
path31.reverse();
|
|
138709
138774
|
const vias = [];
|
|
138710
|
-
for (let i = 0;i <
|
|
138711
|
-
if (
|
|
138712
|
-
vias.push({ x:
|
|
138775
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
138776
|
+
if (path31[i].z !== path31[i + 1].z) {
|
|
138777
|
+
vias.push({ x: path31[i].x, y: path31[i].y });
|
|
138713
138778
|
}
|
|
138714
138779
|
}
|
|
138715
138780
|
this.solvedPath = {
|
|
138716
138781
|
connectionName: this.connectionName,
|
|
138717
138782
|
traceThickness: this.traceThickness,
|
|
138718
138783
|
viaDiameter: this.viaDiameter,
|
|
138719
|
-
route:
|
|
138784
|
+
route: path31.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
138720
138785
|
vias
|
|
138721
138786
|
};
|
|
138722
138787
|
}
|
|
@@ -139524,12 +139589,12 @@ function computeDumbbellPaths({
|
|
|
139524
139589
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
139525
139590
|
};
|
|
139526
139591
|
};
|
|
139527
|
-
const subdivideOptimalPath = (
|
|
139528
|
-
if (
|
|
139529
|
-
return
|
|
139530
|
-
const result = [
|
|
139531
|
-
for (let i = 0;i <
|
|
139532
|
-
const segment2 = { start:
|
|
139592
|
+
const subdivideOptimalPath = (path31, numSubdivisions) => {
|
|
139593
|
+
if (path31.length < 2)
|
|
139594
|
+
return path31;
|
|
139595
|
+
const result = [path31[0]];
|
|
139596
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
139597
|
+
const segment2 = { start: path31[i], end: path31[i + 1] };
|
|
139533
139598
|
const segmentMidpoint = {
|
|
139534
139599
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
139535
139600
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -139591,7 +139656,7 @@ function computeDumbbellPaths({
|
|
|
139591
139656
|
}
|
|
139592
139657
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
139593
139658
|
}
|
|
139594
|
-
result.push(
|
|
139659
|
+
result.push(path31[i + 1]);
|
|
139595
139660
|
}
|
|
139596
139661
|
if (result.length > 1) {
|
|
139597
139662
|
const filteredResult = [result[0]];
|
|
@@ -139826,13 +139891,13 @@ function computeDumbbellPaths({
|
|
|
139826
139891
|
].map((l, index) => ({ ...l, index }));
|
|
139827
139892
|
};
|
|
139828
139893
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
139829
|
-
const
|
|
139830
|
-
if (
|
|
139831
|
-
return
|
|
139894
|
+
const path31 = jLine.points;
|
|
139895
|
+
if (path31.length < 2)
|
|
139896
|
+
return path31;
|
|
139832
139897
|
const minDistThreshold = r3 + m2;
|
|
139833
|
-
const result = [
|
|
139834
|
-
for (let i = 0;i <
|
|
139835
|
-
const segment2 = { start:
|
|
139898
|
+
const result = [path31[0]];
|
|
139899
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
139900
|
+
const segment2 = { start: path31[i], end: path31[i + 1] };
|
|
139836
139901
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
139837
139902
|
if (distToOpposite < minDistThreshold) {
|
|
139838
139903
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -139901,26 +139966,26 @@ function computeDumbbellPaths({
|
|
|
139901
139966
|
return { index: 0, path: [] };
|
|
139902
139967
|
}
|
|
139903
139968
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
139904
|
-
const
|
|
139905
|
-
const firstPoint =
|
|
139906
|
-
const dist3 = distance3(firstPoint,
|
|
139907
|
-
const dist4 = distance3(firstPoint,
|
|
139969
|
+
const path31 = [...optimalPath2.path];
|
|
139970
|
+
const firstPoint = path31[0];
|
|
139971
|
+
const dist3 = distance3(firstPoint, path31[2]);
|
|
139972
|
+
const dist4 = distance3(firstPoint, path31[3]);
|
|
139908
139973
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
139909
|
-
if (dist3 < distance3(firstPoint,
|
|
139910
|
-
|
|
139974
|
+
if (dist3 < distance3(firstPoint, path31[1]) || dist4 < distance3(firstPoint, path31[1])) {
|
|
139975
|
+
path31.splice(1, closerIdx - 1);
|
|
139911
139976
|
}
|
|
139912
|
-
const lastPoint =
|
|
139913
|
-
const distM3 = distance3(lastPoint,
|
|
139914
|
-
const distM4 = distance3(lastPoint,
|
|
139915
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
139916
|
-
if (distM3 < distance3(lastPoint,
|
|
139917
|
-
|
|
139977
|
+
const lastPoint = path31[path31.length - 1];
|
|
139978
|
+
const distM3 = distance3(lastPoint, path31[path31.length - 3]);
|
|
139979
|
+
const distM4 = distance3(lastPoint, path31[path31.length - 4]);
|
|
139980
|
+
const closerLastIdx = distM3 < distM4 ? path31.length - 3 : path31.length - 4;
|
|
139981
|
+
if (distM3 < distance3(lastPoint, path31[path31.length - 2]) || distM4 < distance3(lastPoint, path31[path31.length - 2])) {
|
|
139982
|
+
path31.splice(closerLastIdx + 1, path31.length - closerLastIdx - 2);
|
|
139918
139983
|
}
|
|
139919
139984
|
return {
|
|
139920
139985
|
index: optimalPath2.index,
|
|
139921
|
-
path:
|
|
139922
|
-
startsAt:
|
|
139923
|
-
goesTo:
|
|
139986
|
+
path: path31,
|
|
139987
|
+
startsAt: path31[0] === C2 ? "C" : "D",
|
|
139988
|
+
goesTo: path31[path31.length - 1] === C2 ? "C" : "D"
|
|
139924
139989
|
};
|
|
139925
139990
|
};
|
|
139926
139991
|
const optimalPath = findOptimalPath();
|
|
@@ -141340,9 +141405,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
141340
141405
|
let closestIntersection = null;
|
|
141341
141406
|
let intersectedSegmentZ = null;
|
|
141342
141407
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
141343
|
-
for (const
|
|
141344
|
-
for (let i = 0;i <
|
|
141345
|
-
const segment2 = [
|
|
141408
|
+
for (const path31 of pathMap.values()) {
|
|
141409
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
141410
|
+
const segment2 = [path31[i], path31[i + 1]];
|
|
141346
141411
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
141347
141412
|
continue;
|
|
141348
141413
|
}
|
|
@@ -141472,11 +141537,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
141472
141537
|
});
|
|
141473
141538
|
}
|
|
141474
141539
|
const drawPath = (pathMap, labelPrefix) => {
|
|
141475
|
-
for (const [connectionName,
|
|
141540
|
+
for (const [connectionName, path31] of pathMap.entries()) {
|
|
141476
141541
|
const color = colorMap[connectionName] ?? "black";
|
|
141477
|
-
for (let i = 0;i <
|
|
141478
|
-
const p12 =
|
|
141479
|
-
const p2 =
|
|
141542
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
141543
|
+
const p12 = path31[i];
|
|
141544
|
+
const p2 = path31[i + 1];
|
|
141480
141545
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
141481
141546
|
graphics.circles.push({
|
|
141482
141547
|
center: { x: p12.x, y: p12.y },
|
|
@@ -142074,10 +142139,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
142074
142139
|
const allSegments = [];
|
|
142075
142140
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
142076
142141
|
for (const polyLine of polyLines) {
|
|
142077
|
-
const
|
|
142078
|
-
for (let i = 0;i <
|
|
142079
|
-
const p12 =
|
|
142080
|
-
const p2 =
|
|
142142
|
+
const path31 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
142143
|
+
for (let i = 0;i < path31.length - 1; i++) {
|
|
142144
|
+
const p12 = path31[i];
|
|
142145
|
+
const p2 = path31[i + 1];
|
|
142081
142146
|
const layer = p12.z2;
|
|
142082
142147
|
allSegments.push({
|
|
142083
142148
|
start: { x: p12.x, y: p12.y },
|
|
@@ -142095,7 +142160,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
142095
142160
|
}
|
|
142096
142161
|
}
|
|
142097
142162
|
}
|
|
142098
|
-
const lastPoint =
|
|
142163
|
+
const lastPoint = path31[path31.length - 1];
|
|
142099
142164
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
142100
142165
|
const key = pointKey2(lastPoint);
|
|
142101
142166
|
if (!viaPoints.has(key)) {
|
|
@@ -142394,14 +142459,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
142394
142459
|
const polyLineVias = [];
|
|
142395
142460
|
for (let i = 0;i < polyLines.length; i++) {
|
|
142396
142461
|
const polyLine = polyLines[i];
|
|
142397
|
-
const
|
|
142462
|
+
const path31 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
142398
142463
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
142399
|
-
for (let i22 = 0;i22 <
|
|
142400
|
-
const segment2 = [
|
|
142464
|
+
for (let i22 = 0;i22 < path31.length - 1; i22++) {
|
|
142465
|
+
const segment2 = [path31[i22], path31[i22 + 1]];
|
|
142401
142466
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
142402
142467
|
}
|
|
142403
142468
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
142404
|
-
polyLineVias.push(
|
|
142469
|
+
polyLineVias.push(path31.filter((p) => p.z1 !== p.z2));
|
|
142405
142470
|
}
|
|
142406
142471
|
for (let i = 0;i < polyLines.length; i++) {
|
|
142407
142472
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -143830,7 +143895,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
143830
143895
|
if (this.failedSolvers.length > 0) {
|
|
143831
143896
|
this.solved = false;
|
|
143832
143897
|
this.failed = true;
|
|
143833
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
143898
|
+
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs30) => fs30.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
|
|
143834
143899
|
return;
|
|
143835
143900
|
}
|
|
143836
143901
|
this.solved = true;
|
|
@@ -146611,13 +146676,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
146611
146676
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
146612
146677
|
}
|
|
146613
146678
|
getBacktrackedPath(candidate) {
|
|
146614
|
-
const
|
|
146679
|
+
const path31 = [];
|
|
146615
146680
|
let currentCandidate = candidate;
|
|
146616
146681
|
while (currentCandidate) {
|
|
146617
|
-
|
|
146682
|
+
path31.push(currentCandidate.node);
|
|
146618
146683
|
currentCandidate = currentCandidate.prevCandidate;
|
|
146619
146684
|
}
|
|
146620
|
-
return
|
|
146685
|
+
return path31;
|
|
146621
146686
|
}
|
|
146622
146687
|
getNeighboringNodes(node) {
|
|
146623
146688
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -146625,12 +146690,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
146625
146690
|
getCapacityPaths() {
|
|
146626
146691
|
const capacityPaths = [];
|
|
146627
146692
|
for (const connection of this.connectionsWithNodes) {
|
|
146628
|
-
const
|
|
146629
|
-
if (
|
|
146693
|
+
const path31 = connection.path;
|
|
146694
|
+
if (path31) {
|
|
146630
146695
|
capacityPaths.push({
|
|
146631
146696
|
capacityPathId: connection.connection.name,
|
|
146632
146697
|
connectionName: connection.connection.name,
|
|
146633
|
-
nodeIds:
|
|
146698
|
+
nodeIds: path31.map((node) => node.capacityMeshNodeId)
|
|
146634
146699
|
});
|
|
146635
146700
|
}
|
|
146636
146701
|
}
|
|
@@ -147315,10 +147380,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147315
147380
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
147316
147381
|
}
|
|
147317
147382
|
getBacktrackedPath(candidate) {
|
|
147318
|
-
const
|
|
147383
|
+
const path31 = [];
|
|
147319
147384
|
let currentCandidate = candidate;
|
|
147320
147385
|
while (currentCandidate) {
|
|
147321
|
-
|
|
147386
|
+
path31.push(currentCandidate.node);
|
|
147322
147387
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
147323
147388
|
currentCandidate = currentCandidate.prevCandidate;
|
|
147324
147389
|
} else {
|
|
@@ -147326,7 +147391,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147326
147391
|
break;
|
|
147327
147392
|
}
|
|
147328
147393
|
}
|
|
147329
|
-
return
|
|
147394
|
+
return path31.reverse();
|
|
147330
147395
|
}
|
|
147331
147396
|
getNeighboringNodes(node) {
|
|
147332
147397
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -147341,8 +147406,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147341
147406
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
147342
147407
|
return true;
|
|
147343
147408
|
}
|
|
147344
|
-
reduceCapacityAlongPath(
|
|
147345
|
-
for (const pathNode of
|
|
147409
|
+
reduceCapacityAlongPath(path31) {
|
|
147410
|
+
for (const pathNode of path31) {
|
|
147346
147411
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
147347
147412
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
147348
147413
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -147471,9 +147536,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147471
147536
|
this.queuedNodes = null;
|
|
147472
147537
|
}
|
|
147473
147538
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
147474
|
-
const
|
|
147475
|
-
currentTerminal.path =
|
|
147476
|
-
this.reduceCapacityAlongPath(
|
|
147539
|
+
const path31 = this.getBacktrackedPath(currentCandidate);
|
|
147540
|
+
currentTerminal.path = path31;
|
|
147541
|
+
this.reduceCapacityAlongPath(path31);
|
|
147477
147542
|
this.currentConnectionIndex++;
|
|
147478
147543
|
this.candidates = null;
|
|
147479
147544
|
this.visitedNodes = null;
|
|
@@ -147522,10 +147587,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
147522
147587
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
147523
147588
|
topCandidates.forEach((candidate, index) => {
|
|
147524
147589
|
const opacity = 0.8 * (1 - index / 5);
|
|
147525
|
-
const
|
|
147526
|
-
if (
|
|
147590
|
+
const path31 = this.getBacktrackedPath(candidate);
|
|
147591
|
+
if (path31.length > 0) {
|
|
147527
147592
|
baseGraphics.lines.push({
|
|
147528
|
-
points:
|
|
147593
|
+
points: path31.map(({ center: { x, y } }) => ({ x, y })),
|
|
147529
147594
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
147530
147595
|
strokeWidth: 0.05
|
|
147531
147596
|
});
|
|
@@ -148214,12 +148279,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
148214
148279
|
getCapacityPaths() {
|
|
148215
148280
|
const capacityPaths = [];
|
|
148216
148281
|
for (const connection of this.connectionsWithNodes) {
|
|
148217
|
-
const
|
|
148218
|
-
if (
|
|
148282
|
+
const path31 = connection.path;
|
|
148283
|
+
if (path31) {
|
|
148219
148284
|
capacityPaths.push({
|
|
148220
148285
|
capacityPathId: connection.connection.name,
|
|
148221
148286
|
connectionName: connection.connection.name,
|
|
148222
|
-
nodeIds:
|
|
148287
|
+
nodeIds: path31.map((node) => node.capacityMeshNodeId)
|
|
148223
148288
|
});
|
|
148224
148289
|
}
|
|
148225
148290
|
}
|
|
@@ -149240,22 +149305,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
149240
149305
|
return null;
|
|
149241
149306
|
}
|
|
149242
149307
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
149243
|
-
for (const
|
|
149244
|
-
const fullPath =
|
|
149308
|
+
for (const path31 of possiblePaths) {
|
|
149309
|
+
const fullPath = path31.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
149245
149310
|
if (this.isValidPath(fullPath)) {
|
|
149246
149311
|
return fullPath;
|
|
149247
149312
|
}
|
|
149248
149313
|
}
|
|
149249
149314
|
return null;
|
|
149250
149315
|
}
|
|
149251
|
-
addPathToResult(
|
|
149252
|
-
if (
|
|
149316
|
+
addPathToResult(path31) {
|
|
149317
|
+
if (path31.length === 0)
|
|
149253
149318
|
return;
|
|
149254
|
-
for (let i = 0;i <
|
|
149255
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
149319
|
+
for (let i = 0;i < path31.length; i++) {
|
|
149320
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path31[i])) {
|
|
149256
149321
|
continue;
|
|
149257
149322
|
}
|
|
149258
|
-
this.newRoute.push(
|
|
149323
|
+
this.newRoute.push(path31[i]);
|
|
149259
149324
|
}
|
|
149260
149325
|
this.currentStepSize = this.maxStepSize;
|
|
149261
149326
|
}
|
|
@@ -176662,7 +176727,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
176662
176727
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
176663
176728
|
const start = portsWithPosition[i];
|
|
176664
176729
|
const end = portsWithPosition[i + 1];
|
|
176665
|
-
const
|
|
176730
|
+
const path31 = calculateElbow({
|
|
176666
176731
|
x: start.position.x,
|
|
176667
176732
|
y: start.position.y,
|
|
176668
176733
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -176671,8 +176736,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
176671
176736
|
y: end.position.y,
|
|
176672
176737
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
176673
176738
|
});
|
|
176674
|
-
for (let j4 = 0;j4 <
|
|
176675
|
-
elbowEdges.push({ from:
|
|
176739
|
+
for (let j4 = 0;j4 < path31.length - 1; j4++) {
|
|
176740
|
+
elbowEdges.push({ from: path31[j4], to: path31[j4 + 1] });
|
|
176676
176741
|
}
|
|
176677
176742
|
}
|
|
176678
176743
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -182860,8 +182925,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
182860
182925
|
*/
|
|
182861
182926
|
|
|
182862
182927
|
// lib/import/import-component-from-jlcpcb.ts
|
|
182863
|
-
import
|
|
182864
|
-
import
|
|
182928
|
+
import fs30 from "node:fs/promises";
|
|
182929
|
+
import path31 from "node:path";
|
|
182865
182930
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
182866
182931
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
182867
182932
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -182869,10 +182934,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
182869
182934
|
if (!fileName) {
|
|
182870
182935
|
throw new Error("Could not determine file name of converted component");
|
|
182871
182936
|
}
|
|
182872
|
-
const importsDir =
|
|
182873
|
-
await
|
|
182874
|
-
const filePath =
|
|
182875
|
-
await
|
|
182937
|
+
const importsDir = path31.join(projectDir, "imports");
|
|
182938
|
+
await fs30.mkdir(importsDir, { recursive: true });
|
|
182939
|
+
const filePath = path31.join(importsDir, `${fileName}.tsx`);
|
|
182940
|
+
await fs30.writeFile(filePath, tsx);
|
|
182876
182941
|
return { filePath };
|
|
182877
182942
|
};
|
|
182878
182943
|
|
|
@@ -182974,12 +183039,12 @@ var registerRemove = (program3) => {
|
|
|
182974
183039
|
};
|
|
182975
183040
|
|
|
182976
183041
|
// cli/build/register.ts
|
|
182977
|
-
import
|
|
182978
|
-
import
|
|
183042
|
+
import path39 from "node:path";
|
|
183043
|
+
import fs38 from "node:fs";
|
|
182979
183044
|
|
|
182980
183045
|
// cli/build/build-file.ts
|
|
182981
|
-
import
|
|
182982
|
-
import
|
|
183046
|
+
import path32 from "node:path";
|
|
183047
|
+
import fs31 from "node:fs";
|
|
182983
183048
|
|
|
182984
183049
|
// lib/shared/circuit-json-diagnostics.ts
|
|
182985
183050
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -183041,9 +183106,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
183041
183106
|
filePath: input,
|
|
183042
183107
|
platformConfig: completePlatformConfig
|
|
183043
183108
|
});
|
|
183044
|
-
|
|
183045
|
-
|
|
183046
|
-
console.log(`Circuit JSON written to ${
|
|
183109
|
+
fs31.mkdirSync(path32.dirname(output), { recursive: true });
|
|
183110
|
+
fs31.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
183111
|
+
console.log(`Circuit JSON written to ${path32.relative(projectDir, output)}`);
|
|
183047
183112
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
183048
183113
|
if (!options?.ignoreWarnings) {
|
|
183049
183114
|
for (const warn of warnings) {
|
|
@@ -183081,7 +183146,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
183081
183146
|
if (!match)
|
|
183082
183147
|
return;
|
|
183083
183148
|
const [, exportName, fromSpecifier] = match;
|
|
183084
|
-
const entryFileName =
|
|
183149
|
+
const entryFileName = path32.basename(entryFilePath);
|
|
183085
183150
|
console.error([
|
|
183086
183151
|
"",
|
|
183087
183152
|
`It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
|
|
@@ -183094,20 +183159,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
|
|
|
183094
183159
|
};
|
|
183095
183160
|
|
|
183096
183161
|
// cli/build/get-build-entrypoints.ts
|
|
183097
|
-
import
|
|
183098
|
-
import
|
|
183162
|
+
import fs32 from "node:fs";
|
|
183163
|
+
import path33 from "node:path";
|
|
183099
183164
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
183100
|
-
const relative9 =
|
|
183101
|
-
return relative9 === "" || !relative9.startsWith("..") && !
|
|
183165
|
+
const relative9 = path33.relative(maybeParent, maybeChild);
|
|
183166
|
+
return relative9 === "" || !relative9.startsWith("..") && !path33.isAbsolute(relative9);
|
|
183102
183167
|
};
|
|
183103
183168
|
var findProjectRoot = (startDir) => {
|
|
183104
183169
|
let currentDir = startDir;
|
|
183105
|
-
while (currentDir !==
|
|
183106
|
-
const packageJsonPath =
|
|
183107
|
-
if (
|
|
183170
|
+
while (currentDir !== path33.dirname(currentDir)) {
|
|
183171
|
+
const packageJsonPath = path33.join(currentDir, "package.json");
|
|
183172
|
+
if (fs32.existsSync(packageJsonPath)) {
|
|
183108
183173
|
return currentDir;
|
|
183109
183174
|
}
|
|
183110
|
-
currentDir =
|
|
183175
|
+
currentDir = path33.dirname(currentDir);
|
|
183111
183176
|
}
|
|
183112
183177
|
return startDir;
|
|
183113
183178
|
};
|
|
@@ -183116,7 +183181,7 @@ async function getBuildEntrypoints({
|
|
|
183116
183181
|
rootDir = process.cwd(),
|
|
183117
183182
|
includeBoardFiles = true
|
|
183118
183183
|
}) {
|
|
183119
|
-
const resolvedRoot =
|
|
183184
|
+
const resolvedRoot = path33.resolve(rootDir);
|
|
183120
183185
|
const includeBoardFilePatterns = includeBoardFiles ? getBoardFilePatterns(resolvedRoot) : [];
|
|
183121
183186
|
const buildFromProjectDir = async () => {
|
|
183122
183187
|
if (includeBoardFiles) {
|
|
@@ -183150,8 +183215,8 @@ async function getBuildEntrypoints({
|
|
|
183150
183215
|
};
|
|
183151
183216
|
};
|
|
183152
183217
|
if (fileOrDir) {
|
|
183153
|
-
const resolved =
|
|
183154
|
-
if (
|
|
183218
|
+
const resolved = path33.resolve(resolvedRoot, fileOrDir);
|
|
183219
|
+
if (fs32.existsSync(resolved) && fs32.statSync(resolved).isDirectory()) {
|
|
183155
183220
|
if (includeBoardFiles) {
|
|
183156
183221
|
const circuitFiles = findBoardFiles({
|
|
183157
183222
|
projectDir: resolvedRoot,
|
|
@@ -183181,7 +183246,7 @@ async function getBuildEntrypoints({
|
|
|
183181
183246
|
circuitFiles: mainEntrypoint ? [mainEntrypoint] : []
|
|
183182
183247
|
};
|
|
183183
183248
|
}
|
|
183184
|
-
const fileDir =
|
|
183249
|
+
const fileDir = path33.dirname(resolved);
|
|
183185
183250
|
const projectDir = findProjectRoot(fileDir);
|
|
183186
183251
|
return { projectDir, circuitFiles: [resolved] };
|
|
183187
183252
|
}
|
|
@@ -183218,8 +183283,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
183218
183283
|
};
|
|
183219
183284
|
|
|
183220
183285
|
// cli/build/build-preview-images.ts
|
|
183221
|
-
import
|
|
183222
|
-
import
|
|
183286
|
+
import fs33 from "node:fs";
|
|
183287
|
+
import path34 from "node:path";
|
|
183223
183288
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
183224
183289
|
import {
|
|
183225
183290
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
@@ -183292,21 +183357,21 @@ var generatePreviewAssets = async ({
|
|
|
183292
183357
|
outputDir,
|
|
183293
183358
|
distDir
|
|
183294
183359
|
}) => {
|
|
183295
|
-
const prefixRelative =
|
|
183360
|
+
const prefixRelative = path34.relative(distDir, outputDir) || ".";
|
|
183296
183361
|
const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
|
|
183297
183362
|
let circuitJson;
|
|
183298
183363
|
try {
|
|
183299
|
-
const circuitJsonRaw =
|
|
183364
|
+
const circuitJsonRaw = fs33.readFileSync(build.outputPath, "utf-8");
|
|
183300
183365
|
circuitJson = JSON.parse(circuitJsonRaw);
|
|
183301
183366
|
} catch (error) {
|
|
183302
183367
|
console.error(`${prefix}Failed to read circuit JSON:`, error);
|
|
183303
183368
|
return;
|
|
183304
183369
|
}
|
|
183305
|
-
|
|
183370
|
+
fs33.mkdirSync(outputDir, { recursive: true });
|
|
183306
183371
|
try {
|
|
183307
183372
|
console.log(`${prefix}Generating PCB SVG...`);
|
|
183308
183373
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
183309
|
-
|
|
183374
|
+
fs33.writeFileSync(path34.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
183310
183375
|
console.log(`${prefix}Written pcb.svg`);
|
|
183311
183376
|
} catch (error) {
|
|
183312
183377
|
console.error(`${prefix}Failed to generate PCB SVG:`, error);
|
|
@@ -183314,7 +183379,7 @@ var generatePreviewAssets = async ({
|
|
|
183314
183379
|
try {
|
|
183315
183380
|
console.log(`${prefix}Generating schematic SVG...`);
|
|
183316
183381
|
const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
|
|
183317
|
-
|
|
183382
|
+
fs33.writeFileSync(path34.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
183318
183383
|
console.log(`${prefix}Written schematic.svg`);
|
|
183319
183384
|
} catch (error) {
|
|
183320
183385
|
console.error(`${prefix}Failed to generate schematic SVG:`, error);
|
|
@@ -183331,7 +183396,7 @@ var generatePreviewAssets = async ({
|
|
|
183331
183396
|
camPos: [10, 10, 10],
|
|
183332
183397
|
lookAt: [0, 0, 0]
|
|
183333
183398
|
});
|
|
183334
|
-
|
|
183399
|
+
fs33.writeFileSync(path34.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
|
|
183335
183400
|
console.log(`${prefix}Written 3d.png`);
|
|
183336
183401
|
} catch (error) {
|
|
183337
183402
|
console.error(`${prefix}Failed to generate 3D PNG:`, error);
|
|
@@ -183344,14 +183409,14 @@ var buildPreviewImages = async ({
|
|
|
183344
183409
|
allImages
|
|
183345
183410
|
}) => {
|
|
183346
183411
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
183347
|
-
const normalizedMainEntrypoint = mainEntrypoint ?
|
|
183412
|
+
const normalizedMainEntrypoint = mainEntrypoint ? path34.resolve(mainEntrypoint) : undefined;
|
|
183348
183413
|
if (allImages) {
|
|
183349
183414
|
if (successfulBuilds.length === 0) {
|
|
183350
183415
|
console.warn("No successful build output available for preview image generation.");
|
|
183351
183416
|
return;
|
|
183352
183417
|
}
|
|
183353
183418
|
for (const build of successfulBuilds) {
|
|
183354
|
-
const outputDir =
|
|
183419
|
+
const outputDir = path34.dirname(build.outputPath);
|
|
183355
183420
|
await generatePreviewAssets({
|
|
183356
183421
|
build,
|
|
183357
183422
|
outputDir,
|
|
@@ -183362,7 +183427,7 @@ var buildPreviewImages = async ({
|
|
|
183362
183427
|
}
|
|
183363
183428
|
const previewBuild = (() => {
|
|
183364
183429
|
if (normalizedMainEntrypoint) {
|
|
183365
|
-
const match = successfulBuilds.find((built) =>
|
|
183430
|
+
const match = successfulBuilds.find((built) => path34.resolve(built.sourcePath) === normalizedMainEntrypoint);
|
|
183366
183431
|
if (match)
|
|
183367
183432
|
return match;
|
|
183368
183433
|
}
|
|
@@ -183380,8 +183445,8 @@ var buildPreviewImages = async ({
|
|
|
183380
183445
|
};
|
|
183381
183446
|
|
|
183382
183447
|
// cli/build/generate-kicad-project.ts
|
|
183383
|
-
import
|
|
183384
|
-
import
|
|
183448
|
+
import fs34 from "node:fs";
|
|
183449
|
+
import path35 from "node:path";
|
|
183385
183450
|
var createKicadProContent = ({
|
|
183386
183451
|
projectName,
|
|
183387
183452
|
schematicFileName,
|
|
@@ -183421,10 +183486,10 @@ var generateKicadProject = async ({
|
|
|
183421
183486
|
boardFileName
|
|
183422
183487
|
});
|
|
183423
183488
|
if (writeFiles) {
|
|
183424
|
-
|
|
183425
|
-
|
|
183426
|
-
|
|
183427
|
-
|
|
183489
|
+
fs34.mkdirSync(outputDir, { recursive: true });
|
|
183490
|
+
fs34.writeFileSync(path35.join(outputDir, schematicFileName), schContent);
|
|
183491
|
+
fs34.writeFileSync(path35.join(outputDir, boardFileName), pcbContent);
|
|
183492
|
+
fs34.writeFileSync(path35.join(outputDir, projectFileName), proContent);
|
|
183428
183493
|
}
|
|
183429
183494
|
return {
|
|
183430
183495
|
pcbContent,
|
|
@@ -183436,8 +183501,8 @@ var generateKicadProject = async ({
|
|
|
183436
183501
|
};
|
|
183437
183502
|
|
|
183438
183503
|
// cli/build/transpile/index.ts
|
|
183439
|
-
import
|
|
183440
|
-
import
|
|
183504
|
+
import path37 from "node:path";
|
|
183505
|
+
import fs36 from "node:fs";
|
|
183441
183506
|
import { rollup } from "rollup";
|
|
183442
183507
|
import typescript from "@rollup/plugin-typescript";
|
|
183443
183508
|
import resolve11 from "@rollup/plugin-node-resolve";
|
|
@@ -183446,11 +183511,11 @@ import json from "@rollup/plugin-json";
|
|
|
183446
183511
|
import dts from "rollup-plugin-dts";
|
|
183447
183512
|
|
|
183448
183513
|
// cli/build/transpile/static-asset-plugin.ts
|
|
183449
|
-
import
|
|
183450
|
-
import
|
|
183514
|
+
import fs35 from "node:fs";
|
|
183515
|
+
import path36 from "node:path";
|
|
183451
183516
|
import { createHash } from "node:crypto";
|
|
183452
183517
|
function normalizePathSeparators(filePath) {
|
|
183453
|
-
return filePath.split(
|
|
183518
|
+
return filePath.split(path36.sep).join("/");
|
|
183454
183519
|
}
|
|
183455
183520
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
183456
183521
|
".glb",
|
|
@@ -183481,24 +183546,24 @@ var createStaticAssetPlugin = ({
|
|
|
183481
183546
|
return {
|
|
183482
183547
|
name: "tsci-static-assets",
|
|
183483
183548
|
resolveId(source, importer) {
|
|
183484
|
-
const ext =
|
|
183549
|
+
const ext = path36.extname(source).toLowerCase();
|
|
183485
183550
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
183486
183551
|
return null;
|
|
183487
|
-
if (
|
|
183488
|
-
return
|
|
183552
|
+
if (path36.isAbsolute(source)) {
|
|
183553
|
+
return fs35.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
183489
183554
|
}
|
|
183490
183555
|
if (importer) {
|
|
183491
|
-
const importerNative = importer.split("/").join(
|
|
183492
|
-
const resolvedFromImporter =
|
|
183493
|
-
if (
|
|
183556
|
+
const importerNative = importer.split("/").join(path36.sep);
|
|
183557
|
+
const resolvedFromImporter = path36.resolve(path36.dirname(importerNative), source);
|
|
183558
|
+
if (fs35.existsSync(resolvedFromImporter)) {
|
|
183494
183559
|
return {
|
|
183495
183560
|
id: normalizePathSeparators(resolvedFromImporter),
|
|
183496
183561
|
external: true
|
|
183497
183562
|
};
|
|
183498
183563
|
}
|
|
183499
183564
|
}
|
|
183500
|
-
const resolvedFromProject =
|
|
183501
|
-
if (
|
|
183565
|
+
const resolvedFromProject = path36.resolve(resolvedBaseUrl, source);
|
|
183566
|
+
if (fs35.existsSync(resolvedFromProject)) {
|
|
183502
183567
|
return {
|
|
183503
183568
|
id: normalizePathSeparators(resolvedFromProject),
|
|
183504
183569
|
external: true
|
|
@@ -183511,8 +183576,8 @@ var createStaticAssetPlugin = ({
|
|
|
183511
183576
|
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
183512
183577
|
for (const target of targets) {
|
|
183513
183578
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
183514
|
-
const resolvedTarget =
|
|
183515
|
-
if (
|
|
183579
|
+
const resolvedTarget = path36.resolve(resolvedBaseUrl, targetPath);
|
|
183580
|
+
if (fs35.existsSync(resolvedTarget)) {
|
|
183516
183581
|
return {
|
|
183517
183582
|
id: normalizePathSeparators(resolvedTarget),
|
|
183518
183583
|
external: true
|
|
@@ -183538,18 +183603,18 @@ var createStaticAssetPlugin = ({
|
|
|
183538
183603
|
if (chunk.type !== "chunk")
|
|
183539
183604
|
continue;
|
|
183540
183605
|
for (const importedId of chunk.imports) {
|
|
183541
|
-
const ext =
|
|
183606
|
+
const ext = path36.extname(importedId).toLowerCase();
|
|
183542
183607
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
183543
183608
|
continue;
|
|
183544
183609
|
if (!copiedAssets.has(importedId)) {
|
|
183545
|
-
const assetDir =
|
|
183546
|
-
|
|
183547
|
-
const nativePath = importedId.split("/").join(
|
|
183548
|
-
const fileBuffer =
|
|
183610
|
+
const assetDir = path36.join(outputDir, "assets");
|
|
183611
|
+
fs35.mkdirSync(assetDir, { recursive: true });
|
|
183612
|
+
const nativePath = importedId.split("/").join(path36.sep);
|
|
183613
|
+
const fileBuffer = fs35.readFileSync(nativePath);
|
|
183549
183614
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
183550
|
-
const fileName = `${
|
|
183551
|
-
const outputFilePath =
|
|
183552
|
-
|
|
183615
|
+
const fileName = `${path36.basename(importedId, ext)}-${hash}${ext}`;
|
|
183616
|
+
const outputFilePath = path36.join(assetDir, fileName);
|
|
183617
|
+
fs35.writeFileSync(outputFilePath, fileBuffer);
|
|
183553
183618
|
copiedAssets.set(importedId, `./assets/${fileName}`);
|
|
183554
183619
|
assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
|
|
183555
183620
|
}
|
|
@@ -183571,17 +183636,17 @@ function escapeRegExp(string) {
|
|
|
183571
183636
|
|
|
183572
183637
|
// cli/build/transpile/index.ts
|
|
183573
183638
|
var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
183574
|
-
if (id2.startsWith(".") || id2.startsWith("/") ||
|
|
183639
|
+
if (id2.startsWith(".") || id2.startsWith("/") || path37.isAbsolute(id2)) {
|
|
183575
183640
|
return false;
|
|
183576
183641
|
}
|
|
183577
183642
|
let baseUrl = projectDir;
|
|
183578
183643
|
let pathMappings = {};
|
|
183579
|
-
if (tsconfigPath &&
|
|
183644
|
+
if (tsconfigPath && fs36.existsSync(tsconfigPath)) {
|
|
183580
183645
|
try {
|
|
183581
|
-
const tsconfigContent =
|
|
183646
|
+
const tsconfigContent = fs36.readFileSync(tsconfigPath, "utf-8");
|
|
183582
183647
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
183583
183648
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
183584
|
-
baseUrl =
|
|
183649
|
+
baseUrl = path37.resolve(path37.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
183585
183650
|
}
|
|
183586
183651
|
if (tsconfig.compilerOptions?.paths) {
|
|
183587
183652
|
pathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -183595,17 +183660,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
|
|
|
183595
183660
|
}
|
|
183596
183661
|
}
|
|
183597
183662
|
const potentialPaths = [
|
|
183598
|
-
|
|
183599
|
-
|
|
183600
|
-
|
|
183601
|
-
|
|
183602
|
-
|
|
183603
|
-
|
|
183604
|
-
|
|
183605
|
-
|
|
183606
|
-
|
|
183663
|
+
path37.join(baseUrl, id2),
|
|
183664
|
+
path37.join(baseUrl, `${id2}.ts`),
|
|
183665
|
+
path37.join(baseUrl, `${id2}.tsx`),
|
|
183666
|
+
path37.join(baseUrl, `${id2}.js`),
|
|
183667
|
+
path37.join(baseUrl, `${id2}.jsx`),
|
|
183668
|
+
path37.join(baseUrl, id2, "index.ts"),
|
|
183669
|
+
path37.join(baseUrl, id2, "index.tsx"),
|
|
183670
|
+
path37.join(baseUrl, id2, "index.js"),
|
|
183671
|
+
path37.join(baseUrl, id2, "index.jsx")
|
|
183607
183672
|
];
|
|
183608
|
-
if (potentialPaths.some((p) =>
|
|
183673
|
+
if (potentialPaths.some((p) => fs36.existsSync(p))) {
|
|
183609
183674
|
return false;
|
|
183610
183675
|
}
|
|
183611
183676
|
return true;
|
|
@@ -183616,17 +183681,17 @@ var transpileFile = async ({
|
|
|
183616
183681
|
projectDir
|
|
183617
183682
|
}) => {
|
|
183618
183683
|
try {
|
|
183619
|
-
|
|
183620
|
-
const tsconfigPath =
|
|
183621
|
-
const hasTsConfig =
|
|
183684
|
+
fs36.mkdirSync(outputDir, { recursive: true });
|
|
183685
|
+
const tsconfigPath = path37.join(projectDir, "tsconfig.json");
|
|
183686
|
+
const hasTsConfig = fs36.existsSync(tsconfigPath);
|
|
183622
183687
|
let tsconfigBaseUrl = projectDir;
|
|
183623
183688
|
let tsconfigPathMappings;
|
|
183624
183689
|
if (hasTsConfig) {
|
|
183625
183690
|
try {
|
|
183626
|
-
const tsconfigContent =
|
|
183691
|
+
const tsconfigContent = fs36.readFileSync(tsconfigPath, "utf-8");
|
|
183627
183692
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
183628
183693
|
if (tsconfig.compilerOptions?.baseUrl) {
|
|
183629
|
-
tsconfigBaseUrl =
|
|
183694
|
+
tsconfigBaseUrl = path37.resolve(path37.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
183630
183695
|
}
|
|
183631
183696
|
if (tsconfig.compilerOptions?.paths) {
|
|
183632
183697
|
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
@@ -183681,27 +183746,27 @@ var transpileFile = async ({
|
|
|
183681
183746
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
183682
183747
|
plugins: getPlugins()
|
|
183683
183748
|
});
|
|
183684
|
-
const esmOutputPath =
|
|
183749
|
+
const esmOutputPath = path37.join(outputDir, "index.js");
|
|
183685
183750
|
await esmBundle.write({
|
|
183686
183751
|
file: esmOutputPath,
|
|
183687
183752
|
format: "es",
|
|
183688
183753
|
sourcemap: false
|
|
183689
183754
|
});
|
|
183690
|
-
console.log(`ESM bundle written to ${
|
|
183755
|
+
console.log(`ESM bundle written to ${path37.relative(projectDir, esmOutputPath)}`);
|
|
183691
183756
|
console.log("Building CommonJS bundle...");
|
|
183692
183757
|
const cjsBundle = await rollup({
|
|
183693
183758
|
input,
|
|
183694
183759
|
external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
|
|
183695
183760
|
plugins: getPlugins()
|
|
183696
183761
|
});
|
|
183697
|
-
const cjsOutputPath =
|
|
183762
|
+
const cjsOutputPath = path37.join(outputDir, "index.cjs");
|
|
183698
183763
|
console.log("Writing CJS bundle to:", cjsOutputPath);
|
|
183699
183764
|
await cjsBundle.write({
|
|
183700
183765
|
file: cjsOutputPath,
|
|
183701
183766
|
format: "cjs",
|
|
183702
183767
|
sourcemap: false
|
|
183703
183768
|
});
|
|
183704
|
-
console.log(`CommonJS bundle written to ${
|
|
183769
|
+
console.log(`CommonJS bundle written to ${path37.relative(projectDir, cjsOutputPath)}`);
|
|
183705
183770
|
console.log("Generating type declarations...");
|
|
183706
183771
|
const dtsBundle = await rollup({
|
|
183707
183772
|
input,
|
|
@@ -183726,9 +183791,9 @@ var transpileFile = async ({
|
|
|
183726
183791
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
183727
183792
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
183728
183793
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
183729
|
-
const dtsOutputPath =
|
|
183730
|
-
|
|
183731
|
-
console.log(`Type declarations written to ${
|
|
183794
|
+
const dtsOutputPath = path37.join(outputDir, "index.d.ts");
|
|
183795
|
+
fs36.writeFileSync(dtsOutputPath, dtsContent);
|
|
183796
|
+
console.log(`Type declarations written to ${path37.relative(projectDir, dtsOutputPath)}`);
|
|
183732
183797
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
183733
183798
|
return true;
|
|
183734
183799
|
} catch (err) {
|
|
@@ -183741,17 +183806,17 @@ var transpileFile = async ({
|
|
|
183741
183806
|
};
|
|
183742
183807
|
|
|
183743
183808
|
// cli/utils/validate-main-in-dist.ts
|
|
183744
|
-
import
|
|
183745
|
-
import
|
|
183809
|
+
import fs37 from "node:fs";
|
|
183810
|
+
import path38 from "node:path";
|
|
183746
183811
|
var validateMainInDist = (projectDir, distDir) => {
|
|
183747
|
-
const packageJsonPath =
|
|
183748
|
-
if (!
|
|
183812
|
+
const packageJsonPath = path38.join(projectDir, "package.json");
|
|
183813
|
+
if (!fs37.existsSync(packageJsonPath))
|
|
183749
183814
|
return;
|
|
183750
|
-
const packageJson = JSON.parse(
|
|
183815
|
+
const packageJson = JSON.parse(fs37.readFileSync(packageJsonPath, "utf-8"));
|
|
183751
183816
|
if (typeof packageJson.main !== "string")
|
|
183752
183817
|
return;
|
|
183753
|
-
const resolvedMainPath =
|
|
183754
|
-
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${
|
|
183818
|
+
const resolvedMainPath = path38.resolve(projectDir, packageJson.main);
|
|
183819
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path38.sep}`);
|
|
183755
183820
|
if (!isMainInDist) {
|
|
183756
183821
|
console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
183757
183822
|
}
|
|
@@ -183776,8 +183841,8 @@ var registerBuild = (program3) => {
|
|
|
183776
183841
|
}
|
|
183777
183842
|
return config;
|
|
183778
183843
|
})();
|
|
183779
|
-
const distDir =
|
|
183780
|
-
|
|
183844
|
+
const distDir = path39.join(projectDir, "dist");
|
|
183845
|
+
fs38.mkdirSync(distDir, { recursive: true });
|
|
183781
183846
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
183782
183847
|
let hasErrors = false;
|
|
183783
183848
|
const staticFileReferences = [];
|
|
@@ -183785,10 +183850,10 @@ var registerBuild = (program3) => {
|
|
|
183785
183850
|
const kicadProjects = [];
|
|
183786
183851
|
const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
|
|
183787
183852
|
for (const filePath of circuitFiles) {
|
|
183788
|
-
const relative9 =
|
|
183853
|
+
const relative9 = path39.relative(projectDir, filePath);
|
|
183789
183854
|
console.log(`Building ${relative9}...`);
|
|
183790
183855
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
183791
|
-
const outputPath =
|
|
183856
|
+
const outputPath = path39.join(distDir, outputDirName, "circuit.json");
|
|
183792
183857
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
|
|
183793
183858
|
ignoreErrors: options?.ignoreErrors,
|
|
183794
183859
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -183802,17 +183867,17 @@ var registerBuild = (program3) => {
|
|
|
183802
183867
|
if (!buildOutcome.ok) {
|
|
183803
183868
|
hasErrors = true;
|
|
183804
183869
|
} else if (options?.site) {
|
|
183805
|
-
const normalizedSourcePath = relative9.split(
|
|
183806
|
-
const relativeOutputPath =
|
|
183807
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
183870
|
+
const normalizedSourcePath = relative9.split(path39.sep).join("/");
|
|
183871
|
+
const relativeOutputPath = path39.join(outputDirName, "circuit.json");
|
|
183872
|
+
const normalizedOutputPath = relativeOutputPath.split(path39.sep).join("/");
|
|
183808
183873
|
staticFileReferences.push({
|
|
183809
183874
|
filePath: normalizedSourcePath,
|
|
183810
183875
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
183811
183876
|
});
|
|
183812
183877
|
}
|
|
183813
183878
|
if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
|
|
183814
|
-
const projectOutputDir =
|
|
183815
|
-
const projectName =
|
|
183879
|
+
const projectOutputDir = path39.join(distDir, outputDirName, "kicad");
|
|
183880
|
+
const projectName = path39.basename(outputDirName);
|
|
183816
183881
|
const project = await generateKicadProject({
|
|
183817
183882
|
circuitJson: buildOutcome.circuitJson,
|
|
183818
183883
|
outputDir: projectOutputDir,
|
|
@@ -183861,8 +183926,8 @@ var registerBuild = (program3) => {
|
|
|
183861
183926
|
files: staticFileReferences,
|
|
183862
183927
|
standaloneScriptSrc: "./standalone.min.js"
|
|
183863
183928
|
});
|
|
183864
|
-
|
|
183865
|
-
|
|
183929
|
+
fs38.writeFileSync(path39.join(distDir, "index.html"), indexHtml);
|
|
183930
|
+
fs38.writeFileSync(path39.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
183866
183931
|
}
|
|
183867
183932
|
if (options?.kicadFootprintLibrary) {
|
|
183868
183933
|
if (kicadProjects.length === 0) {
|
|
@@ -183885,8 +183950,8 @@ var registerBuild = (program3) => {
|
|
|
183885
183950
|
};
|
|
183886
183951
|
|
|
183887
183952
|
// lib/shared/snapshot-project.ts
|
|
183888
|
-
import
|
|
183889
|
-
import
|
|
183953
|
+
import fs40 from "node:fs";
|
|
183954
|
+
import path40 from "node:path";
|
|
183890
183955
|
import looksSame2 from "looks-same";
|
|
183891
183956
|
import {
|
|
183892
183957
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -183897,7 +183962,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
183897
183962
|
|
|
183898
183963
|
// lib/shared/compare-images.ts
|
|
183899
183964
|
import looksSame from "looks-same";
|
|
183900
|
-
import
|
|
183965
|
+
import fs39 from "node:fs/promises";
|
|
183901
183966
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
183902
183967
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
183903
183968
|
strict: false,
|
|
@@ -183913,7 +183978,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
183913
183978
|
tolerance: 2
|
|
183914
183979
|
});
|
|
183915
183980
|
} else {
|
|
183916
|
-
await
|
|
183981
|
+
await fs39.writeFile(diffPath, buffer2);
|
|
183917
183982
|
}
|
|
183918
183983
|
}
|
|
183919
183984
|
return { equal: equal2 };
|
|
@@ -183938,7 +184003,7 @@ var snapshotProject = async ({
|
|
|
183938
184003
|
...DEFAULT_IGNORED_PATTERNS,
|
|
183939
184004
|
...ignored.map(normalizeIgnorePattern)
|
|
183940
184005
|
];
|
|
183941
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
184006
|
+
const resolvedPaths = filePaths.map((f) => path40.resolve(projectDir, f));
|
|
183942
184007
|
const boardFiles = findBoardFiles({
|
|
183943
184008
|
projectDir,
|
|
183944
184009
|
ignore,
|
|
@@ -183952,7 +184017,7 @@ var snapshotProject = async ({
|
|
|
183952
184017
|
const mismatches = [];
|
|
183953
184018
|
let didUpdate = false;
|
|
183954
184019
|
for (const file of boardFiles) {
|
|
183955
|
-
const relativeFilePath =
|
|
184020
|
+
const relativeFilePath = path40.relative(projectDir, file);
|
|
183956
184021
|
let circuitJson;
|
|
183957
184022
|
let pcbSvg;
|
|
183958
184023
|
let schSvg;
|
|
@@ -184007,17 +184072,17 @@ var snapshotProject = async ({
|
|
|
184007
184072
|
} catch (error) {
|
|
184008
184073
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
184009
184074
|
if (errorMessage.includes("No pcb_board found in circuit JSON")) {
|
|
184010
|
-
const fileDir =
|
|
184011
|
-
const relativeDir =
|
|
184012
|
-
const snapDir2 = snapshotsDirName ?
|
|
184013
|
-
const base2 =
|
|
184014
|
-
const snap3dPath =
|
|
184015
|
-
const existing3dSnapshot =
|
|
184075
|
+
const fileDir = path40.dirname(file);
|
|
184076
|
+
const relativeDir = path40.relative(projectDir, fileDir);
|
|
184077
|
+
const snapDir2 = snapshotsDirName ? path40.join(projectDir, snapshotsDirName, relativeDir) : path40.join(fileDir, "__snapshots__");
|
|
184078
|
+
const base2 = path40.basename(file).replace(/\.tsx$/, "");
|
|
184079
|
+
const snap3dPath = path40.join(snapDir2, `${base2}-3d.snap.png`);
|
|
184080
|
+
const existing3dSnapshot = fs40.existsSync(snap3dPath);
|
|
184016
184081
|
if (existing3dSnapshot) {
|
|
184017
184082
|
onError(kleur_default.red(`
|
|
184018
184083
|
❌ Failed to generate 3D snapshot for ${relativeFilePath}:
|
|
184019
184084
|
`) + kleur_default.red(` No pcb_board found in circuit JSON
|
|
184020
|
-
`) + kleur_default.red(` Existing snapshot: ${
|
|
184085
|
+
`) + kleur_default.red(` Existing snapshot: ${path40.relative(projectDir, snap3dPath)}
|
|
184021
184086
|
`));
|
|
184022
184087
|
return onExit(1);
|
|
184023
184088
|
} else {
|
|
@@ -184033,9 +184098,9 @@ var snapshotProject = async ({
|
|
|
184033
184098
|
}
|
|
184034
184099
|
}
|
|
184035
184100
|
}
|
|
184036
|
-
const snapDir = snapshotsDirName ?
|
|
184037
|
-
|
|
184038
|
-
const base =
|
|
184101
|
+
const snapDir = snapshotsDirName ? path40.join(projectDir, snapshotsDirName, path40.relative(projectDir, path40.dirname(file))) : path40.join(path40.dirname(file), "__snapshots__");
|
|
184102
|
+
fs40.mkdirSync(snapDir, { recursive: true });
|
|
184103
|
+
const base = path40.basename(file).replace(/\.tsx$/, "");
|
|
184039
184104
|
const snapshots = [];
|
|
184040
184105
|
if (pcbOnly || !schematicOnly) {
|
|
184041
184106
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -184053,31 +184118,31 @@ var snapshotProject = async ({
|
|
|
184053
184118
|
for (const snapshot of snapshots) {
|
|
184054
184119
|
const { type } = snapshot;
|
|
184055
184120
|
const is3d = type === "3d";
|
|
184056
|
-
const snapPath =
|
|
184057
|
-
const existing =
|
|
184121
|
+
const snapPath = path40.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
184122
|
+
const existing = fs40.existsSync(snapPath);
|
|
184058
184123
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
184059
184124
|
const newContentForFile = snapshot.content;
|
|
184060
184125
|
if (!existing) {
|
|
184061
|
-
|
|
184062
|
-
console.log("✅", kleur_default.gray(
|
|
184126
|
+
fs40.writeFileSync(snapPath, newContentForFile);
|
|
184127
|
+
console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
|
|
184063
184128
|
didUpdate = true;
|
|
184064
184129
|
continue;
|
|
184065
184130
|
}
|
|
184066
|
-
const oldContentBuffer =
|
|
184131
|
+
const oldContentBuffer = fs40.readFileSync(snapPath);
|
|
184067
184132
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
184068
184133
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
184069
184134
|
if (update) {
|
|
184070
184135
|
if (!forceUpdate && equal2) {
|
|
184071
|
-
console.log("✅", kleur_default.gray(
|
|
184136
|
+
console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
|
|
184072
184137
|
} else {
|
|
184073
|
-
|
|
184074
|
-
console.log("✅", kleur_default.gray(
|
|
184138
|
+
fs40.writeFileSync(snapPath, newContentForFile);
|
|
184139
|
+
console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
|
|
184075
184140
|
didUpdate = true;
|
|
184076
184141
|
}
|
|
184077
184142
|
} else if (!equal2) {
|
|
184078
184143
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
184079
184144
|
} else {
|
|
184080
|
-
console.log("✅", kleur_default.gray(
|
|
184145
|
+
console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
|
|
184081
184146
|
}
|
|
184082
184147
|
}
|
|
184083
184148
|
}
|
|
@@ -184116,22 +184181,22 @@ var registerSnapshot = (program3) => {
|
|
|
184116
184181
|
};
|
|
184117
184182
|
|
|
184118
184183
|
// lib/shared/setup-github-actions.ts
|
|
184119
|
-
import
|
|
184120
|
-
import
|
|
184184
|
+
import fs41 from "node:fs";
|
|
184185
|
+
import path41 from "node:path";
|
|
184121
184186
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
184122
184187
|
const findGitRoot = (startDir) => {
|
|
184123
|
-
let dir =
|
|
184124
|
-
while (dir !==
|
|
184125
|
-
if (
|
|
184188
|
+
let dir = path41.resolve(startDir);
|
|
184189
|
+
while (dir !== path41.parse(dir).root) {
|
|
184190
|
+
if (fs41.existsSync(path41.join(dir, ".git"))) {
|
|
184126
184191
|
return dir;
|
|
184127
184192
|
}
|
|
184128
|
-
dir =
|
|
184193
|
+
dir = path41.dirname(dir);
|
|
184129
184194
|
}
|
|
184130
184195
|
return null;
|
|
184131
184196
|
};
|
|
184132
184197
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
184133
|
-
const workflowsDir =
|
|
184134
|
-
|
|
184198
|
+
const workflowsDir = path41.join(gitRoot, ".github", "workflows");
|
|
184199
|
+
fs41.mkdirSync(workflowsDir, { recursive: true });
|
|
184135
184200
|
const buildWorkflow = `name: tscircuit Build
|
|
184136
184201
|
|
|
184137
184202
|
on:
|
|
@@ -184170,8 +184235,8 @@ jobs:
|
|
|
184170
184235
|
- run: bun install
|
|
184171
184236
|
- run: bunx tsci snapshot
|
|
184172
184237
|
`;
|
|
184173
|
-
writeFileIfNotExists(
|
|
184174
|
-
writeFileIfNotExists(
|
|
184238
|
+
writeFileIfNotExists(path41.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
184239
|
+
writeFileIfNotExists(path41.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
184175
184240
|
};
|
|
184176
184241
|
|
|
184177
184242
|
// cli/setup/register.ts
|
|
@@ -184196,9 +184261,21 @@ var registerSetup = (program3) => {
|
|
|
184196
184261
|
});
|
|
184197
184262
|
};
|
|
184198
184263
|
|
|
184264
|
+
// cli/auth/setup-npmrc/register.ts
|
|
184265
|
+
function registerAuthSetupNpmrc(program3) {
|
|
184266
|
+
program3.commands.find((c) => c.name() === "auth").command("setup-npmrc").description("Configure your global .npmrc file with authentication for tscircuit private packages").action(async () => {
|
|
184267
|
+
const sessionToken = getSessionToken();
|
|
184268
|
+
if (!sessionToken) {
|
|
184269
|
+
console.log(kleur_default.red("Error: Not logged in. Please run 'tsci login' first."));
|
|
184270
|
+
process.exit(1);
|
|
184271
|
+
}
|
|
184272
|
+
setupNpmrc(sessionToken);
|
|
184273
|
+
});
|
|
184274
|
+
}
|
|
184275
|
+
|
|
184199
184276
|
// cli/convert/register.ts
|
|
184200
|
-
import
|
|
184201
|
-
import
|
|
184277
|
+
import fs42 from "node:fs/promises";
|
|
184278
|
+
import path42 from "node:path";
|
|
184202
184279
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
184203
184280
|
|
|
184204
184281
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -184318,15 +184395,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
184318
184395
|
var registerConvert = (program3) => {
|
|
184319
184396
|
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) => {
|
|
184320
184397
|
try {
|
|
184321
|
-
const inputPath =
|
|
184322
|
-
const modContent = await
|
|
184398
|
+
const inputPath = path42.resolve(file);
|
|
184399
|
+
const modContent = await fs42.readFile(inputPath, "utf-8");
|
|
184323
184400
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
184324
|
-
const componentName = options.name ??
|
|
184401
|
+
const componentName = options.name ?? path42.basename(inputPath, ".kicad_mod");
|
|
184325
184402
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
184326
184403
|
componentName
|
|
184327
184404
|
});
|
|
184328
|
-
const outputPath = options.output ?
|
|
184329
|
-
await
|
|
184405
|
+
const outputPath = options.output ? path42.resolve(options.output) : path42.join(path42.dirname(inputPath), `${componentName}.tsx`);
|
|
184406
|
+
await fs42.writeFile(outputPath, tsx);
|
|
184330
184407
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
184331
184408
|
} catch (error) {
|
|
184332
184409
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|
|
@@ -184422,12 +184499,12 @@ var registerSimulate = (program3) => {
|
|
|
184422
184499
|
};
|
|
184423
184500
|
|
|
184424
184501
|
// lib/shared/install-project-dependencies.ts
|
|
184425
|
-
import
|
|
184426
|
-
import
|
|
184502
|
+
import fs44 from "node:fs";
|
|
184503
|
+
import path44 from "node:path";
|
|
184427
184504
|
|
|
184428
184505
|
// lib/shared/collect-tsci-dependencies.ts
|
|
184429
|
-
import
|
|
184430
|
-
import
|
|
184506
|
+
import fs43 from "node:fs";
|
|
184507
|
+
import path43 from "node:path";
|
|
184431
184508
|
var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
|
|
184432
184509
|
var DEFAULT_IGNORES = [
|
|
184433
184510
|
"**/node_modules/**",
|
|
@@ -184442,7 +184519,7 @@ function collectTsciDependencies({
|
|
|
184442
184519
|
patterns = DEFAULT_PATTERNS,
|
|
184443
184520
|
ignore = DEFAULT_IGNORES
|
|
184444
184521
|
} = {}) {
|
|
184445
|
-
const searchRoot =
|
|
184522
|
+
const searchRoot = path43.resolve(cwd);
|
|
184446
184523
|
const files = globbySync(patterns, {
|
|
184447
184524
|
cwd: searchRoot,
|
|
184448
184525
|
absolute: true,
|
|
@@ -184452,7 +184529,7 @@ function collectTsciDependencies({
|
|
|
184452
184529
|
const dependencies2 = new Set;
|
|
184453
184530
|
for (const filePath of files) {
|
|
184454
184531
|
try {
|
|
184455
|
-
const fileContents =
|
|
184532
|
+
const fileContents = fs43.readFileSync(filePath, "utf-8");
|
|
184456
184533
|
let match;
|
|
184457
184534
|
while (true) {
|
|
184458
184535
|
match = IMPORT_PATTERN.exec(fileContents);
|
|
@@ -184469,26 +184546,26 @@ function collectTsciDependencies({
|
|
|
184469
184546
|
async function installProjectDependencies({
|
|
184470
184547
|
cwd = process.cwd()
|
|
184471
184548
|
} = {}) {
|
|
184472
|
-
const projectRoot =
|
|
184473
|
-
const packageJsonPath =
|
|
184474
|
-
const npmrcPath =
|
|
184549
|
+
const projectRoot = path44.resolve(cwd);
|
|
184550
|
+
const packageJsonPath = path44.join(projectRoot, "package.json");
|
|
184551
|
+
const npmrcPath = path44.join(projectRoot, ".npmrc");
|
|
184475
184552
|
const packageManager = getPackageManager();
|
|
184476
|
-
if (!
|
|
184553
|
+
if (!fs44.existsSync(projectRoot)) {
|
|
184477
184554
|
throw new Error(`Directory not found: ${projectRoot}`);
|
|
184478
184555
|
}
|
|
184479
184556
|
let packageJsonCreated = false;
|
|
184480
|
-
if (!
|
|
184557
|
+
if (!fs44.existsSync(packageJsonPath)) {
|
|
184481
184558
|
console.log("No package.json found. Generating a new one.");
|
|
184482
184559
|
generatePackageJson(projectRoot);
|
|
184483
184560
|
packageJsonCreated = true;
|
|
184484
184561
|
} else {
|
|
184485
184562
|
console.log("Found existing package.json.");
|
|
184486
184563
|
}
|
|
184487
|
-
if (!
|
|
184564
|
+
if (!fs44.existsSync(npmrcPath)) {
|
|
184488
184565
|
console.log("Creating .npmrc with tscircuit registry configuration.");
|
|
184489
|
-
|
|
184566
|
+
fs44.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
|
|
184490
184567
|
}
|
|
184491
|
-
const packageJson = JSON.parse(
|
|
184568
|
+
const packageJson = JSON.parse(fs44.readFileSync(packageJsonPath, "utf-8"));
|
|
184492
184569
|
if (packageJsonCreated) {
|
|
184493
184570
|
const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
|
|
184494
184571
|
if (tsciDependencies.length > 0) {
|
|
@@ -184503,7 +184580,7 @@ async function installProjectDependencies({
|
|
|
184503
184580
|
console.log("No @tsci dependencies detected in circuit files.");
|
|
184504
184581
|
}
|
|
184505
184582
|
}
|
|
184506
|
-
|
|
184583
|
+
fs44.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
184507
184584
|
`);
|
|
184508
184585
|
console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
|
|
184509
184586
|
try {
|
|
@@ -184537,7 +184614,7 @@ var registerInstall = (program3) => {
|
|
|
184537
184614
|
};
|
|
184538
184615
|
|
|
184539
184616
|
// cli/transpile/register.ts
|
|
184540
|
-
import
|
|
184617
|
+
import path45 from "node:path";
|
|
184541
184618
|
var registerTranspile = (program3) => {
|
|
184542
184619
|
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
184543
184620
|
try {
|
|
@@ -184545,7 +184622,7 @@ var registerTranspile = (program3) => {
|
|
|
184545
184622
|
fileOrDir: file,
|
|
184546
184623
|
includeBoardFiles: false
|
|
184547
184624
|
});
|
|
184548
|
-
const distDir =
|
|
184625
|
+
const distDir = path45.join(projectDir, "dist");
|
|
184549
184626
|
validateMainInDist(projectDir, distDir);
|
|
184550
184627
|
console.log("Transpiling entry file...");
|
|
184551
184628
|
const entryFile = mainEntrypoint || circuitFiles[0];
|
|
@@ -184585,6 +184662,7 @@ registerAuthLogout(program2);
|
|
|
184585
184662
|
registerAuthPrintToken(program2);
|
|
184586
184663
|
registerAuthSetToken(program2);
|
|
184587
184664
|
registerAuthWhoami(program2);
|
|
184665
|
+
registerAuthSetupNpmrc(program2);
|
|
184588
184666
|
registerConfig(program2);
|
|
184589
184667
|
registerConfigPrint(program2);
|
|
184590
184668
|
registerConfigSet(program2);
|